@scenoco-three/unity 1.5.0 → 1.6.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.
- package/dist/convert.d.ts +2 -0
- package/dist/convert.js +2 -0
- package/dist/twin.js +5 -3
- package/package.json +2 -2
package/dist/convert.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export interface UnityNode {
|
|
|
83
83
|
prefab?: string;
|
|
84
84
|
/** A placed prefab given attributes: what this copy is built as, to compare with the prefab. */
|
|
85
85
|
given?: boolean;
|
|
86
|
+
/** Added under a placed prefab by its tag: an object the copy adds, never one of the prefab's own. */
|
|
87
|
+
added?: boolean;
|
|
86
88
|
/** Its Unity layer, from a collider's `layer`: SceNoCo's layer n is Unity's user layer n + 7. */
|
|
87
89
|
layer?: number;
|
|
88
90
|
/** A placed model's objects that hold a mesh, as paths of names from its root, as glTFast names them. */
|
package/dist/convert.js
CHANGED
package/dist/twin.js
CHANGED
|
@@ -294,12 +294,14 @@ class Writer {
|
|
|
294
294
|
e.add(new El(`${e.tag}.removedComponents`).add(...removed));
|
|
295
295
|
const named = (list, name) => list.filter((c) => c.name === name);
|
|
296
296
|
const gone = [];
|
|
297
|
+
// A child added by the tag is not one of the prefab's, whatever its name.
|
|
298
|
+
const own = i.children.filter((c) => !c.added);
|
|
297
299
|
i.children.forEach((child, x) => {
|
|
298
300
|
const at = path === '' ? String(x) : `${path}/${x}`;
|
|
299
|
-
const same = named(p.children, child.name);
|
|
301
|
+
const same = child.added ? [] : named(p.children, child.name);
|
|
300
302
|
if (same.length === 0)
|
|
301
303
|
return void e.add(this.object(child, child.prefab ? 'PrefabInstance' : 'GameObject', at, scene, off));
|
|
302
|
-
const counterpart = same[named(
|
|
304
|
+
const counterpart = same[named(own, child.name).indexOf(child)];
|
|
303
305
|
if (!counterpart)
|
|
304
306
|
return;
|
|
305
307
|
const el = new El('GameObject').set('name', child.name);
|
|
@@ -314,7 +316,7 @@ class Writer {
|
|
|
314
316
|
e.add(el);
|
|
315
317
|
});
|
|
316
318
|
for (const name of new Set(p.children.map((c) => c.name)))
|
|
317
|
-
for (let k = named(
|
|
319
|
+
for (let k = named(own, name).length; k < named(p.children, name).length; k++)
|
|
318
320
|
gone.push(new El('GameObject').set('name', name));
|
|
319
321
|
if (gone.length)
|
|
320
322
|
e.add(new El(`${e.tag}.removedGameObjects`).add(...gone));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scenoco-three/unity",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Export a SceNoCo game's prefabs, scenes, meshes and materials into a Unity project: nested prefabs, shared materials, behaviours as MonoBehaviours with their fields wired.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"three",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"rolldown": "^1.0.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@scenoco-three/core": "^1.
|
|
57
|
+
"@scenoco-three/core": "^1.6.0",
|
|
58
58
|
"vite": ">=6"
|
|
59
59
|
}
|
|
60
60
|
}
|