浏览代码

ES6 dispose

sebavan 6 年之前
父节点
当前提交
f1d2831c19
共有 3 个文件被更改,包括 9 次插入5 次删除
  1. 1 1
      src/Engines/engine.ts
  2. 3 1
      src/Materials/Textures/baseTexture.ts
  3. 5 3
      src/scene.ts

+ 1 - 1
src/Engines/engine.ts

@@ -6576,7 +6576,7 @@ export class Engine {
         if (!DomManagement.IsWindowObjectExist()) {
             return;
         }
-        const loadingScreen = this.loadingScreen;
+        const loadingScreen = this._loadingScreen;
         if (loadingScreen) {
             loadingScreen.hideLoadingUI();
         }

+ 3 - 1
src/Materials/Textures/baseTexture.ts

@@ -667,7 +667,9 @@ export class BaseTexture implements IAnimatable {
         }
 
         // Animations
-        this._scene.stopAnimation(this);
+        if (this._scene.stopAnimation) {
+            this._scene.stopAnimation(this);
+        }
 
         // Remove from scene
         this._scene._removePendingData(this);

+ 5 - 3
src/scene.ts

@@ -4531,7 +4531,9 @@ export class Scene extends AbstractScene implements IAnimatable {
 
         this.importedMeshesFiles = new Array<string>();
 
-        this.stopAllAnimations();
+        if (this.stopAllAnimations) {
+            this.stopAllAnimations();
+        }
 
         this.resetCachedMaterial();
 
@@ -4639,8 +4641,8 @@ export class Scene extends AbstractScene implements IAnimatable {
         }
 
         // Release materials
-        if (this.defaultMaterial) {
-            this.defaultMaterial.dispose();
+        if (this._defaultMaterial) {
+            this._defaultMaterial.dispose();
         }
         while (this.multiMaterials.length) {
             this.multiMaterials[0].dispose();