瀏覽代碼

Added curve type and tension parameters

Temdog007 6 年之前
父節點
當前提交
4ccc52317c
共有 2 個文件被更改,包括 21 次插入1 次删除
  1. 19 1
      editor/js/Sidebar.Geometry.TubeGeometry.js
  2. 2 0
      editor/js/Strings.js

+ 19 - 1
editor/js/Sidebar.Geometry.TubeGeometry.js

@@ -100,6 +100,24 @@ Sidebar.Geometry.TubeGeometry = function ( editor, object ) {
 
 	container.add( closedRow );
 
+	// curveType
+
+	var curveTypeRow = new UI.Row();
+	var curveType = new UI.Select().setOptions( { centripetal: 'centripetal', chordal: 'chordal', catmullrom: 'catmullrom' } ).setValue( parameters.path.curveType ).onChange( update );
+
+	curveTypeRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/tube_geometry/curvetype' ) ).setWidth( '90px' ), curveType );
+
+	container.add( curveTypeRow );
+
+	// tension
+
+	var tensionRow = new UI.Row();
+	var tension = new UI.Number( parameters.path.tension ).setStep( 0.01 ).onChange( update );
+
+	tensionRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/tube_geometry/tension' ) ).setWidth( '90px' ), tension );
+
+	container.add( tensionRow );
+
 	//
 
 	function update() {
@@ -120,7 +138,7 @@ Sidebar.Geometry.TubeGeometry = function ( editor, object ) {
 		}
 
 		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
-			new THREE.CatmullRomCurve3( points, closed.getValue() ),
+			new THREE.CatmullRomCurve3( points, closed.getValue(), curveType.getValue(), tension.getValue() ),
 			tubularSegments.getValue(),
 			radius.getValue(),
 			radialSegments.getValue(),

+ 2 - 0
editor/js/Strings.js

@@ -169,6 +169,8 @@ var Strings = function ( config ) {
 			'sidebar/geometry/tube_geometry/tubularsegments': 'Tubular segments',
 			'sidebar/geometry/tube_geometry/radialsegments': 'Radial segments',
 			'sidebar/geometry/tube_geometry/closed': 'Closed',
+			'sidebar/geometry/tube_geometry/curvetype': 'Curve Type',
+			'sidebar/geometry/tube_geometry/tension': 'Tension',
 
 			'sidebar/material/new': 'New',
 			'sidebar/material/copy': 'Copy',