Browse Source

add effect layer to asset container

Trevor Baron 6 years ago
parent
commit
04c29ff310

+ 1 - 0
dist/preview release/what's new.md

@@ -39,6 +39,7 @@
 ### Materials Library
 
 ## Bug fixes
+- Add missing effect layer to asset container ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))

+ 5 - 0
src/babylon.abstractScene.ts

@@ -174,5 +174,10 @@ module BABYLON {
          * Textures to keep.
          */
         public textures = new Array<BaseTexture>();
+
+        /**
+         * Effect layers in the scene.
+         */
+        public effectLayers = new Array<EffectLayer>();
     }
 }

+ 6 - 8
src/babylon.assetContainer.ts

@@ -65,10 +65,9 @@ module BABYLON {
             this.textures.forEach((o) => {
                 this.scene.addTexture(o);
             });
-
-            for (let component of this.scene._serializableComponents) {
-                component.addFromContainer(this.scene);
-            }
+            this.effectLayers.forEach((o) => {
+                this.scene.addEffectLayer(o);
+            });
         }
 
         /**
@@ -114,10 +113,9 @@ module BABYLON {
             this.textures.forEach((o) => {
                 this.scene.removeTexture(o);
             });
-
-            for (let component of this.scene._serializableComponents) {
-                component.removeFromContainer(this.scene);
-            }
+            this.effectLayers.forEach((o) => {
+                this.scene.removeEffectLayer(o);
+            });
         }
 
         private _moveAssets<T>(sourceAssets: T[], targetAssets: T[], keepAssets: T[]): void {