lythreeframe 1.2.33 → 1.2.35

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.
@@ -683,6 +683,9 @@ class SceneComponent extends Component {
683
683
  }
684
684
  /* click */
685
685
  onClicked() {
686
+ if (!this.isClickEnabled) {
687
+ return;
688
+ }
686
689
  if (this.parentActor) {
687
690
  let comp = this;
688
691
  this.parentActor.onComponentClicked(comp);
@@ -1044,7 +1047,7 @@ class AssetManager {
1044
1047
  for (let i = 0; i < children.length; ++i) {
1045
1048
  this.convertThreeObjectToLYObject(newComp, children[i]);
1046
1049
  }
1047
- return threejsObject.userData.LYObject;
1050
+ return newComp;
1048
1051
  }
1049
1052
  collectResourcesAndReferences(object) {
1050
1053
  function countResource(map, resource) {
@@ -1115,51 +1118,10 @@ class AssetManager {
1115
1118
  });
1116
1119
  }
1117
1120
  }
1118
- // loadMultiGLTFAsGroup(tasks:LoadTask[], onProgress:((url:string, loaded:number, total:number) => void) | null = null, onAllFinished:(() => void) | null = null)
1119
- // {
1120
- // this.loadingManager.onLoad = onAllFinished ? () =>
1121
- // {
1122
- // this.loadingManager.onLoad = () =>
1123
- // {
1124
- // };
1125
- // onAllFinished();
1126
- // } : () =>
1127
- // {
1128
- // this.loadingManager.onLoad = () =>
1129
- // {
1130
- // };
1131
- // };
1132
- // this.loadingManager.onProgress = onProgress ? (url, loaded, total) =>
1133
- // {
1134
- // onProgress(url, loaded, total);
1135
- // } : () =>
1136
- // {
1137
- // };
1138
- // tasks.forEach(
1139
- // (task) =>
1140
- // {
1141
- // task.Paths.forEach(
1142
- // (path) =>
1143
- // {
1144
- // const onGlbLoaded = (glb:GLTF) =>
1145
- // {
1146
- // task.onLoadingFinished(glb);
1147
- // this.collectResourcesAndReferences(glb.scene);
1148
- // };
1149
- // try
1150
- // {
1151
- // this.gltfLoader.load(path, (glb:GLTF) =>
1152
- // {
1153
- // onGlbLoaded(glb);
1154
- // });
1155
- // } catch (e)
1156
- // {
1157
- // console.error(e, path);
1158
- // }
1159
- // });
1160
- // }
1161
- // );
1162
- // }
1121
+ async loadGltfFromPath(path) {
1122
+ let res = await this.gltfLoader.loadAsync(path);
1123
+ return res;
1124
+ }
1163
1125
  loadGltfFromBuffer(data, path, onLoadFinished) {
1164
1126
  this.gltfLoader.parse(data, path, onLoadFinished);
1165
1127
  }
@@ -681,6 +681,9 @@ class SceneComponent extends Component {
681
681
  }
682
682
  /* click */
683
683
  onClicked() {
684
+ if (!this.isClickEnabled) {
685
+ return;
686
+ }
684
687
  if (this.parentActor) {
685
688
  let comp = this;
686
689
  this.parentActor.onComponentClicked(comp);
@@ -1042,7 +1045,7 @@ class AssetManager {
1042
1045
  for (let i = 0; i < children.length; ++i) {
1043
1046
  this.convertThreeObjectToLYObject(newComp, children[i]);
1044
1047
  }
1045
- return threejsObject.userData.LYObject;
1048
+ return newComp;
1046
1049
  }
1047
1050
  collectResourcesAndReferences(object) {
1048
1051
  function countResource(map, resource) {
@@ -1113,51 +1116,10 @@ class AssetManager {
1113
1116
  });
1114
1117
  }
1115
1118
  }
1116
- // loadMultiGLTFAsGroup(tasks:LoadTask[], onProgress:((url:string, loaded:number, total:number) => void) | null = null, onAllFinished:(() => void) | null = null)
1117
- // {
1118
- // this.loadingManager.onLoad = onAllFinished ? () =>
1119
- // {
1120
- // this.loadingManager.onLoad = () =>
1121
- // {
1122
- // };
1123
- // onAllFinished();
1124
- // } : () =>
1125
- // {
1126
- // this.loadingManager.onLoad = () =>
1127
- // {
1128
- // };
1129
- // };
1130
- // this.loadingManager.onProgress = onProgress ? (url, loaded, total) =>
1131
- // {
1132
- // onProgress(url, loaded, total);
1133
- // } : () =>
1134
- // {
1135
- // };
1136
- // tasks.forEach(
1137
- // (task) =>
1138
- // {
1139
- // task.Paths.forEach(
1140
- // (path) =>
1141
- // {
1142
- // const onGlbLoaded = (glb:GLTF) =>
1143
- // {
1144
- // task.onLoadingFinished(glb);
1145
- // this.collectResourcesAndReferences(glb.scene);
1146
- // };
1147
- // try
1148
- // {
1149
- // this.gltfLoader.load(path, (glb:GLTF) =>
1150
- // {
1151
- // onGlbLoaded(glb);
1152
- // });
1153
- // } catch (e)
1154
- // {
1155
- // console.error(e, path);
1156
- // }
1157
- // });
1158
- // }
1159
- // );
1160
- // }
1119
+ async loadGltfFromPath(path) {
1120
+ let res = await this.gltfLoader.loadAsync(path);
1121
+ return res;
1122
+ }
1161
1123
  loadGltfFromBuffer(data, path, onLoadFinished) {
1162
1124
  this.gltfLoader.parse(data, path, onLoadFinished);
1163
1125
  }
@@ -22,6 +22,7 @@ export declare class AssetManager {
22
22
  convertThreeObjectToLYObject(parentLYComponent: SceneComponent, threejsObject: any): SceneComponent | null;
23
23
  collectResourcesAndReferences(object: Object3D): void;
24
24
  checkMeshResource(mesh: Mesh): void;
25
+ loadGltfFromPath(path: string): Promise<GLTF>;
25
26
  loadGltfFromBuffer(data: ArrayBuffer | string, path: string, onLoadFinished: (gltf: GLTF) => void): void;
26
27
  loadFile(filepath: string | undefined, onLoadFinished: (data: any) => void): void;
27
28
  addAsset(asset: BufferGeometry | Material | Texture, referenceCount?: number): TAssetPointer<BufferGeometry | Material | Texture> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lythreeframe",
3
- "version": "1.2.33",
3
+ "version": "1.2.35",
4
4
  "description": "Three.js 封装",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",