David Catuhe 7 years ago
parent
commit
6c6ba6800c
28 changed files with 22607 additions and 32297 deletions
  1. 6717 6655
      Playground/babylon.d.txt
  2. 15534 25522
      dist/preview release/babylon.d.ts
  3. 10 10
      dist/preview release/babylon.js
  4. 10 1
      dist/preview release/babylon.max.js
  5. 10 1
      dist/preview release/babylon.no-module.max.js
  6. 10 10
      dist/preview release/babylon.worker.js
  7. 10 1
      dist/preview release/es6.js
  8. 2 2
      dist/preview release/gui/babylon.gui.d.ts
  9. 13 11
      dist/preview release/gui/babylon.gui.js
  10. 1 1
      dist/preview release/gui/babylon.gui.min.js
  11. 2 2
      dist/preview release/gui/babylon.gui.module.d.ts
  12. 5 5
      dist/preview release/inspector/babylon.inspector.bundle.js
  13. 25 0
      dist/preview release/inspector/babylon.inspector.css
  14. 14 1
      dist/preview release/inspector/babylon.inspector.d.ts
  15. 132 8
      dist/preview release/inspector/babylon.inspector.js
  16. 4 4
      dist/preview release/inspector/babylon.inspector.min.js
  17. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.d.ts
  18. 17 8
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  19. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  20. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.d.ts
  21. 17 8
      dist/preview release/loaders/babylon.glTFFileLoader.js
  22. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  23. 1 1
      dist/preview release/loaders/babylonjs.loaders.d.ts
  24. 17 8
      dist/preview release/loaders/babylonjs.loaders.js
  25. 4 4
      dist/preview release/loaders/babylonjs.loaders.min.js
  26. 1 1
      dist/preview release/loaders/babylonjs.loaders.module.d.ts
  27. 18 18
      dist/preview release/viewer/babylon.viewer.js
  28. 27 9
      dist/preview release/viewer/babylon.viewer.max.js

File diff suppressed because it is too large
+ 6717 - 6655
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 15534 - 25522
dist/preview release/babylon.d.ts


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


+ 10 - 1
dist/preview release/babylon.max.js

@@ -69060,13 +69060,15 @@ var BABYLON;
                         BABYLON.Tools.ClearLogCache();
                     }
                     this._engine.stopRenderLoop();
-                    this._currentScene.dispose();
                 }
                 BABYLON.SceneLoader.LoadAsync("file:", this._sceneFileToLoad, this._engine, function (progress) {
                     if (_this._progressCallback) {
                         _this._progressCallback(progress);
                     }
                 }).then(function (scene) {
+                    if (_this._currentScene) {
+                        _this._currentScene.dispose();
+                    }
                     _this._currentScene = scene;
                     if (_this._sceneLoadedCallback) {
                         _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);
@@ -86389,6 +86391,13 @@ var BABYLON;
                 this._createInspector(config);
             }
         };
+        /**
+         * Gets the active tab
+         * @return the index of the active tab or -1 if the inspector is hidden
+         */
+        DebugLayer.prototype.getActiveTab = function () {
+            return this._inspector ? this._inspector.getActiveTabIndex() : -1;
+        };
         DebugLayer.InspectorURL = 'https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js';
         return DebugLayer;
     }());

+ 10 - 1
dist/preview release/babylon.no-module.max.js

@@ -69027,13 +69027,15 @@ var BABYLON;
                         BABYLON.Tools.ClearLogCache();
                     }
                     this._engine.stopRenderLoop();
-                    this._currentScene.dispose();
                 }
                 BABYLON.SceneLoader.LoadAsync("file:", this._sceneFileToLoad, this._engine, function (progress) {
                     if (_this._progressCallback) {
                         _this._progressCallback(progress);
                     }
                 }).then(function (scene) {
+                    if (_this._currentScene) {
+                        _this._currentScene.dispose();
+                    }
                     _this._currentScene = scene;
                     if (_this._sceneLoadedCallback) {
                         _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);
@@ -86356,6 +86358,13 @@ var BABYLON;
                 this._createInspector(config);
             }
         };
