Skip to content

Commit 995294b

Browse files
committed
🚧 node.scale -> node.baseScale
1 parent 2ac8f5b commit 995294b

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

schemas/pluginJson.schema.json

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
"resourceLocation",
406406
"boundingBox",
407407
"configs",
408-
"scale"
408+
"baseScale"
409409
],
410410
"properties": {
411411
"modelPath": { "type": "string" },
@@ -419,7 +419,10 @@
419419
"max": { "$ref": "#/definitions/vec3" }
420420
}
421421
},
422-
"scale": { "type": "number" },
422+
"baseScale": {
423+
"type": "number",
424+
"description": "The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit."
425+
},
423426
"configs": {
424427
"type": "object",
425428
"patternProperties": {
@@ -475,7 +478,7 @@
475478
"backgroundColor",
476479
"backgroundAlpha",
477480
"align",
478-
"scale",
481+
"baseScale",
479482
"config"
480483
],
481484
"properties": {
@@ -487,7 +490,10 @@
487490
"type": "string",
488491
"enum": ["left", "center", "right"]
489492
},
490-
"scale": { "type": "number" },
493+
"baseScale": {
494+
"type": "number",
495+
"description": "The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit."
496+
},
491497
"config": {
492498
"$ref": "#/definitions/boneConfig"
493499
}
@@ -501,10 +507,13 @@
501507
}
502508
},
503509
"then": {
504-
"required": ["config", "block", "scale"],
510+
"required": ["config", "block", "baseScale"],
505511
"properties": {
506512
"block": { "type": "string" },
507-
"scale": { "type": "number" },
513+
"baseScale": {
514+
"type": "number",
515+
"description": "The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit."
516+
},
508517
"config": {
509518
"$ref": "#/definitions/boneConfig"
510519
}
@@ -518,10 +527,13 @@
518527
}
519528
},
520529
"then": {
521-
"required": ["config", "item", "scale"],
530+
"required": ["config", "item", "baseScale"],
522531
"properties": {
523532
"item": { "type": "string" },
524-
"scale": { "type": "number" },
533+
"baseScale": {
534+
"type": "number",
535+
"description": "The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit."
536+
},
525537
"config": {
526538
"$ref": "#/definitions/boneConfig"
527539
}

src/systems/animationRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export function getNodeTransforms(
163163
case 'item_display':
164164
case 'block_display':
165165
case 'bone': {
166-
matrix = getNodeMatrix(node.node, node.scale)
166+
matrix = getNodeMatrix(node.node, node.baseScale)
167167
// Only add the frame if the matrix has changed.
168168
// NOTE - Disabled because it causes issues with vanilla interpolation.
169169
if (lastFrame && lastFrame.matrix.equals(matrix)) continue

src/systems/rigRenderer.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ export interface IRenderedNodes {
9090
modelPath: string
9191
resourceLocation: string
9292
boundingBox: THREE.Box3
93-
scale: number
93+
/**
94+
* The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit.
95+
*/
96+
baseScale: number
9497
configs: {
9598
default?: IBlueprintBoneConfigJSON
9699
variants: Record<string, IBlueprintBoneConfigJSON>
@@ -121,21 +124,30 @@ export interface IRenderedNodes {
121124
align: Alignment
122125
shadow: boolean
123126
seeThrough: boolean
124-
scale: number
127+
/**
128+
* The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit.
129+
*/
130+
baseScale: number
125131
config?: IBlueprintTextDisplayConfigJSON
126132
}
127133
ItemDisplay: IRenderedNode & {
128134
type: 'item_display'
129135
node: VanillaItemDisplay
130136
item: string
131-
scale: number
137+
/**
138+
* The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit.
139+
*/
140+
baseScale: number
132141
config?: IBlueprintBoneConfigJSON
133142
}
134143
BlockDisplay: IRenderedNode & {
135144
type: 'block_display'
136145
node: VanillaBlockDisplay
137146
block: string
138-
scale: number
147+
/**
148+
* The base scale of the bone, used to offset any rescaling done to the bone's model due to exceeding the 3x3x3 model size limit.
149+
*/
150+
baseScale: number
139151
config?: IBlueprintBoneConfigJSON
140152
}
141153
}
@@ -343,7 +355,7 @@ function renderGroup(group: Group, rig: IRenderedRig): INodeStructure | undefine
343355
customModelData: -1,
344356
resourceLocation: parsed.resourceLocation,
345357
boundingBox: getBoneBoundingBox(group),
346-
scale: 1,
358+
baseScale: 1,
347359
configs: group.configs,
348360
}
349361

@@ -424,7 +436,7 @@ function renderGroup(group: Group, rig: IRenderedRig): INodeStructure | undefine
424436
}
425437
}
426438

427-
renderedBone.scale = 1 / scale
439+
renderedBone.baseScale = 1 / scale
428440
rig.models[group.uuid] = renderedBone.model
429441
rig.nodeMap[group.uuid] = renderedBone
430442
return structure
@@ -453,7 +465,7 @@ function renderItemDisplay(
453465
name: display.name,
454466
uuid: display.uuid,
455467
item: display.item,
456-
scale: 1,
468+
baseScale: 1,
457469
config: display.config,
458470
}
459471

@@ -487,7 +499,7 @@ function renderBlockDisplay(
487499
name: display.name,
488500
uuid: display.uuid,
489501
block: display.block,
490-
scale: 1,
502+
baseScale: 1,
491503
config: display.config,
492504
}
493505

@@ -524,7 +536,7 @@ function renderTextDisplay(display: TextDisplay, rig: IRenderedRig): INodeStruct
524536
align: display.align,
525537
shadow: display.shadow,
526538
seeThrough: display.seeThrough,
527-
scale: 1,
539+
baseScale: 1,
528540
config: display.config,
529541
}
530542

0 commit comments

Comments
 (0)