Browse Source

GUI: Outliner is now recursive.

Mr.doob 13 years ago
parent
commit
1265ec4edf
2 changed files with 13 additions and 5 deletions
  1. 2 1
      gui/js/UI.js
  2. 11 4
      gui/js/ui/Sidebar.Outliner.js

+ 2 - 1
gui/js/UI.js

@@ -278,6 +278,7 @@ UI.Select = function ( position ) {
 	this.dom.style.height = '16px';
 	this.dom.style.border = '0px';
 	this.dom.style.padding = '0px';
+	this.dom.style.whiteSpace = 'pre';
 
 	this.onChangeCallback = null;
 
@@ -313,7 +314,7 @@ UI.Select.prototype.setOptions = function ( options ) {
 
 		var option = document.createElement( 'option' );
 		option.value = key;
-		option.appendChild( document.createTextNode( options[ key ] ) );
+		option.innerHTML = options[ key ];
 		this.dom.appendChild( option );
 
 	}

+ 11 - 4
gui/js/ui/Sidebar.Outliner.js

@@ -63,12 +63,19 @@ Sidebar.Outliner = function ( signals ) {
 
 		var options = {};
 
-		for ( var i in scene.children ) {
+		( function createList( object, pad ) {
 
-			var object = scene.children[ i ];
-			options[ object.id ] = ' - ' + object.name + '[' + getObjectInstanceName( object ) + ']';
+			for ( var key in object.children ) {
 
-		}
+				var child = object.children[ key ];
+
+				options[ child.id ] = pad + '+ ' + object.name + ' [' + getObjectInstanceName( child ) + ']';
+
+				createList( child, pad + '   ' );
+
+			}
+
+		} )( scene, '' );
 
 		sceneGraph.setOptions( options );