David Catuhe 5 years ago
parent
commit
ce7fb15bf9

+ 0 - 55
Playground/test.html

@@ -1,55 +0,0 @@
-<!-- TO DO - What is the purpose of this page ? -->
-
-<div class="navbar-inner" id="topbar">
-    <a class="brand largeOnly" href="#" id="mainTitle">Babylon.js Playground</a>
-    <div class="btn-group">
-        <button class="btn" id="runButton">Run</button>
-        <button class="btn" id="saveButton">Save</button>
-        <button class="btn desktopOnly" id="zipButton">Get .zip</button>
-        <button class="btn desktopOnly" id="newButton">New</button>
-        <button class="btn desktopOnly" id="clearButton">Clear</button>
-    </div>
-    <div class="btn-group desktopOnly">
-        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
-            <span id="currentFontSize">Font: 12</span>
-            <span class="caret"></span>
-        </a>
-        <ul class="dropdown-menu" id="sizeList">
-            <li><a href="#" onclick="setFontSize(12);">12</a></li>
-            <li><a href="#" onclick="setFontSize(14);">14</a></li>
-            <li><a href="#" onclick="setFontSize(16);">16</a></li>
-            <li><a href="#" onclick="setFontSize(18);">18</a></li>
-            <li><a href="#" onclick="setFontSize(20);">20</a></li>
-            <li><a href="#" onclick="setFontSize(22);">22</a></li>
-        </ul>
-    </div>
-    <div class="btn-group desktopOnly">
-        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
-            <span id="currentVersion">Version: Latest</span>
-            <span class="caret"></span>
-        </a>
-        <ul class="dropdown-menu" id="versionList">
-            <li><a href="#" onclick="setVersion('latest');">Latest</a></li>
-            <li><a href="#" onclick="setVersion('2.5');">2.5</a></li>
-        </ul>
-    </div>
-    <div class="btn-group">
-        <label class="btn btn-sm active">
-                    <input type="checkbox" autocomplete="off" id='safemodeToggle' style="margin-top:-0.1em;margin-right:4px">Safe Mode
-                </label>
-        <button class="btn btn-sm" id="metadataButton">+Meta data</button>
-        <button class="btn btn-sm" id="editorButton">-Editor</button>
-        <button class="btn btn-sm" id="debugButton">+Debug layer</button>
-    </div>
-    <div class="btn-group pull-right">
-        <button class="btn" id="fullscreenButton">Fullscreen</button>
-        <button class="btn" id="editorFullscreenButton">Editor Fullscreen</button>
-    </div>
-    <div class="btn-group pull-right">
-        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
-            <span id="currentScript">Predefined scripts</span>
-            <span class="caret"></span>
-        </a>
-        <ul class="dropdown-menu" id="scriptsList"></ul>
-    </div>
-</div>

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 67 - 54
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 2 - 0
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -2363,7 +2363,9 @@ var GLTFLoader = /** @class */ (function () {
         };
         if (node.mesh == undefined) {
             var nodeName = node.name || "node" + node.index;
+            this._babylonScene._blockEntityCollection = this._forAssetContainer;
             node._babylonTransformNode = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["TransformNode"](nodeName, this._babylonScene);
+            this._babylonScene._blockEntityCollection = false;
             loadNode(node._babylonTransformNode);
         }
         else {

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 2 - 0
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4938,7 +4938,9 @@ var GLTFLoader = /** @class */ (function () {
         };
         if (node.mesh == undefined) {
             var nodeName = node.name || "node" + node.index;
+            this._babylonScene._blockEntityCollection = this._forAssetContainer;
             node._babylonTransformNode = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["TransformNode"](nodeName, this._babylonScene);
+            this._babylonScene._blockEntityCollection = false;
             loadNode(node._babylonTransformNode);
         }
         else {

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 3 - 3
dist/preview release/loaders/babylon.objFileLoader.js

@@ -572,8 +572,8 @@ var OBJFileLoader = /** @class */ (function () {
     OBJFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {
         var _this = this;
         this._forAssetContainer = true;
-        var container = new babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["AssetContainer"](scene);
         return this.importMeshAsync(null, scene, data, rootUrl).then(function (result) {
+            var container = new babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["AssetContainer"](scene);
             result.meshes.forEach(function (mesh) { return container.meshes.push(mesh); });
             result.meshes.forEach(function (mesh) {
                 var material = mesh.material;
@@ -593,9 +593,9 @@ var OBJFileLoader = /** @class */ (function () {
             });
             _this._forAssetContainer = false;
             return container;
-        }).catch(function () {
+        }).catch(function (ex) {
             _this._forAssetContainer = false;
-            return container;
+            throw ex;
         });
     };
     /**

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 5 - 3
dist/preview release/loaders/babylonjs.loaders.js

@@ -801,8 +801,8 @@ var OBJFileLoader = /** @class */ (function () {
     OBJFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {
         var _this = this;
         this._forAssetContainer = true;
-        var container = new babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["AssetContainer"](scene);
         return this.importMeshAsync(null, scene, data, rootUrl).then(function (result) {
+            var container = new babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["AssetContainer"](scene);
             result.meshes.forEach(function (mesh) { return container.meshes.push(mesh); });
             result.meshes.forEach(function (mesh) {
                 var material = mesh.material;
@@ -822,9 +822,9 @@ var OBJFileLoader = /** @class */ (function () {
             });
             _this._forAssetContainer = false;
             return container;
-        }).catch(function () {
+        }).catch(function (ex) {
             _this._forAssetContainer = false;
-            return container;
+            throw ex;
         });
     };
     /**
@@ -6317,7 +6317,9 @@ var GLTFLoader = /** @class */ (function () {
         };
         if (node.mesh == undefined) {
             var nodeName = node.name || "node" + node.index;
+            this._babylonScene._blockEntityCollection = this._forAssetContainer;
             node._babylonTransformNode = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["TransformNode"](nodeName, this._babylonScene);
+            this._babylonScene._blockEntityCollection = false;
             loadNode(node._babylonTransformNode);
         }
         else {

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.js.map


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylonjs.loaders.min.js


File diff suppressed because it is too large
+ 7 - 7
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 3 - 3
loaders/src/OBJ/objFileLoader.ts

@@ -274,7 +274,7 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
      */
     public loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer> {
         this._forAssetContainer = true;
-        
+
         return this.importMeshAsync(null, scene, data, rootUrl).then((result) => {
             var container = new AssetContainer(scene);
             result.meshes.forEach((mesh) => container.meshes.push(mesh));
@@ -297,9 +297,9 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
             });
             this._forAssetContainer = false;
             return container;
-        }).catch(ex => {
+        }).catch((ex) => {
             this._forAssetContainer = false;
-            throw ex
+            throw ex;
         });
     }
 

+ 2 - 0
loaders/src/glTF/2.0/glTFLoader.ts

@@ -664,7 +664,9 @@ export class GLTFLoader implements IGLTFLoader {
 
         if (node.mesh == undefined) {
             const nodeName = node.name || `node${node.index}`;
+            this._babylonScene._blockEntityCollection = this._forAssetContainer;
             node._babylonTransformNode = new TransformNode(nodeName, this._babylonScene);
+            this._babylonScene._blockEntityCollection = false;
             loadNode(node._babylonTransformNode);
         }
         else {

+ 17 - 2
src/scene.ts

@@ -2041,10 +2041,12 @@ export class Scene extends AbstractScene implements IAnimatable {
      * @param recursive if all child meshes should also be added to the scene
      */
     public addMesh(newMesh: AbstractMesh, recursive = false) {
-        if (!this._blockEntityCollection) {
-            this.meshes.push(newMesh);
+        if (this._blockEntityCollection) {
+            return;
         }
 
+        this.meshes.push(newMesh);
+
         newMesh._resyncLightSources();
 
         if (!newMesh.parent) {
@@ -2092,6 +2094,9 @@ export class Scene extends AbstractScene implements IAnimatable {
      * @param newTransformNode defines the transform node to add
      */
     public addTransformNode(newTransformNode: TransformNode) {
+        if (this._blockEntityCollection) {
+            return;
+        }
         newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;
         this.transformNodes.push(newTransformNode);
 
@@ -2334,6 +2339,9 @@ export class Scene extends AbstractScene implements IAnimatable {
      * @param newLight The light to add
      */
     public addLight(newLight: Light): void {
+        if (this._blockEntityCollection) {
+            return;
+        }
         this.lights.push(newLight);
         this.sortLightsByPriority();
 
@@ -2366,6 +2374,10 @@ export class Scene extends AbstractScene implements IAnimatable {
      * @param newCamera The camera to add
      */
     public addCamera(newCamera: Camera): void {
+        if (this._blockEntityCollection) {
+            return;
+        }
+
         this.cameras.push(newCamera);
         this.onNewCameraAddedObservable.notifyObservers(newCamera);
 
@@ -2484,6 +2496,9 @@ export class Scene extends AbstractScene implements IAnimatable {
      * @param newTexture The texture to add
      */
     public addTexture(newTexture: BaseTexture): void {
+        if (this._blockEntityCollection) {
+            return;
+        }
         this.textures.push(newTexture);
         this.onNewTextureAddedObservable.notifyObservers(newTexture);
     }