Browse Source

Editor: Yet more optimisations and clean up.

Mr.doob 11 years ago
parent
commit
e03e493d2e
4 changed files with 12 additions and 17 deletions
  1. 2 0
      editor/js/Editor.js
  2. 3 14
      editor/js/Sidebar.Object3D.js
  3. 0 2
      editor/js/Viewport.js
  4. 7 1
      editor/js/libs/ui.js

+ 2 - 0
editor/js/Editor.js

@@ -45,6 +45,8 @@ var Editor = function () {
 	this.loader = new Loader( this );
 
 	this.scene = new THREE.Scene();
+	this.scene.name = 'Scene';
+	
 	this.sceneHelpers = new THREE.Scene();
 
 	this.object = {};

+ 3 - 14
editor/js/Sidebar.Object3D.js

@@ -434,24 +434,13 @@ Sidebar.Object3D = function ( editor ) {
 	signals.sceneGraphChanged.add( function () {
 
 		var scene = editor.scene;
-
 		var options = {};
 
-		options[ scene.id ] = 'Scene';
-
-		( function addObjects( objects ) {
-
-			for ( var i = 0, l = objects.length; i < l; i ++ ) {
-
-				var object = objects[ i ];
+		scene.traverse( function ( object ) {
 
-				options[ object.id ] = object.name;
-
-				addObjects( object.children );
-
-			}
+			options[ object.id ] = object.name;
 
-		} )( scene.children );
+		} );
 
 		objectParent.setOptions( options );
 

+ 0 - 2
editor/js/Viewport.js

@@ -591,8 +591,6 @@ var Viewport = function ( editor ) {
 
 	function render() {
 
-		console.trace();
-
 		sceneHelpers.updateMatrixWorld();
 		scene.updateMatrixWorld();
 

+ 7 - 1
editor/js/libs/ui.js

@@ -480,7 +480,13 @@ UI.Select.prototype.getValue = function () {
 
 UI.Select.prototype.setValue = function ( value ) {
 
-	this.dom.value = value;
+	value = String( value );
+
+	if ( this.dom.value !== value ) {
+
+		this.dom.value = value;
+
+	}
 
 	return this;