Skip to content

Commit adf6689

Browse files
committed
Add node hierarchy information
1 parent 477380b commit adf6689

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

schemas/plugin-blueprint.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@
164164
"type": {
165165
"type": "string"
166166
},
167+
"parent": {
168+
"type": "string",
169+
"pattern": "^[a-z0-9_]+$"
170+
},
167171
"default_transformation": {
168172
"$ref": "#/definitions/node_transformation"
169173
}

src/systems/pluginCompiler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ type NodeType =
120120
type PluginNode =
121121
| {
122122
type: 'bone'
123+
parent?: string
123124
default_transformation?: NodeTransformation
124125
display_properties?: Record<string, unknown>
125126
elements: BoneElement[]
126127
}
127128
| {
128129
type: Exclude<NodeType, 'bone'>
130+
parent?: string
129131
default_transformation?: NodeTransformation
130132
display_properties?: Record<string, unknown>
131133
}
@@ -339,12 +341,14 @@ function serializeBoneElements(
339341
function serializeNode(
340342
node: AnyRenderedNode,
341343
options: {
344+
parent?: string
342345
defaultVariantModels: Record<string, { model: IRenderedModel | null }>
343346
textureIdToKey: Map<string, string>
344347
textureKeyToPaletteId: Map<string, string>
345348
}
346349
): PluginNode {
347350
const base = {
351+
parent: options.parent,
348352
default_transformation: serializeNodeTransformation(node.default_transform),
349353
} as const
350354

@@ -684,6 +688,7 @@ export function exportPluginBlueprint(options: {
684688
const nodeId = nodeUuidToId.get(uuid)
685689
if (!nodeId) continue
686690
nodes[nodeId] = serializeNode(node, {
691+
parent: node.parent ? nodeUuidToId.get(node.parent) : undefined,
687692
defaultVariantModels,
688693
textureIdToKey,
689694
textureKeyToPaletteId,

0 commit comments

Comments
 (0)