소스 검색

Fixing onError not called on importMesh

David Catuhe 11 년 전
부모
커밋
69f6b4fc97
4개의 변경된 파일24개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 1
      Babylon/Loading/babylon.sceneLoader.js
  2. 12 4
      Babylon/Loading/babylon.sceneLoader.ts
  3. 1 1
      babylon.1.14-beta-debug.js
  4. 2 2
      babylon.1.14-beta.js

+ 9 - 1
Babylon/Loading/babylon.sceneLoader.js

@@ -48,7 +48,15 @@
                     var particleSystems = [];
                     var skeletons = [];
 
-                    if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
+                    try  {
+                        if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
+                            if (onerror) {
+                                onerror(scene);
+                            }
+
+                            return;
+                        }
+                    } catch (e) {
                         if (onerror) {
                             onerror(scene);
                         }

+ 12 - 4
Babylon/Loading/babylon.sceneLoader.ts

@@ -5,8 +5,7 @@
         load: (scene: Scene, data: string, rootUrl: string) => boolean;
     }
 
-    export class SceneLoader
-    {
+    export class SceneLoader {
         // Flags
         private static _ForceFullSceneLoadingForIncremental = false;
 
@@ -36,7 +35,7 @@
             return this._registeredPlugins[this._registeredPlugins.length - 1];
         }
 
-            // Public functions
+        // Public functions
         public static RegisterPlugin(plugin: ISceneLoaderPlugin): void {
             plugin.extensions = plugin.extensions.toLowerCase();
             SceneLoader._registeredPlugins.push(plugin);
@@ -53,7 +52,15 @@
                     var particleSystems = [];
                     var skeletons = [];
 
-                    if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
+                    try {
+                        if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
+                            if (onerror) {
+                                onerror(scene);
+                            }
+
+                            return;
+                        }
+                    } catch (e) {
                         if (onerror) {
                             onerror(scene);
                         }
@@ -61,6 +68,7 @@
                         return;
                     }
 
+
                     if (onsuccess) {
                         scene.importedMeshesFiles.push(rootUrl + sceneFilename);
                         onsuccess(meshes, particleSystems, skeletons);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
babylon.1.14-beta-debug.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 2
babylon.1.14-beta.js