@needle-tools/engine 2.67.14-pre → 2.67.15-pre

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.67.14-pre",
3
+ "version": "2.67.15-pre",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "module": "lib/needle-engine.js",
@@ -48,7 +48,9 @@ generateBMFont(fontPath, opts,
48
48
  (error, textures, font) => {
49
49
  if (error) throw error;
50
50
  textures.forEach((texture, index) => {
51
- const fileName = path.parse(texture.filename).name.toLocaleLowerCase() + ".png";
51
+ const directory = path.dirname(texture.filename);
52
+ // remove the directory from the filename, we can not rely on path.parse because it fails if the filename contains a dot
53
+ const fileName = texture.filename.substring(directory.length) + ".png";
52
54
  const outputPath = outputDir + "/" + fileName;
53
55
  console.log("Write to", outputPath);
54
56
  if (index > 0) console.log("WARN: Multiple font textures generated but they will override each other. You have currently " + charset?.length + " characters configured. Maybe too many?");
@@ -1,5 +1,5 @@
1
1
  import { TypeStore } from "./../engine_typestore"
2
-
2
+
3
3
  // Import types
4
4
  import { __Ignore } from "../../engine-components/codegen/components";
5
5
  import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint";
@@ -179,7 +179,7 @@ import { XRGrabModel } from "../../engine-components/WebXRGrabRendering";
179
179
  import { XRGrabRendering } from "../../engine-components/WebXRGrabRendering";
180
180
  import { XRRig } from "../../engine-components/WebXRRig";
181
181
  import { XRState } from "../../engine-components/XRFlag";
182
-
182
+
183
183
  // Register types
184
184
  TypeStore.add("__Ignore", __Ignore);
185
185
  TypeStore.add("AlignmentConstraint", AlignmentConstraint);
@@ -363,6 +363,25 @@ export class PlayableDirector extends Behaviour {
363
363
  console.warn("Missing binding", binding, track.name, track.type, this.name, this.playableAsset.name);
364
364
  }
365
365
  }
366
+ if (track.type === Models.TrackType.Control) {
367
+ for (let i = 0; i < track.clips.length; i++) {
368
+ const clip = track.clips[i];
369
+ let binding = clip.asset.sourceObject;
370
+ if (typeof binding === "string") {
371
+ if (this._guidsMap && this._guidsMap[binding])
372
+ binding = this._guidsMap[binding];
373
+ const obj = GameObject.findByGuid(binding, root);
374
+ if (obj === null || typeof obj !== "object") {
375
+ console.warn("Failed to resolve sourceObject binding", binding, track.name, clip);
376
+ }
377
+ else {
378
+ if (debug)
379
+ console.log("Resolved binding", binding, "to", obj);
380
+ clip.asset.sourceObject = obj;
381
+ }
382
+ }
383
+ }
384
+ }
366
385
  }
367
386
  }
368
387
 
@@ -724,23 +724,13 @@ export class ControlTrackHandler extends TrackHandler {
724
724
  models: Array<Models.ClipModel> = [];
725
725
  timelines: Array<PlayableDirector | null> = [];
726
726
 
727
- private static resolved: { [key: string]: THREE.Object3D } = {};
728
-
729
- resolveSourceObjects(context: Context) {
727
+ resolveSourceObjects(_context: Context) {
730
728
  for (let i = this.models.length - 1; i >= 0; i--) {
731
729
  const model = this.models[i];
732
730
  const asset = model.asset as Models.ControlClipModel;
733
- if (typeof asset.sourceObject === "string") {
734
- const key = asset.sourceObject;
735
- if (ControlTrackHandler.resolved[key]) {
736
- asset.sourceObject = ControlTrackHandler.resolved[key];
737
- }
738
- else {
739
- asset.sourceObject = GameObject.findByGuid(key, context.scene) as THREE.Object3D
740
- ControlTrackHandler.resolved[key] = asset.sourceObject;
741
- }
742
- }
743
- if (!asset.sourceObject) {
731
+
732
+ if (!asset.sourceObject || typeof asset.sourceObject !== "object") {
733
+ console.log("no source object, removing model", i, asset);
744
734
  this.models.splice(i, 1);
745
735
  continue;
746
736
  }