瀏覽代碼

GUI: Added object type to the outliner.
Realised that DirectionalLight is "poluting" the scene graph...

Mr.doob 13 年之前
父節點
當前提交
a1d97756bf
共有 3 個文件被更改,包括 37 次插入11 次删除
  1. 23 1
      gui/js/ui/Sidebar.Outliner.js
  2. 12 10
      gui/js/ui/Sidebar.Properties.Material.js
  3. 2 0
      gui/js/ui/Sidebar.Properties.Object3D.js

+ 23 - 1
gui/js/ui/Sidebar.Outliner.js

@@ -1,5 +1,15 @@
 Sidebar.Outliner = function ( signals ) {
 
+	var objects = {
+
+		'PerspectiveCamera': THREE.PerspectiveCamera,
+		'PointLight': THREE.PointLight,
+		'DirectionalLight': THREE.DirectionalLight,
+		'Mesh': THREE.Mesh,
+		'Object3D': THREE.Object3D
+
+	};
+
 	var selected = null;
 
 	var container = new UI.Panel();
@@ -35,6 +45,18 @@ Sidebar.Outliner = function ( signals ) {
 
 	}
 
+	function getObjectInstanceName( object ) {
+
+		for ( var key in objects ) {
+
+			if ( object instanceof objects[ key ] ) return key;
+
+		}
+
+	}
+
+	// events
+
 	signals.sceneChanged.add( function ( object ) {
 
 		scene = object;
@@ -44,7 +66,7 @@ Sidebar.Outliner = function ( signals ) {
 		for ( var i in scene.children ) {
 
 			var object = scene.children[ i ];
-			options[ object.id ] = ' - ' + object.name;
+			options[ object.id ] = ' - ' + object.name + '[' + getObjectInstanceName( object ) + ']';
 
 		}
 

+ 12 - 10
gui/js/ui/Sidebar.Properties.Material.js

@@ -251,6 +251,18 @@ Sidebar.Properties.Material = function ( signals ) {
 
 	};
 
+	function getMaterialInstanceName( material ) {
+
+		for ( var key in materials ) {
+
+			if ( material instanceof materials[ key ] ) return key;
+
+		}
+
+	}
+
+	// events
+
 	signals.objectSelected.add( function ( object ) {
 
 		if ( object && object.material ) {
@@ -336,16 +348,6 @@ Sidebar.Properties.Material = function ( signals ) {
 
 	} );
 
-	function getMaterialInstanceName( material ) {
-
-		for ( var key in materials ) {
-
-			if ( material instanceof materials[ key ] ) return key;
-
-		}
-
-	}
-
 	return container;
 
 }

+ 2 - 0
gui/js/ui/Sidebar.Properties.Object3D.js

@@ -92,6 +92,8 @@ Sidebar.Properties.Object3D = function ( signals ) {
 
 	}
 
+	// events
+
 	signals.objectSelected.add( function ( object ) {
 
 		selected = object;