minerender 2.1.0-alpha.139 → 2.1.0-alpha.140
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/browser/esm/index.browser.d.mts +10 -1
- package/dist/browser/esm/scene/SceneDocument.mjs +18 -3
- package/dist/browser/esm/scene/SceneDocument.mjs.map +1 -1
- package/dist/browser/esm/scene/SceneDocumentLoader.mjs +13 -3
- package/dist/browser/esm/scene/SceneDocumentLoader.mjs.map +1 -1
- package/dist/browser/index.d.ts +10 -1
- package/dist/browser/index.js +31 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/bundle.js +31 -6
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +10 -1
- package/dist/node/index.d.ts +10 -1
- package/dist/node/index.js +31 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +31 -6
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -101852,6 +101852,23 @@ gl_FragDepth=readDepth(vUv);
|
|
|
101852
101852
|
}
|
|
101853
101853
|
});
|
|
101854
101854
|
};
|
|
101855
|
+
function entityAnimation(value, path) {
|
|
101856
|
+
const animation = object3(value, path);
|
|
101857
|
+
if (["name", "clips"].filter((key) => animation[key] !== void 0).length !== 1) {
|
|
101858
|
+
fail2(path, "expected exactly one of name or clips");
|
|
101859
|
+
}
|
|
101860
|
+
fields(value, path, { name: text, clips: (value2, path2) => {
|
|
101861
|
+
list((value3, path3) => {
|
|
101862
|
+
fields(value3, path3, { name: text, weight: nonnegative }, ["name"]);
|
|
101863
|
+
})(value2, path2);
|
|
101864
|
+
if (!value2.length) fail2(path2, "expected at least one clip");
|
|
101865
|
+
const names = /* @__PURE__ */ new Set();
|
|
101866
|
+
for (const [index, clip] of value2.entries()) {
|
|
101867
|
+
if (names.has(clip.name)) fail2(`${path2}[${index}].name`, `duplicate clip "${clip.name}"`);
|
|
101868
|
+
names.add(clip.name);
|
|
101869
|
+
}
|
|
101870
|
+
}, loop: boolean, speed: nonnegative, time: nonnegative, paused: boolean });
|
|
101871
|
+
}
|
|
101855
101872
|
function guiLayer(value, path) {
|
|
101856
101873
|
const layer = object3(value, path);
|
|
101857
101874
|
if (["texture", "item", "text"].filter((key) => layer[key] !== void 0).length !== 1) {
|
|
@@ -101954,9 +101971,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
101954
101971
|
})
|
|
101955
101972
|
});
|
|
101956
101973
|
},
|
|
101957
|
-
animation:
|
|
101958
|
-
fields(value2, path2, { name: text, loop: boolean, speed: nonnegative, time: nonnegative, paused: boolean }, ["name"]);
|
|
101959
|
-
}
|
|
101974
|
+
animation: entityAnimation
|
|
101960
101975
|
}, [...required, "asset"]);
|
|
101961
101976
|
if (Array.isArray(input.layers) && !input.layers.length) fail2(`${path}.layers`, "expected at least one layer");
|
|
101962
101977
|
break;
|
|
@@ -102229,10 +102244,20 @@ gl_FragDepth=readDepth(vUv);
|
|
|
102229
102244
|
const entity = await content.addEntity(model, { ...definition.options, instanceMeshes: false });
|
|
102230
102245
|
object4 = entity;
|
|
102231
102246
|
if (definition.animation) {
|
|
102247
|
+
const animation = definition.animation;
|
|
102232
102248
|
const animations = await Entities.getAnimations(key);
|
|
102233
|
-
|
|
102234
|
-
|
|
102235
|
-
|
|
102249
|
+
if (animation.name !== void 0) {
|
|
102250
|
+
const clip = animations && Object.prototype.hasOwnProperty.call(animations, animation.name) ? animations[animation.name] : void 0;
|
|
102251
|
+
if (!clip) throw new Error(`Entity ${definition.asset} has no animation "${animation.name}"`);
|
|
102252
|
+
entity.playAnimation(clip, animation);
|
|
102253
|
+
} else {
|
|
102254
|
+
const clips = animation.clips.map(({ name: name2 }) => {
|
|
102255
|
+
const clip = animations && Object.prototype.hasOwnProperty.call(animations, name2) ? animations[name2] : void 0;
|
|
102256
|
+
if (!clip) throw new Error(`Entity ${definition.asset} has no animation "${name2}"`);
|
|
102257
|
+
return clip;
|
|
102258
|
+
});
|
|
102259
|
+
entity.playAnimations(clips, { ...animation, weights: animation.clips.map((clip) => clip.weight ?? 1) });
|
|
102260
|
+
}
|
|
102236
102261
|
}
|
|
102237
102262
|
break;
|
|
102238
102263
|
}
|