+        /**
+         * Gets the active tab
+         * @return the index of the active tab or -1 if the inspector is hidden
+         */
+        DebugLayer.prototype.getActiveTab = function () {
+            return this._inspector ? this._inspector.getActiveTabIndex() : -1;
+        };
         DebugLayer.InspectorURL = 'https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js';
         return DebugLayer;
     }());

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


+ 10 - 1
dist/preview release/es6.js

@@ -69027,13 +69027,15 @@ var BABYLON;
                         BABYLON.Tools.ClearLogCache();
                     }
                     this._engine.stopRenderLoop();
-                    this._currentScene.dispose();
                 }
                 BABYLON.SceneLoader.LoadAsync("file:", this._sceneFileToLoad, this._engine, function (progress) {
                     if (_this._progressCallback) {
                         _this._progressCallback(progress);
                     }
                 }).then(function (scene) {
+                    if (_this._currentScene) {
+                        _this._currentScene.dispose();
+                    }
                     _this._currentScene = scene;
                     if (_this._sceneLoadedCallback) {
                         _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);
@@ -86356,6 +86358,13 @@ var BABYLON;
                 this._createInspector(config);
             }
         };
+        /**
+         * Gets the active tab
+         * @return the index of the active tab or -1 if the inspector is hidden
+         */
+        DebugLayer.prototype.getActiveTab = function () {
+            return this._inspector ? this._inspector.getActiveTabIndex() : -1;
+        };
         DebugLayer.InspectorURL = 'https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js';
         return DebugLayer;
     }());

+ 2 - 2
dist/preview release/gui/babylon.gui.d.ts

