Sidebar.Geometry.BufferGeometry.js 838 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Geometry.BufferGeometry = function ( editor ) {
  5. var signals = editor.signals;
  6. var container = new UI.Panel();
  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 attributes = geometry.attributes;
  14. for ( var name in attributes ) {
  15. var panel = new UI.Panel();
  16. panel.add( new UI.Text( name ).setWidth( '90px' ) );
  17. panel.add( new UI.Text( ( attributes[ name ].count ).format() ).setFontSize( '12px' ) );
  18. container.add( panel );
  19. }
  20. } else {
  21. container.setDisplay( 'none' );
  22. }
  23. };
  24. signals.objectSelected.add( update );
  25. signals.geometryChanged.add( update );
  26. return container;
  27. }