Sidebar.Geometry.BufferGeometry.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Geometry.BufferGeometry = function ( editor ) {
  5. var signals = editor.signals;
  6. var container = new UI.Row();
  7. function update( object ) {
  8. if ( object === null ) return;
  9. var geometry = object.geometry;
  10. if ( geometry instanceof THREE.BufferGeometry ) {
  11. container.clear();
  12. container.setDisplay( 'block' );
  13. var index = geometry.index;
  14. if ( index !== null ) {
  15. var panel = new UI.Row();
  16. panel.add( new UI.Text( 'index' ).setWidth( '90px' ) );
  17. panel.add( new UI.Text( ( index.count ).format() ).setFontSize( '12px' ) );
  18. container.add( panel );
  19. }
  20. var attributes = geometry.attributes;
  21. for ( var name in attributes ) {
  22. var attribute = attributes[ name ];
  23. var panel = new UI.Row();
  24. panel.add( new UI.Text( name ).setWidth( '90px' ) );
  25. panel.add( new UI.Text( ( attribute.count ).format() + ' (' + attribute.itemSize + ')' ).setFontSize( '12px' ) );
  26. container.add( panel );
  27. }
  28. } else {
  29. container.setDisplay( 'none' );
  30. }
  31. }
  32. signals.objectSelected.add( update );
  33. signals.geometryChanged.add( update );
  34. return container;
  35. };