소스 검색

Merge pull request #1574 from Temechon/master

Fixed bug when the 'more tabs' icons were deleted from its parent but never attached
David Catuhe 8 년 전
부모
커밋
2c076d2a35

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


+ 12 - 1
dist/preview release/inspector/babylon.inspector.js

@@ -557,7 +557,14 @@ var INSPECTOR;
         /** Returns the list of properties to be displayed for this adapter */
         MaterialAdapter.prototype.getProperties = function () {
             var propertiesLines = [];
-            var propToDisplay = INSPECTOR.PROPERTIES[this.type()].properties;
+            var propToDisplay = [];
+            // The if is there to work with the min version of babylon
+            if (this._obj instanceof BABYLON.StandardMaterial) {
+                propToDisplay = INSPECTOR.PROPERTIES['StandardMaterial'].properties;
+            }
+            else if (this._obj instanceof BABYLON.PBRMaterial) {
+                propToDisplay = INSPECTOR.PROPERTIES['PBRMaterial'].properties;
+            }
             for (var _i = 0, propToDisplay_1 = propToDisplay; _i < propToDisplay_1.length; _i++) {
                 var dirty = propToDisplay_1[_i];
                 var infos = new INSPECTOR.Property(dirty, this._obj);
@@ -2793,6 +2800,10 @@ var INSPECTOR;
                     var lastTab = this._invisibleTabs.pop();
                     this._div.appendChild(lastTab.toHtml());
                     this._visibleTabs.push(lastTab);
+                    // Update more-tab icon in last position if needed
+                    if (this._div.contains(this._moreTabsIcon)) {
+                        this._div.removeChild(this._moreTabsIcon);
+                    }
                 }
             }
             if (this._invisibleTabs.length > 0 && !this._div.contains(this._moreTabsIcon)) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 2
dist/preview release/inspector/babylon.inspector.min.js


+ 7 - 1
inspector/src/adapters/MaterialAdapter.ts

@@ -24,7 +24,13 @@ module INSPECTOR {
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties() : Array<PropertyLine> {
             let propertiesLines : Array<PropertyLine> = [];
-            let propToDisplay =  PROPERTIES[this.type()].properties;
+            let propToDisplay = [];
+            // The if is there to work with the min version of babylon
+            if (this._obj instanceof BABYLON.StandardMaterial) {
+                propToDisplay =  PROPERTIES['StandardMaterial'].properties;
+            } else if (this._obj instanceof BABYLON.PBRMaterial) {
+                propToDisplay =  PROPERTIES['PBRMaterial'].properties;
+            }
 
             for (let dirty of propToDisplay) {
                 let infos = new Property(dirty, this._obj);

+ 3 - 1
inspector/src/tabs/TabBar.ts

@@ -180,7 +180,9 @@ module INSPECTOR {
                     this._div.appendChild(lastTab.toHtml());
                     this._visibleTabs.push(lastTab);
                     // Update more-tab icon in last position if needed
-                    // UGLY FIX:) this._div.removeChild(this._moreTabsIcon);
+                     if (this._div.contains(this._moreTabsIcon)) {
+                        this._div.removeChild(this._moreTabsIcon);
+                     }
                 }
             }
             if (this._invisibleTabs.length > 0 && !this._div.contains(this._moreTabsIcon)) {

+ 10 - 3
src/Debug/babylon.debugLayer.ts

@@ -5,7 +5,9 @@ module BABYLON {
 
     export class DebugLayer {
         private _scene: Scene;
-        public static InspectorURL = 'http://www.babylonjs.com/babylon.inspector.bundle.js'
+        public static InspectorURL = 'http://www.babylonjs.com/babylon.inspector.bundle.js';
+        // The inspector instance
+        private _inspector : any;
 
         constructor(scene: Scene) {
             this._scene = scene;
@@ -13,7 +15,9 @@ module BABYLON {
 
         /** Creates the inspector window. */
         private _createInspector() {
-            new INSPECTOR.Inspector(this._scene);
+            if (!this._inspector) {
+                this._inspector = new INSPECTOR.Inspector(this._scene);
+            } // else nothing to do,; instance is already existing
         }
         
         public isVisible(): boolean {
@@ -21,7 +25,10 @@ module BABYLON {
         }
 
         public hide() {
-            console.warn('')
+            if (this._inspector) {
+                this._inspector.dispose();
+                this._inspector = null;
+            }
         }
         
         public show() {