Sidebar.Geometry.ShapeGeometry.js 1.3 KB

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