Browse Source

Editor: Fixed errors when selecting Scene.

Mr.doob 12 years ago
parent
commit
4da43c9428
2 changed files with 20 additions and 7 deletions
  1. 13 1
      editor/js/Editor.js
  2. 7 6
      editor/js/Sidebar.Scene.js

+ 13 - 1
editor/js/Editor.js

@@ -259,7 +259,19 @@ Editor.prototype = {
 
 	selectById: function ( id ) {
 
-		this.select( this.scene.getObjectById( id, true ) );
+		var object = null;
+
+		this.scene.traverse( function ( child ) {
+
+			if ( child.id === id ) {
+
+				object = child;
+
+			}
+
+		} );
+
+		this.select( object );
 
 	},
 

+ 7 - 6
editor/js/Sidebar.Scene.js

@@ -2,8 +2,6 @@ Sidebar.Scene = function ( editor ) {
 
 	var signals = editor.signals;
 
-	var selected = null;
-
 	var container = new UI.Panel();
 	container.setPadding( '10px' );
 	container.setBorderTop( '1px solid #ccc' );
@@ -169,7 +167,12 @@ Sidebar.Scene = function ( editor ) {
 		} )( scene.children, '   ' );
 
 		outliner.setOptions( options );
-		outliner.setValue( selected );
+
+		if ( editor.selected !== null ) {
+
+			outliner.setValue( editor.selected.id );
+
+		}
 
 		if ( scene.fog ) {
 
@@ -200,9 +203,7 @@ Sidebar.Scene = function ( editor ) {
 
 	signals.objectSelected.add( function ( object ) {
 
-		selected = object !== null ? object.id : null;
-
-		outliner.setValue( selected );
+		outliner.setValue( object.id );
 
 	} );