pixifact 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -180,7 +180,15 @@ function setNodeId(template, command, context) {
|
|
|
180
180
|
return { ok: false, command, error: 'Node was not found.' };
|
|
181
181
|
}
|
|
182
182
|
const previous = located.node.id;
|
|
183
|
-
|
|
183
|
+
const next = command.value?.trim() || undefined;
|
|
184
|
+
if (next && next !== previous && sceneNodeIdIsUsed(template.children, next, located.node)) {
|
|
185
|
+
return {
|
|
186
|
+
ok: false,
|
|
187
|
+
command,
|
|
188
|
+
error: `Scene node id "${next}" is already in use.`,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
located.node.id = next;
|
|
184
192
|
const locator = childCompilerSceneNodeLocator(located.parentLocator, located.node, located.index);
|
|
185
193
|
return {
|
|
186
194
|
ok: true,
|
|
@@ -193,6 +201,23 @@ function setNodeId(template, command, context) {
|
|
|
193
201
|
selection: { type: 'node', node: locator },
|
|
194
202
|
};
|
|
195
203
|
}
|
|
204
|
+
function sceneNodeIdIsUsed(nodes, id, ignored) {
|
|
205
|
+
for (const node of nodes) {
|
|
206
|
+
if (node.kind === 'slotOutlet')
|
|
207
|
+
continue;
|
|
208
|
+
if (node !== ignored && node.id === id)
|
|
209
|
+
return true;
|
|
210
|
+
if (node.kind === 'pixi' && sceneNodeIdIsUsed(node.children, id, ignored))
|
|
211
|
+
return true;
|
|
212
|
+
if (node.kind === 'sceneInstance') {
|
|
213
|
+
for (const children of Object.values(node.slots)) {
|
|
214
|
+
if (sceneNodeIdIsUsed(children, id, ignored))
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
196
221
|
function setNodeProp(template, command, context) {
|
|
197
222
|
const located = findCompilerSceneNodeLocation(template.children, command.node, context);
|
|
198
223
|
if (!located || located.node.kind === 'slotOutlet') {
|