|
@@ -32,6 +32,8 @@ var Editor = function () {
|
|
|
geometryChanged: new SIGNALS.Signal(),
|
|
|
|
|
|
objectSelected: new SIGNALS.Signal(),
|
|
|
+ objectFocused: new SIGNALS.Signal(),
|
|
|
+
|
|
|
objectAdded: new SIGNALS.Signal(),
|
|
|
objectChanged: new SIGNALS.Signal(),
|
|
|
objectRemoved: new SIGNALS.Signal(),
|
|
@@ -283,35 +285,26 @@ Editor.prototype = {
|
|
|
|
|
|
select: function ( object ) {
|
|
|
|
|
|
- this.selected = object;
|
|
|
-
|
|
|
- if ( object !== null ) {
|
|
|
+ if ( this.selected === object ) return;
|
|
|
|
|
|
- this.config.setKey( 'selected', object.uuid );
|
|
|
+ var uuid = null;
|
|
|
|
|
|
- } else {
|
|
|
+ if ( object !== null ) {
|
|
|
|
|
|
- this.config.setKey( 'selected', null );
|
|
|
+ uuid = object.uuid;
|
|
|
|
|
|
}
|
|
|
|
|
|
+ this.selected = object;
|
|
|
+
|
|
|
+ this.config.setKey( 'selected', uuid );
|
|
|
this.signals.objectSelected.dispatch( object );
|
|
|
|
|
|
},
|
|
|
|
|
|
selectById: function ( id ) {
|
|
|
|
|
|
- var scope = this;
|
|
|
-
|
|
|
- this.scene.traverse( function ( child ) {
|
|
|
-
|
|
|
- if ( child.id === id ) {
|
|
|
-
|
|
|
- scope.select( child );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } );
|
|
|
+ this.select( this.scene.getObjectById( id, true ) );
|
|
|
|
|
|
},
|
|
|
|
|
@@ -335,6 +328,18 @@ Editor.prototype = {
|
|
|
|
|
|
this.select( null );
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ focus: function ( object ) {
|
|
|
+
|
|
|
+ this.signals.objectFocused.dispatch( object );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ focusById: function ( id ) {
|
|
|
+
|
|
|
+ this.focus( this.scene.getObjectById( id, true ) );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|