Browse Source

Fix inspector problems

ameuleman 8 năm trước cách đây
mục cha
commit
b146021abb
3 tập tin đã thay đổi với 17 bổ sung3 xóa
  1. 1 0
      Tools/Gulp/config.json
  2. 13 2
      inspector/src/Inspector.ts
  3. 3 1
      inspector/src/tabs/TabBar.ts

+ 1 - 0
Tools/Gulp/config.json

@@ -1438,6 +1438,7 @@
                     "../../inspector/src/tabs/PropertyTab.ts",
                     "../../inspector/src/tabs/CameraTab.ts",
                     "../../inspector/src/tabs/GUITab.ts",
+                    "../../inspector/src/tabs/PhysicsTab.ts",
                     "../../inspector/src/tabs/SoundTab.ts",
                     "../../inspector/src/tabs/TextureTab.ts",
                     "../../inspector/src/tabs/LightTab.ts",

+ 13 - 2
inspector/src/Inspector.ts

@@ -40,8 +40,19 @@ module INSPECTOR {
             colorBot?: string
         }) {
 
-            //Load properties of GUI objects now as BABYLON.GUI has to be declared before 
-            loadGUIProperties();
+            // Load GUI library if not already done
+            if(!BABYLON.GUI){
+            	BABYLON.Tools.LoadScript("https://preview.babylonjs.com/gui/babylon.gui.js", () => { 
+                    //Load properties of GUI objects now as BABYLON.GUI has to be declared before 
+                    loadGUIProperties();
+                }, () => {
+                    console.warn("Please add script https://preview.babylonjs.com/gui/babylon.gui.js to the HTML file")
+                });
+            }
+            else{
+                //Load properties of GUI objects now as BABYLON.GUI has to be declared before 
+                loadGUIProperties();
+            }
 
             //get Tabbar initialTab
             this._initialTab = initialTab;

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

@@ -33,7 +33,9 @@ module INSPECTOR {
             this._tabs.push(new ShaderTab(this, this._inspector));
             this._tabs.push(new LightTab(this, this._inspector));
             this._tabs.push(new MaterialTab(this, this._inspector));
-            this._tabs.push(new GUITab(this, this._inspector));
+            if(BABYLON.GUI){
+                this._tabs.push(new GUITab(this, this._inspector));
+            }
             this._tabs.push(new PhysicsTab(this, this._inspector));
             this._tabs.push(new CameraTab(this, this._inspector));
             this._tabs.push(new SoundTab(this, this._inspector));