1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/**
* @author mrdoob / http://mrdoob.com/
*/
Sidebar.Geometry.BufferGeometry = function ( editor ) {
var strings = editor.strings;
var signals = editor.signals;
var container = new UI.Row();
function update( object ) {
if ( object === null ) return; // objectSelected.dispatch( null )
if ( object === undefined ) return;
var geometry = object.geometry;
if ( geometry && geometry.isBufferGeometry ) {
container.clear();
container.setDisplay( 'block' );
var text = new UI.Text( strings.getKey( 'sidebar/geometry/buffer_geometry/attributes' ) ).setWidth( '90px' );
container.add( text );
var container2 = new UI.Span().setDisplay( 'inline-block' ).setWidth( '160px' );
container.add( container2 );
var index = geometry.index;
if ( index !== null ) {
container2.add( new UI.Text( strings.getKey( 'sidebar/geometry/buffer_geometry/index' ) ).setWidth( '80px' ) );
container2.add( new UI.Text( ( index.count ).format() ).setFontSize( '12px' ) );
container2.add( new UI.Break() );
}
var attributes = geometry.attributes;
for ( var name in attributes ) {
var attribute = attributes[ name ];
container2.add( new UI.Text( name ).setWidth( '80px' ) );
container2.add( new UI.Text( ( attribute.count ).format() + ' (' + attribute.itemSize + ')' ).setFontSize( '12px' ) );
container2.add( new UI.Break() );
}
} else {
container.setDisplay( 'none' );
}
}
signals.objectSelected.add( update );
signals.geometryChanged.add( update );
return container;
};
|