@@ -973,7 +973,7 @@ declare module BABYLON.GUI {
         private _sceneDisposeObserver;
         private _utilityLayer;
         private _rootContainer;
-        private _pointerMoveObserver;
+        private _pointerObserver;
         _lastPickedControl: Control3D;
         /** @hidden */
         _lastControlOver: {
@@ -1023,7 +1023,7 @@ declare module BABYLON.GUI {
 
 
 declare module BABYLON.GUI {
-    class Vector3WithInfo extends Vector2 {
+    class Vector3WithInfo extends Vector3 {
         buttonIndex: number;
         constructor(source: Vector3, buttonIndex?: number);
     }

+ 13 - 11
dist/preview release/gui/babylon.gui.js

@@ -5620,7 +5620,7 @@ var BABYLON;
                 this._utilityLayer = new BABYLON.UtilityLayerRenderer(this._scene);
                 this._rootContainer = new GUI.Container3D("RootContainer");
                 this._rootContainer._host = this;
-                this._pointerMoveObserver = this._scene.onPrePointerObservable.add(function (pi, state) {
+                this._pointerObserver = this._scene.onPrePointerObservable.add(function (pi, state) {
                     var pointerEvent = (pi.event);
                     if (_this._scene.isPointerCaptured(pointerEvent.pointerId)) {
                         return;
@@ -5653,17 +5653,19 @@ var BABYLON;
                 configurable: true
             });
             GUI3DManager.prototype._doPicking = function (type, pointerEvent) {
-                if (!this._utilityLayer) {
+                if (!this._utilityLayer || this._utilityLayer.utilityLayerScene.activeCamera === null) {
                     return false;
                 }
                 var pointerId = pointerEvent.pointerId || 0;
                 var buttonIndex = pointerEvent.button;
                 var utilityScene = this._utilityLayer.utilityLayerScene;
                 var pickingInfo = utilityScene.pick(this._scene.pointerX, this._scene.pointerY);
-                if (!pickingInfo) {
-                    return false;
-                }
-                if (!pickingInfo.hit) {
+                if (!pickingInfo || !pickingInfo.hit) {
+                    var previousControlOver = this._lastControlOver[pointerId];
+                    if (previousControlOver) {
+                        previousControlOver._onPointerOut(previousControlOver);
+                        delete this._lastControlOver[pointerId];
+                    }
                     return false;
                 }
                 var control = (pickingInfo.pickedMesh.metadata);
@@ -5719,9 +5721,9 @@ var BABYLON;
             GUI3DManager.prototype.dispose = function () {
                 this._rootContainer.dispose();
                 if (this._scene) {
-                    if (this._pointerMoveObserver) {
-                        this._scene.onPrePointerObservable.remove(this._pointerMoveObserver);
-                        this._pointerMoveObserver = null;
+                    if (this._pointerObserver) {
+                        this._scene.onPrePointerObservable.remove(this._pointerObserver);
+                        this._pointerObserver = null;
                     }
                     if (this._sceneDisposeObserver) {
                         this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);
@@ -5748,12 +5750,12 @@ var BABYLON;
             __extends(Vector3WithInfo, _super);
             function Vector3WithInfo(source, buttonIndex) {
                 if (buttonIndex === void 0) { buttonIndex = 0; }
-                var _this = _super.call(this, source.x, source.y) || this;
+                var _this = _super.call(this, source.x, source.y, source.z) || this;
                 _this.buttonIndex = buttonIndex;
                 return _this;
             }
             return Vector3WithInfo;
-        }(BABYLON.Vector2));
+        }(BABYLON.Vector3));
         GUI.Vector3WithInfo = Vector3WithInfo;
     })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
 })(BABYLON || (BABYLON = {}));

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


+ 2 - 2
dist/preview release/gui/babylon.gui.module.d.ts

@@ -978,7 +978,7 @@ declare module BABYLON.GUI {
         private _sceneDisposeObserver;
         private _utilityLayer;
         private _rootContainer;
-        private _pointerMoveObserver;
+        private _pointerObserver;
         _lastPickedControl: Control3D;
         /** @hidden */
         _lastControlOver: {
@@ -1028,7 +1028,7 @@ declare module BABYLON.GUI {
 
 
 declare module BABYLON.GUI {
-    class Vector3WithInfo extends Vector2 {
+    class Vector3WithInfo extends Vector3 {
         buttonIndex: number;
         constructor(source: Vector3, buttonIndex?: number);
     }

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


+ 25 - 0
dist/preview release/inspector/babylon.inspector.css

@@ -250,6 +250,31 @@
       padding-bottom: 10px;
       border-bottom: 1px solid #5db0d7;
       margin: 10px 0 10px 0; }
+    .insp-wrapper .tab-panel .gltf-actions .gltf-action, .insp-wrapper .tab-panel .gltf-actions .gltf-checkbox {
+      height: 20px;
+      line-height: 20px;
+      width: 100%;
+      cursor: pointer;
+      white-space: nowrap; }
+      .insp-wrapper .tab-panel .gltf-actions .gltf-action:hover, .insp-wrapper .tab-panel .gltf-actions .gltf-checkbox:hover {
+        background-color: #2c2c2c; }
+    .insp-wrapper .tab-panel .gltf-actions .gltf-checkbox:before {
+      width: 1em;
+      height: 1em;
+      line-height: 1em;
+      display: inline-block;
+      font-family: 'FontAwesome', sans-serif;
+      content: "\f096";
+      margin-right: 10px; }
+    .insp-wrapper .tab-panel .gltf-actions .gltf-checkbox.active:before {
+      width: 1em;
+      height: 1em;
+      line-height: 1em;
+      display: inline-block;
+      font-family: 'FontAwesome', sans-serif;
+      content: "\f14a";
+      color: #5db0d7;
+      margin-right: 10px; }
     .insp-wrapper .tab-panel .gltf-actions .gltf-input {
       background-color: #2c2c2c;
       border: none;

+ 14 - 1
dist/preview release/inspector/babylon.inspector.d.ts

@@ -1028,11 +1028,24 @@ declare module INSPECTOR {
 
 
 
+
+declare function Split(elements: HTMLElement[], options: any): any;
 declare module INSPECTOR {
     class GLTFTab extends Tab {
+        private static _LoaderExtensionSettings;
+        private _inspector;
+        private _actions;
+        private _detailsPanel;
+        private _split;
+        /** @hidden */
+        static _Initialize(): void;
         constructor(tabbar: TabBar, inspector: Inspector);
         dispose(): void;
-        private _addExport(inspector, actions);
+        private _addImport();
+        private _getLoaderExtensionOverridesAsync();
+        private _updateLoaderExtensionDetails(settings);
+        private _closeDetailsPanel();
+        private _addExport();
         private static _IsSkyBox(transformNode);
     }
 }

+ 132 - 8
dist/preview release/inspector/babylon.inspector.js

@@ -4049,6 +4049,7 @@ var INSPECTOR;
 })(INSPECTOR || (INSPECTOR = {}));
 
 /// <reference path="../../../dist/preview release/gltf2Interface/babylon.glTF2Interface.d.ts"/>
+/// <reference path="../../../dist/preview release/loaders/babylon.glTF2FileLoader.d.ts"/>
 /// <reference path="../../../dist/preview release/serializers/babylon.glTF2Serializer.d.ts"/>
 var __extends = (this && this.__extends) || (function () {
     var extendStatics = Object.setPrototypeOf ||
@@ -4062,27 +4063,148 @@ var __extends = (this && this.__extends) || (function () {
 })();
 var INSPECTOR;
 (function (INSPECTOR) {
+    ;
     var GLTFTab = /** @class */ (function (_super) {
         __extends(GLTFTab, _super);
         function GLTFTab(tabbar, inspector) {
             var _this = _super.call(this, tabbar, 'GLTF') || this;
+            _this._detailsPanel = null;
+            _this._inspector = inspector;
             _this._panel = INSPECTOR.Helpers.CreateDiv('tab-panel');
-            var actions = INSPECTOR.Helpers.CreateDiv('gltf-actions', _this._panel);
-            _this._addExport(inspector, actions);
+            _this._actions = INSPECTOR.Helpers.CreateDiv('gltf-actions', _this._panel);
+            _this._actions.addEventListener('click', function (event) {
+                _this._closeDetailsPanel();
+            });
+            _this._addImport();
+            _this._addExport();
             return _this;
         }
+        /** @hidden */
+        GLTFTab._Initialize = function () {
+            // Must register with OnPluginActivatedObservable as early as possible to
+            // override the default settings for each extension.
+            BABYLON.SceneLoader.OnPluginActivatedObservable.add(function (loader) {
+                if (loader.name === "gltf" && GLTFTab._LoaderExtensionSettings) {
+                    loader.onExtensionLoadedObservable.add(function (extension) {
+                        var settings = GLTFTab._LoaderExtensionSettings[extension.name];
+                        for (var settingName in settings) {
+                            extension[settingName] = settings[settingName];
+                        }
+                    });
+                }
+            });
+        };
         GLTFTab.prototype.dispose = function () {
-            // Nothing to dispose
+            if (this._detailsPanel) {
+                this._detailsPanel.dispose();
+            }
+        };
+        GLTFTab.prototype._addImport = function () {
+            var _this = this;
+            var importActions = INSPECTOR.Helpers.CreateDiv(null, this._actions);
+            this._getLoaderExtensionOverridesAsync().then(function (loaderExtensionSettings) {
+                var title = INSPECTOR.Helpers.CreateDiv('gltf-title', importActions);
+                title.textContent = 'Import';
+                var extensionActions = INSPECTOR.Helpers.CreateDiv('gltf-actions', importActions);
+                var extensionsTitle = INSPECTOR.Helpers.CreateDiv('gltf-title', extensionActions);
+                extensionsTitle.textContent = "Extensions";
+                var _loop_1 = function (extensionName) {
+                    var settings = loaderExtensionSettings[extensionName];
+                    var extensionAction = INSPECTOR.Helpers.CreateDiv('gltf-action', extensionActions);
+                    extensionAction.addEventListener('click', function (event) {
+                        if (_this._updateLoaderExtensionDetails(settings)) {
+                            event.stopPropagation();
+                        }
+                    });
+                    var checkbox = INSPECTOR.Helpers.CreateElement('span', 'gltf-checkbox', extensionAction);
+                    if (settings.enabled) {
+                        checkbox.classList.add('action', 'active');
+                    }
+                    checkbox.addEventListener('click', function () {
+                        checkbox.classList.toggle('active');
+                        settings.enabled = checkbox.classList.contains('active');
+                    });
+                    var label = INSPECTOR.Helpers.CreateElement('span', null, extensionAction);
+                    label.textContent = extensionName;
+                };
+                for (var extensionName in loaderExtensionSettings) {
+                    _loop_1(extensionName);
+                }
+            });
         };
-        GLTFTab.prototype._addExport = function (inspector, actions) {
-            var title = INSPECTOR.Helpers.CreateDiv('gltf-title', actions);
+        GLTFTab.prototype._getLoaderExtensionOverridesAsync = function () {
+            if (GLTFTab._LoaderExtensionSettings) {
+                return Promise.resolve(GLTFTab._LoaderExtensionSettings);
+            }
+            var loaderExtensionSettings = {};
+            var engine = new BABYLON.NullEngine();
+            var scene = new BABYLON.Scene(engine);
+            var loader = new BABYLON.GLTF2.GLTFLoader();
+            loader.onExtensionLoadedObservable.add(function (extension) {
+                loaderExtensionSettings[extension.name] = {};
+                var settings = loaderExtensionSettings[extension.name];
+                for (var _i = 0, _a = Object.keys(extension); _i < _a.length; _i++) {
+                    var key = _a[_i];
+                    if (key !== "name" && key[0] !== '_') {
+                        var value = extension[key];
+                        if (typeof value !== "object") {
+                            settings[key] = value;
+                        }
+                    }
+                }
+            });
+            var data = { json: {}, bin: null };
+            return loader.importMeshAsync([], scene, data, "").then(function () {
+                scene.dispose();
+                engine.dispose();
+                return (GLTFTab._LoaderExtensionSettings = loaderExtensionSettings);
+            });
+        };
+        GLTFTab.prototype._updateLoaderExtensionDetails = function (settings) {
+            if (Object.keys(settings).length === 1) {
+                return false;
+            }
+            if (!this._detailsPanel) {
+                this._detailsPanel = new INSPECTOR.DetailPanel();
+                this._panel.appendChild(this._detailsPanel.toHtml());
+                this._split = Split([this._actions, this._detailsPanel.toHtml()], {
+                    blockDrag: this._inspector.popupMode,
+                    sizes: [50, 50],
+                    direction: 'vertical'
+                });
+            }
+            this._detailsPanel.clean();
+            var details = new Array();
+            for (var key in settings) {
+                if (key !== "enabled") {
+                    details.push(new INSPECTOR.PropertyLine(new INSPECTOR.Property(key, settings)));
+                }
+            }
+            this._detailsPanel.details = details;
+            return true;
+        };
+        GLTFTab.prototype._closeDetailsPanel = function () {
+            if (this._detailsPanel) {
+                this._detailsPanel.toHtml().remove();
+                this._detailsPanel.dispose();
+                this._detailsPanel = null;
+            }
+            if (this._split) {
+                this._split.destroy();
+                delete this._split;
+            }
+        };
+        GLTFTab.prototype._addExport = function () {
+            var _this = this;
+            var exportActions = INSPECTOR.Helpers.CreateDiv(null, this._actions);
+            var title = INSPECTOR.Helpers.CreateDiv('gltf-title', exportActions);
             title.textContent = 'Export';
-            var name = INSPECTOR.Helpers.CreateInput('gltf-input', actions);
+            var name = INSPECTOR.Helpers.CreateInput('gltf-input', exportActions);
             name.placeholder = "File name...";
-            var button = INSPECTOR.Helpers.CreateElement('button', 'gltf-button', actions);
+            var button = INSPECTOR.Helpers.CreateElement('button', 'gltf-button', exportActions);
             button.innerText = 'Export GLB';
             button.addEventListener('click', function () {
-                BABYLON.GLTF2Export.GLBAsync(inspector.scene, name.value || "scene", {
+                BABYLON.GLTF2Export.GLBAsync(_this._inspector.scene, name.value || "scene", {
                     shouldExportTransformNode: function (transformNode) { return !GLTFTab._IsSkyBox(transformNode); }
                 }).then(function (glb) {
                     glb.downloadFiles();
@@ -4101,9 +4223,11 @@ var INSPECTOR;
             }
             return false;
         };
+        GLTFTab._LoaderExtensionSettings = null;
         return GLTFTab;
     }(INSPECTOR.Tab));
     INSPECTOR.GLTFTab = GLTFTab;
+    GLTFTab._Initialize();
 })(INSPECTOR || (INSPECTOR = {}));
 
 var __extends = (this && this.__extends) || (function () {

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


+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -615,7 +615,7 @@ declare module BABYLON.GLTF2 {
          * @returns a promise which completes when objects have been loaded to the scene
          */
         loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
-        private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
+        private _loadAsync(nodes);
         private _loadData(data);
         private _setupData();
         private _loadExtensions();

+ 17 - 8
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -751,6 +751,10 @@ var BABYLON;
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
+                    _this._babylonScene = scene;
+                    _this._rootUrl = rootUrl;
+                    _this._progressCallback = onProgress;
+                    _this._loadData(data);
                     var nodes = null;
                     if (meshesNames) {
                         var nodeMap_1 = {};
@@ -771,7 +775,7 @@ var BABYLON;
                             return node;
                         });
                     }
-                    return _this._loadAsync(nodes, scene, data, rootUrl, onProgress).then(function () {
+                    return _this._loadAsync(nodes).then(function () {
                         return {
                             meshes: _this._getMeshes(),
                             particleSystems: [],
@@ -790,16 +794,19 @@ var BABYLON;
              * @returns a promise which completes when objects have been loaded to the scene
              */
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
-                return this._loadAsync(null, scene, data, rootUrl, onProgress);
-            };
-            GLTFLoader.prototype._loadAsync = function (nodes, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
                     _this._babylonScene = scene;
                     _this._rootUrl = rootUrl;
                     _this._progressCallback = onProgress;
-                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadData(data);
+                    return _this._loadAsync(null);
+                });
+            };
+            GLTFLoader.prototype._loadAsync = function (nodes) {
+                var _this = this;
+                return Promise.resolve().then(function () {
+                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadExtensions();
                     _this._checkExtensions();
                     var promises = new Array();
@@ -807,8 +814,8 @@ var BABYLON;
                         promises.push(_this._loadNodesAsync(nodes));
                     }
                     else {
-                        var scene_1 = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
-                        promises.push(_this._loadSceneAsync("#/scenes/" + scene_1._index, scene_1));
+                        var scene = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
+                        promises.push(_this._loadSceneAsync("#/scenes/" + scene._index, scene));
                     }
                     if (_this.compileMaterials) {
                         promises.push(_this._compileMaterialsAsync());
@@ -822,7 +829,9 @@ var BABYLON;
                         _this._startAnimations();
                     });
                     resultPromise.then(function () {
-                        _this._rootBabylonMesh.setEnabled(true);
+                        if (_this._rootBabylonMesh) {
+                            _this._rootBabylonMesh.setEnabled(true);
+                        }
                         BABYLON.Tools.SetImmediate(function () {
                             if (!_this._disposed) {
                                 Promise.all(_this._completePromises).then(function () {

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


+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -1192,7 +1192,7 @@ declare module BABYLON.GLTF2 {
          * @returns a promise which completes when objects have been loaded to the scene
          */
         loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
-        private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
+        private _loadAsync(nodes);
         private _loadData(data);
         private _setupData();
         private _loadExtensions();

+ 17 - 8
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -2967,6 +2967,10 @@ var BABYLON;
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
+                    _this._babylonScene = scene;
+                    _this._rootUrl = rootUrl;
+                    _this._progressCallback = onProgress;
+                    _this._loadData(data);
                     var nodes = null;
                     if (meshesNames) {
                         var nodeMap_1 = {};
@@ -2987,7 +2991,7 @@ var BABYLON;
                             return node;
                         });
                     }
-                    return _this._loadAsync(nodes, scene, data, rootUrl, onProgress).then(function () {
+                    return _this._loadAsync(nodes).then(function () {
                         return {
                             meshes: _this._getMeshes(),
                             particleSystems: [],
@@ -3006,16 +3010,19 @@ var BABYLON;
              * @returns a promise which completes when objects have been loaded to the scene
              */
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
-                return this._loadAsync(null, scene, data, rootUrl, onProgress);
-            };
-            GLTFLoader.prototype._loadAsync = function (nodes, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
                     _this._babylonScene = scene;
                     _this._rootUrl = rootUrl;
                     _this._progressCallback = onProgress;
-                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadData(data);
+                    return _this._loadAsync(null);
+                });
+            };
+            GLTFLoader.prototype._loadAsync = function (nodes) {
+                var _this = this;
+                return Promise.resolve().then(function () {
+                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadExtensions();
                     _this._checkExtensions();
                     var promises = new Array();
@@ -3023,8 +3030,8 @@ var BABYLON;
                         promises.push(_this._loadNodesAsync(nodes));
                     }
                     else {
-                        var scene_1 = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
-                        promises.push(_this._loadSceneAsync("#/scenes/" + scene_1._index, scene_1));
+                        var scene = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
+                        promises.push(_this._loadSceneAsync("#/scenes/" + scene._index, scene));
                     }
                     if (_this.compileMaterials) {
                         promises.push(_this._compileMaterialsAsync());
@@ -3038,7 +3045,9 @@ var BABYLON;
                         _this._startAnimations();
                     });
                     resultPromise.then(function () {
-                        _this._rootBabylonMesh.setEnabled(true);
+                        if (_this._rootBabylonMesh) {
+                            _this._rootBabylonMesh.setEnabled(true);
+                        }
                         BABYLON.Tools.SetImmediate(function () {
                             if (!_this._disposed) {
                                 Promise.all(_this._completePromises).then(function () {

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


+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.d.ts

@@ -1288,7 +1288,7 @@ declare module BABYLON.GLTF2 {
          * @returns a promise which completes when objects have been loaded to the scene
          */
         loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
-        private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
+        private _loadAsync(nodes);
         private _loadData(data);
         private _setupData();
         private _loadExtensions();

+ 17 - 8
dist/preview release/loaders/babylonjs.loaders.js

@@ -3949,6 +3949,10 @@ var BABYLON;
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
+                    _this._babylonScene = scene;
+                    _this._rootUrl = rootUrl;
+                    _this._progressCallback = onProgress;
+                    _this._loadData(data);
                     var nodes = null;
                     if (meshesNames) {
                         var nodeMap_1 = {};
@@ -3969,7 +3973,7 @@ var BABYLON;
                             return node;
                         });
                     }
-                    return _this._loadAsync(nodes, scene, data, rootUrl, onProgress).then(function () {
+                    return _this._loadAsync(nodes).then(function () {
                         return {
                             meshes: _this._getMeshes(),
                             particleSystems: [],
@@ -3988,16 +3992,19 @@ var BABYLON;
              * @returns a promise which completes when objects have been loaded to the scene
              */
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
-                return this._loadAsync(null, scene, data, rootUrl, onProgress);
-            };
-            GLTFLoader.prototype._loadAsync = function (nodes, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
                     _this._babylonScene = scene;
                     _this._rootUrl = rootUrl;
                     _this._progressCallback = onProgress;
-                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadData(data);
+                    return _this._loadAsync(null);
+                });
+            };
+            GLTFLoader.prototype._loadAsync = function (nodes) {
+                var _this = this;
+                return Promise.resolve().then(function () {
+                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadExtensions();
                     _this._checkExtensions();
                     var promises = new Array();
@@ -4005,8 +4012,8 @@ var BABYLON;
                         promises.push(_this._loadNodesAsync(nodes));
                     }
                     else {
-                        var scene_1 = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
-                        promises.push(_this._loadSceneAsync("#/scenes/" + scene_1._index, scene_1));
+                        var scene = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
+                        promises.push(_this._loadSceneAsync("#/scenes/" + scene._index, scene));
                     }
                     if (_this.compileMaterials) {
                         promises.push(_this._compileMaterialsAsync());
@@ -4020,7 +4027,9 @@ var BABYLON;
                         _this._startAnimations();
                     });
                     resultPromise.then(function () {
-                        _this._rootBabylonMesh.setEnabled(true);
+                        if (_this._rootBabylonMesh) {
+                            _this._rootBabylonMesh.setEnabled(true);
+                        }
                         BABYLON.Tools.SetImmediate(function () {
                             if (!_this._disposed) {
                                 Promise.all(_this._completePromises).then(function () {

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


+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -1295,7 +1295,7 @@ declare module BABYLON.GLTF2 {
          * @returns a promise which completes when objects have been loaded to the scene
          */
         loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
-        private _loadAsync(nodes, scene, data, rootUrl, onProgress?);
+        private _loadAsync(nodes);
         private _loadData(data);
         private _setupData();
         private _loadExtensions();

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


+ 27 - 9
dist/preview release/viewer/babylon.viewer.max.js

@@ -69148,13 +69148,15 @@ var BABYLON;
                         BABYLON.Tools.ClearLogCache();
                     }
                     this._engine.stopRenderLoop();
-                    this._currentScene.dispose();
                 }
                 BABYLON.SceneLoader.LoadAsync("file:", this._sceneFileToLoad, this._engine, function (progress) {
                     if (_this._progressCallback) {
                         _this._progressCallback(progress);
                     }
                 }).then(function (scene) {
+                    if (_this._currentScene) {
+                        _this._currentScene.dispose();
+                    }
                     _this._currentScene = scene;
                     if (_this._sceneLoadedCallback) {
                         _this._sceneLoadedCallback(_this._sceneFileToLoad, _this._currentScene);
@@ -86477,6 +86479,13 @@ var BABYLON;
                 this._createInspector(config);
             }
         };
+        /**
+         * Gets the active tab
+         * @return the index of the active tab or -1 if the inspector is hidden
+         */
+        DebugLayer.prototype.getActiveTab = function () {
+            return this._inspector ? this._inspector.getActiveTabIndex() : -1;
+        };
         DebugLayer.InspectorURL = 'https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js';
         return DebugLayer;
     }());
@@ -106054,6 +106063,10 @@ var BABYLON;
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
+                    _this._babylonScene = scene;
+                    _this._rootUrl = rootUrl;
+                    _this._progressCallback = onProgress;
+                    _this._loadData(data);
                     var nodes = null;
                     if (meshesNames) {
                         var nodeMap_1 = {};
@@ -106074,7 +106087,7 @@ var BABYLON;
                             return node;
                         });
                     }
-                    return _this._loadAsync(nodes, scene, data, rootUrl, onProgress).then(function () {
+                    return _this._loadAsync(nodes).then(function () {
                         return {
                             meshes: _this._getMeshes(),
                             particleSystems: [],
@@ -106093,16 +106106,19 @@ var BABYLON;
              * @returns a promise which completes when objects have been loaded to the scene
              */
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
-                return this._loadAsync(null, scene, data, rootUrl, onProgress);
-            };
-            GLTFLoader.prototype._loadAsync = function (nodes, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 return Promise.resolve().then(function () {
                     _this._babylonScene = scene;
                     _this._rootUrl = rootUrl;
                     _this._progressCallback = onProgress;
-                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadData(data);
+                    return _this._loadAsync(null);
+                });
+            };
+            GLTFLoader.prototype._loadAsync = function (nodes) {
+                var _this = this;
+                return Promise.resolve().then(function () {
+                    _this._state = BABYLON.GLTFLoaderState.LOADING;
                     _this._loadExtensions();
                     _this._checkExtensions();
                     var promises = new Array();
@@ -106110,8 +106126,8 @@ var BABYLON;
                         promises.push(_this._loadNodesAsync(nodes));
                     }
                     else {
-                        var scene_1 = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
-                        promises.push(_this._loadSceneAsync("#/scenes/" + scene_1._index, scene_1));
+                        var scene = GLTFLoader._GetProperty("#/scene", _this._gltf.scenes, _this._gltf.scene || 0);
+                        promises.push(_this._loadSceneAsync("#/scenes/" + scene._index, scene));
                     }
                     if (_this.compileMaterials) {
                         promises.push(_this._compileMaterialsAsync());
@@ -106125,7 +106141,9 @@ var BABYLON;
                         _this._startAnimations();
                     });
                     resultPromise.then(function () {
-                        _this._rootBabylonMesh.setEnabled(true);
+                        if (_this._rootBabylonMesh) {
+                            _this._rootBabylonMesh.setEnabled(true);
+                        }
                         BABYLON.Tools.SetImmediate(function () {
                             if (!_this._disposed) {
                                 Promise.all(_this._completePromises).then(function () {