瀏覽代碼

Added parent to light objects parsing

Raanan Weber 10 年之前
父節點
當前提交
9994e4ccd9
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      Babylon/Loading/Plugins/babylon.babylonFileLoader.ts

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

@@ -333,6 +333,11 @@
         if (parsedLight.excludedMeshesIds) {
         if (parsedLight.excludedMeshesIds) {
             light._excludedMeshesIds = parsedLight.excludedMeshesIds;
             light._excludedMeshesIds = parsedLight.excludedMeshesIds;
         }
         }
+		
+		// Parent
+        if (parsedLight.parentId) {
+            light._waitingParentId = parsedLight.parentId;
+        }
 
 
         if (parsedLight.includedOnlyMeshesIds) {
         if (parsedLight.includedOnlyMeshesIds) {
             light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;
             light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;
@@ -1212,6 +1217,14 @@
                     camera._waitingParentId = undefined;
                     camera._waitingParentId = undefined;
                 }
                 }
             }
             }
+			
+			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++) {
             for (index = 0; index < scene.meshes.length; index++) {
                 var mesh = scene.meshes[index];
                 var mesh = scene.meshes[index];