@directivegames/genesys.js 3.1.29 → 3.1.31

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.
@@ -22,7 +22,7 @@ import type { GenericMaterialType } from '../materials.js';
22
22
  import type { ActorOptions } from './Actor.js';
23
23
  import type { ComponentPhysicsOptions } from '../physics/PhysicsTypes.js';
24
24
  import type { EditorClassMeta } from '../utils/EditorClassMeta.js';
25
-
25
+ import type { Loader } from '../utils/serialization/serializer.js';
26
26
  export interface GLTFMeshActorOptions extends ActorOptions {
27
27
  modelUrl?: string;
28
28
  material?: GenericMaterialType;
@@ -78,6 +78,20 @@ export class GLTFMeshActor extends Actor<GLTFMeshActorOptions> {
78
78
  this.setRootComponent(mesh, true);
79
79
  }
80
80
 
81
+ // HACK for properly serialize the mesh component with correct
82
+ public override deserialize(loader: Loader): void {
83
+ super.deserialize(loader);
84
+
85
+ // HACKest thing, make sure options are properly assigned to the root component
86
+ // not doing a direct `const mesh = loader.loadValue('rootComponent', null); this.setRootComponent(mesh, false);`
87
+ // as ths is the smallest change that only populates the `options` field
88
+ // we won't need this once the ctor args are not longer needed, and options are no longer stored
89
+ const mesh = loader.loadValue('rootComponent', null);
90
+ if (mesh instanceof GLTFMeshComponent) {
91
+ Object.assign(this.rootComponent.options, mesh.options);
92
+ }
93
+ }
94
+
81
95
  public override setRootComponent(component: SceneComponent, copyTransform: boolean): this {
82
96
  super.setRootComponent(component, copyTransform);
83
97
  if (!(component instanceof GLTFMeshComponent)) {