2
0

Sidebar.Geometry.ShapeGeometry.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @author Temdog007 / http://github.com/Temdog007
  3. */
  4. Sidebar.Geometry.ShapeGeometry = function ( editor, object ) {
  5. var strings = editor.strings;
  6. var container = new UI.Row();
  7. var geometry = object.geometry;
  8. var parameters = geometry.parameters;
  9. // curveSegments
  10. var curveSegmentsRow = new UI.Row();
  11. var curveSegments = new UI.Integer( parameters.curveSegments || 12 ).onChange( changeShape ).setRange( 1, Infinity );
  12. curveSegmentsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/shape_geometry/curveSegments' ) ).setWidth( '90px' ) );
  13. curveSegmentsRow.add( curveSegments );
  14. container.add( curveSegmentsRow );
  15. // to extrude
  16. var button = new UI.Button( strings.getKey( 'sidebar/geometry/shape_geometry/extrude' ) ).onClick( toExtrude ).setWidth( '90px' ).setMarginLeft( '90px' );
  17. container.add( button );
  18. //
  19. function changeShape() {
  20. editor.execute( new SetGeometryCommand( editor, object, new THREE[ geometry.type ](
  21. parameters.shapes,
  22. curveSegments.getValue()
  23. ) ) );
  24. }
  25. function toExtrude() {
  26. editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeBufferGeometry(
  27. parameters.shapes, {
  28. curveSegments: curveSegments.getValue()
  29. }
  30. ) ) );
  31. }
  32. return container;
  33. };
  34. Sidebar.Geometry.ShapeBufferGeometry = Sidebar.Geometry.ShapeGeometry;