소스 검색

Merge pull request #3942 from RaananW/viewer-catch-errors

Viewer catch errors
Raanan Weber 7 년 전
부모
커밋
65eeac7f01
3개의 변경된 파일29개의 추가작업 그리고 23개의 파일을 삭제
  1. 6 3
      Viewer/src/viewer/viewer.ts
  2. 17 17
      dist/preview release/viewer/babylon.viewer.js
  3. 6 3
      dist/preview release/viewer/babylon.viewer.max.js

+ 6 - 3
Viewer/src/viewer/viewer.ts

@@ -1,7 +1,7 @@
 import { viewerManager } from './viewerManager';
 import { TemplateManager } from './../templateManager';
 import configurationLoader from './../configuration/loader';
-import { CubeTexture, Color3, IEnvironmentHelperOptions, EnvironmentHelper, Effect, SceneOptimizer, SceneOptimizerOptions, Observable, Engine, Scene, ArcRotateCamera, Vector3, SceneLoader, AbstractMesh, Mesh, HemisphericLight, Database, SceneLoaderProgressEvent, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Quaternion, Light, ShadowLight, ShadowGenerator, Tags, AutoRotationBehavior, BouncingBehavior, FramingBehavior, Behavior } from 'babylonjs';
+import { CubeTexture, Color3, IEnvironmentHelperOptions, EnvironmentHelper, Effect, SceneOptimizer, SceneOptimizerOptions, Observable, Engine, Scene, ArcRotateCamera, Vector3, SceneLoader, AbstractMesh, Mesh, HemisphericLight, Database, SceneLoaderProgressEvent, ISceneLoaderPlugin, ISceneLoaderPluginAsync, Quaternion, Light, ShadowLight, ShadowGenerator, Tags, AutoRotationBehavior, BouncingBehavior, FramingBehavior, Behavior, Tools } from 'babylonjs';
 import { ViewerConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, IObserversConfiguration, IModelConfiguration, ISkyboxConfiguration, IGroundConfiguration, ILightConfiguration, ICameraConfiguration } from '../configuration/configuration';
 
 import * as deepmerge from '../../assets/deepmerge.min.js';
@@ -656,12 +656,12 @@ export abstract class AbstractViewer {
      */
     private _onTemplateLoaded(): Promise<AbstractViewer> {
         return this.onTemplatesLoaded().then(() => {
-            let autoLoadModel = !!this.configuration.model;
+            let autoLoadModel = this.configuration.model;
             return this.initEngine().then((engine) => {
                 return this.onEngineInitObservable.notifyObserversWithPromise(engine);
             }).then(() => {
                 if (autoLoadModel) {
-                    return this.loadModel().then(() => { return this.scene });
+                    return this.loadModel().catch(e => { }).then(() => { return this.scene });
                 } else {
                     return this.scene || this.initScene();
                 }
@@ -669,6 +669,9 @@ export abstract class AbstractViewer {
                 return this.onSceneInitObservable.notifyObserversWithPromise(scene);
             }).then(() => {
                 return this.onInitDoneObservable.notifyObserversWithPromise(this);
+            }).catch(e => {
+                Tools.Warn(e.toString());
+                return this;
             });
         })
     }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 17 - 17
dist/preview release/viewer/babylon.viewer.js


+ 6 - 3
dist/preview release/viewer/babylon.viewer.max.js

@@ -94127,12 +94127,12 @@ var AbstractViewer = (function () {
     AbstractViewer.prototype._onTemplateLoaded = function () {
         var _this = this;
         return this.onTemplatesLoaded().then(function () {
-            var autoLoadModel = !!_this.configuration.model;
+            var autoLoadModel = _this.configuration.model;
             return _this.initEngine().then(function (engine) {
                 return _this.onEngineInitObservable.notifyObserversWithPromise(engine);
             }).then(function () {
                 if (autoLoadModel) {
-                    return _this.loadModel().then(function () { return _this.scene; });
+                    return _this.loadModel().catch(function (e) { }).then(function () { return _this.scene; });
                 }
                 else {
                     return _this.scene || _this.initScene();
@@ -94141,6 +94141,9 @@ var AbstractViewer = (function () {
                 return _this.onSceneInitObservable.notifyObserversWithPromise(scene);
             }).then(function () {
                 return _this.onInitDoneObservable.notifyObserversWithPromise(_this);
+            }).catch(function (e) {
+                babylonjs_1.Tools.Warn(e.toString());
+                return _this;
             });
         });
     };
@@ -94565,7 +94568,7 @@ module.exports = g;
 /* 17 */
 /***/ (function(module, exports) {
 
-module.exports = cannon;
+module.exports = CANNON;
 
 /***/ }),
 /* 18 */