Browse Source

JS Update for light-parent in loader.

Raanan Weber 10 years ago
parent
commit
54454086f3
1 changed files with 13 additions and 0 deletions
  1. 13 0
      Babylon/Loading/Plugins/babylon.babylonFileLoader.js

+ 13 - 0
Babylon/Loading/Plugins/babylon.babylonFileLoader.js

@@ -335,6 +335,11 @@
                 light._excludedMeshesIds = parsedLight.excludedMeshesIds;
             }
 
+            // Parent
+            if (parsedLight.parentId) {
+                light._waitingParentId = parsedLight.parentId;
+            }
+
             if (parsedLight.includedOnlyMeshesIds) {
                 light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;
             }
@@ -1196,6 +1201,14 @@
                     }
                 }
 
+                for (index = 0; index < scene.lights.length; index++) {
+                    var light = scene.lights[index];
+                    if (light._waitingParentId) {
+                        light.parent = scene.getLastEntryByID(light._waitingParentId);
+                        light._waitingParentId = undefined;
+                    }
+                }
+
                 for (index = 0; index < scene.meshes.length; index++) {
                     var mesh = scene.meshes[index];
                     if (mesh._waitingParentId) {