소스 검색

using root mesh to configure the model

Raanan Weber 7 년 전
부모
커밋
033650855f
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      Viewer/src/model/viewerModel.ts

+ 5 - 2
Viewer/src/model/viewerModel.ts

@@ -96,6 +96,9 @@ export class ViewerModel implements IDisposable {
 
 
         this._viewer.models.push(this);
         this._viewer.models.push(this);
         this._viewer.onModelAddedObservable.notifyObservers(this);
         this._viewer.onModelAddedObservable.notifyObservers(this);
+        this.onLoadedObservable.add(() => {
+            this._configureModel();
+        })
 
 
     }
     }
 
 
@@ -242,7 +245,8 @@ export class ViewerModel implements IDisposable {
     }
     }
 
 
     private _configureModel() {
     private _configureModel() {
-        let meshesWithNoParent: Array<AbstractMesh> = this._meshes.filter(m => m === this.rootMesh);
+        // this can be changed to the meshes that have rootMesh a parent without breaking anything.
+        let meshesWithNoParent: Array<AbstractMesh> = [this.rootMesh] //this._meshes.filter(m => m === this.rootMesh);
         let updateMeshesWithNoParent = (variable: string, value: any, param?: string) => {
         let updateMeshesWithNoParent = (variable: string, value: any, param?: string) => {
             meshesWithNoParent.forEach(mesh => {
             meshesWithNoParent.forEach(mesh => {
                 if (param) {
                 if (param) {
@@ -300,7 +304,6 @@ export class ViewerModel implements IDisposable {
             if (this._modelConfiguration.normalize === true) {
             if (this._modelConfiguration.normalize === true) {
                 center = true;
                 center = true;
                 unitSize = true;
                 unitSize = true;
-                parentIndex = 0;
             } else {
             } else {
                 center = !!this._modelConfiguration.normalize.center;
                 center = !!this._modelConfiguration.normalize.center;
                 unitSize = !!this._modelConfiguration.normalize.unitSize;
                 unitSize = !!this._modelConfiguration.normalize.unitSize;