提交 aa33873a 编写于 作者: M Mr.doob

Editor: Setting object type as title of Object3D panel.

上级 0b442ce7
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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册