浏览代码

Merge pull request #5150 from sebavan/master

Fix Action parsing if dependency not found
David Catuhe 7 年之前
父节点
当前提交
d366f34885
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      src/Loading/Plugins/babylon.babylonFileLoader.ts

+ 8 - 5
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -262,10 +262,6 @@
                     mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);
                     mesh._waitingParentId = null;
                 }
-                if (mesh._waitingActions) {
-                    ActionManager.Parse(mesh._waitingActions, mesh, scene);
-                    mesh._waitingActions = null;
-                }
             }
 
             // freeze world matrix application
@@ -311,7 +307,14 @@
             
             AbstractScene.Parse(parsedData, scene, container, rootUrl);
             
-            // Actions (scene)
+            // Actions (scene) Done last as it can access other objects.
+            for (index = 0, cache = scene.meshes.length; index < cache; index++) {
+                var mesh = scene.meshes[index];
+                if (mesh._waitingActions) {
+                    ActionManager.Parse(mesh._waitingActions, mesh, scene);
+                    mesh._waitingActions = null;
+                }
+            }
             if (parsedData.actions !== undefined && parsedData.actions !== null) {
                 ActionManager.Parse(parsedData.actions, null, scene);
             }