Browse Source

Add Inspector Shortcut

sevan 8 năm trước cách đây
mục cha
commit
1b48f67f75

+ 26 - 0
Tools/DevLoader/BabylonLoader.js

@@ -43,6 +43,32 @@ var BABYLONDEVTOOLS;
             babylonJSPath = '';
         }
 
+        Loader.prototype.debugShortcut = function(engine) {
+            // Add inspector shortcut
+            var map = {};
+            var onkey = function(e){
+                e = e || event; // to deal with IE
+                map[e.keyCode] = e.type == 'keydown';
+                if(map[17] && map[16] && map[18] && map[73]) {
+                    if (engine.scenes && engine.scenes.length > 0) {
+                        for (var i = 0; i < engine.scenes.length; i ++) {
+                            if (engine.scenes[0].debugLayer.isVisible()) {
+                                engine.scenes[0].debugLayer.hide();
+                            }
+                            else {
+                                engine.scenes[0].debugLayer.show();
+                            }
+                        }
+                    }
+                    map = {};
+                    return false;
+                }
+            };
+
+            document.addEventListener("keydown", onkey);
+            document.addEventListener("keyup", onkey);
+        }
+
         Loader.prototype.root = function (newBabylonJSPath) {
             babylonJSPath = newBabylonJSPath;
             return this;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5136 - 5136
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.js


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

@@ -54736,7 +54736,7 @@ var BABYLON;
             new INSPECTOR.Inspector(this._scene);
         };
         DebugLayer.prototype.isVisible = function () {
-            return true;
+            return false;
         };
         DebugLayer.prototype.hide = function () {
             console.warn('');

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.noworker.js


+ 2 - 1
inspector/test/index.js

@@ -5,7 +5,8 @@ var Test = (function () {
     function Test(canvasId) {
         var _this = this;
         var canvas = document.getElementById(canvasId);
-        this.engine = new BABYLON.Engine(canvas, true);
+        this.engine = new BABYLON.Engine(canvas, true);					
+		BABYLONDEVTOOLS.Loader.debugShortcut(engine);
         this.scene = null;
         window.addEventListener("resize", function () {
             _this.engine.resize();

+ 2 - 1
localDev/index.html

@@ -59,7 +59,8 @@
 			.require(indexjs)
 			.load(function() {
 				if (BABYLON.Engine.isSupported()) {
-					engine = new BABYLON.Engine(canvas, true, { stencil: true });				
+					engine = new BABYLON.Engine(canvas, true, { stencil: true });					
+					BABYLONDEVTOOLS.Loader.debugShortcut(engine);			
 
 					// call the scene creation from the js.
 					var scene = createScene();

+ 2 - 0
materialsLibrary/index.html

@@ -55,6 +55,8 @@
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
 			var engine = new BABYLON.Engine(canvas, true);
+			BABYLONDEVTOOLS.Loader.debugShortcut(engine);
+
 			var divFps = document.getElementById("fps");
 
 			scene = new BABYLON.Scene(engine);

+ 2 - 1
postProcessLibrary/index.html

@@ -44,7 +44,8 @@
 	BABYLONDEVTOOLS.Loader.load(function() {
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
-			var engine = new BABYLON.Engine(canvas, true);
+			var engine = new BABYLON.Engine(canvas, true);					
+			BABYLONDEVTOOLS.Loader.debugShortcut(engine);	
 			var divFps = document.getElementById("fps");
 
 			var scene = new BABYLON.Scene(engine);

+ 2 - 1
proceduralTexturesLibrary/index.html

@@ -53,7 +53,8 @@
 		BABYLONDEVTOOLS.Loader.load(function() {
 		if (BABYLON.Engine.isSupported()) {
 			var canvas = document.getElementById("renderCanvas");
-			var engine = new BABYLON.Engine(canvas, true);
+			var engine = new BABYLON.Engine(canvas, true);					
+			BABYLONDEVTOOLS.Loader.debugShortcut(engine);
 			var divFps = document.getElementById("fps");
 
 			scene = new BABYLON.Scene(engine);

+ 1 - 2
src/Debug/babylon.debugLayer.ts

@@ -15,10 +15,9 @@ module BABYLON {
         private _createInspector() {
             new INSPECTOR.Inspector(this._scene);
         }
-
         
         public isVisible(): boolean {
-            return true;
+            return false;
         }
 
         public hide() {