浏览代码

Fix a bug when MTL file was not retrieved quickly enough (due to async call).

Temechon 9 年之前
父节点
当前提交
4f4b35545b
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 1
      loaders/OBJ/babylon.objFileLoader.js
  2. 2 1
      loaders/OBJ/babylon.objFileLoader.ts

+ 1 - 1
loaders/OBJ/babylon.objFileLoader.js

@@ -210,7 +210,7 @@ var BABYLON;
             //The complete path to the mtl file
             //The complete path to the mtl file
             var pathOfFile = BABYLON.Tools.BaseUrl + rootUrl + url;
             var pathOfFile = BABYLON.Tools.BaseUrl + rootUrl + url;
             // Loads through the babylon tools to allow fileInput search.
             // Loads through the babylon tools to allow fileInput search.
-            BABYLON.Tools.LoadFile(pathOfFile, onSuccess, null, null, false, function () { console.warn("Error - Unable to load " + pathOfFile); });
+            BABYLON.Tools.LoadFile(pathOfFile, onSuccess, null, null, false, function () { console.warn("Error - Unable to load " + pathOfFile); }, true /* synchronous call */);
         };
         };
         OBJFileLoader.prototype.importMesh = function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
         OBJFileLoader.prototype.importMesh = function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
             //get the meshes from OBJ file
             //get the meshes from OBJ file

+ 2 - 1
loaders/OBJ/babylon.objFileLoader.ts

@@ -234,7 +234,8 @@ module BABYLON {
                 null, 
                 null, 
                 null, 
                 null, 
                 false, 
                 false, 
-                () => { console.warn("Error - Unable to load " + pathOfFile); })
+                () => { console.warn("Error - Unable to load " + pathOfFile); }, 
+                true /* synchronous call */);
         }
         }
 
 
         public importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]): boolean {
         public importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]): boolean {