Browse Source

Editor: Setting object type as title of Object3D panel.

Mr.doob 13 years ago
parent
commit
aa33873a8c
1 changed files with 24 additions and 1 deletions
  1. 24 1
      editor/js/ui/Sidebar.Properties.Object3D.js

+ 24 - 1
editor/js/ui/Sidebar.Properties.Object3D.js

@@ -1,9 +1,20 @@
 Sidebar.Properties.Object3D = function ( signals ) {
 
+	var objects = {
+
+		'PerspectiveCamera': THREE.PerspectiveCamera,
+		'PointLight': THREE.PointLight,
+		'DirectionalLight': THREE.DirectionalLight,
+		'Mesh': THREE.Mesh,
+		'Object3D': THREE.Object3D
+
+	};
+
 	var container = new UI.Panel();
 	container.setDisplay( 'none' );
 
-	container.add( new UI.Text().setValue( 'OBJECT' ).setColor( '#666' ) );
+	var objectType = new UI.Text().setColor( '#666' );
+	container.add( objectType );
 	container.add( new UI.Break(), new UI.Break() );
 
 	// name
@@ -92,6 +103,16 @@ Sidebar.Properties.Object3D = function ( signals ) {
 
 	}
 
+	function getObjectInstanceName( object ) {
+
+		for ( var key in objects ) {
+
+			if ( object instanceof objects[ key ] ) return key;
+
+		}
+
+	}
+
 	// events
 
 	signals.objectSelected.add( function ( object ) {
@@ -102,6 +123,8 @@ Sidebar.Properties.Object3D = function ( signals ) {
 
 			container.setDisplay( 'block' );
 
+			objectType.setValue( getObjectInstanceName( object ).toUpperCase() );
+
 			objectName.setValue( object.name );
 
 			objectPositionX.setValue( object.position.x );