@@ -15,45 +15,12 @@ Sidebar.Geometry.TubeGeometry = function ( editor, object ) {
1515
1616 // points
1717
18- var lastPointIdx = 0 ;
19- var pointsUI = [ ] ;
20-
2118 var pointsRow = new UI . Row ( ) ;
2219 pointsRow . add ( new UI . Text ( strings . getKey ( 'sidebar/geometry/tube_geometry/path' ) ) . setWidth ( '90px' ) ) ;
2320
24- var points = new UI . Span ( ) . setDisplay ( 'inline-block' ) ;
21+ var points = new UI . Points3 ( ) . setValue ( parameters . path . points ) . onChange ( update ) ;
2522 pointsRow . add ( points ) ;
2623
27- var pointsList = new UI . Div ( ) ;
28- points . add ( pointsList ) ;
29-
30- var parameterPoints = parameters . path . points ;
31- for ( var i = 0 ; i < parameterPoints . length ; i ++ ) {
32-
33- var point = parameterPoints [ i ] ;
34- pointsList . add ( createPointRow ( point . x , point . y , point . z ) ) ;
35-
36- }
37-
38- var addPointButton = new UI . Button ( '+' ) . onClick ( function ( ) {
39-
40- if ( pointsUI . length === 0 ) {
41-
42- pointsList . add ( createPointRow ( 0 , 0 , 0 ) ) ;
43-
44- } else {
45-
46- var point = pointsUI [ pointsUI . length - 1 ] ;
47-
48- pointsList . add ( createPointRow ( point . x . getValue ( ) , point . y . getValue ( ) , point . z . getValue ( ) ) ) ;
49-
50- }
51-
52- update ( ) ;
53-
54- } ) ;
55- points . add ( addPointButton ) ;
56-
5724 container . add ( pointsRow ) ;
5825
5926 // radius
@@ -118,25 +85,10 @@ Sidebar.Geometry.TubeGeometry = function ( editor, object ) {
11885
11986 function update ( ) {
12087
121- var points = [ ] ;
122- var count = 0 ;
123-
124- for ( var i = 0 ; i < pointsUI . length ; i ++ ) {
125-
126- var pointUI = pointsUI [ i ] ;
127-
128- if ( ! pointUI ) continue ;
129-
130- points . push ( new THREE . Vector3 ( pointUI . x . getValue ( ) , pointUI . y . getValue ( ) , pointUI . z . getValue ( ) ) ) ;
131- count ++ ;
132- pointUI . lbl . setValue ( count ) ;
133-
134- }
135-
13688 tensionRow . setDisplay ( curveType . getValue ( ) == 'catmullrom' ? '' : 'none' ) ;
13789
13890 editor . execute ( new SetGeometryCommand ( object , new THREE [ geometry . type ] (
139- new THREE . CatmullRomCurve3 ( points , closed . getValue ( ) , curveType . getValue ( ) , tension . getValue ( ) ) ,
91+ new THREE . CatmullRomCurve3 ( points . getValue ( ) , closed . getValue ( ) , curveType . getValue ( ) , tension . getValue ( ) ) ,
14092 tubularSegments . getValue ( ) ,
14193 radius . getValue ( ) ,
14294 radialSegments . getValue ( ) ,
@@ -145,39 +97,6 @@ Sidebar.Geometry.TubeGeometry = function ( editor, object ) {
14597
14698 }
14799
148- function createPointRow ( x , y , z ) {
149-
150- var pointRow = new UI . Div ( ) ;
151- var lbl = new UI . Text ( lastPointIdx + 1 ) . setWidth ( '20px' ) ;
152- var txtX = new UI . Number ( x ) . setWidth ( '30px' ) . onChange ( update ) ;
153- var txtY = new UI . Number ( y ) . setWidth ( '30px' ) . onChange ( update ) ;
154- var txtZ = new UI . Number ( z ) . setWidth ( '30px' ) . onChange ( update ) ;
155- var idx = lastPointIdx ;
156- var btn = new UI . Button ( '-' ) . onClick ( function ( ) {
157-
158- deletePointRow ( idx ) ;
159-
160- } ) ;
161-
162- pointsUI . push ( { row : pointRow , lbl : lbl , x : txtX , y : txtY , z : txtZ } ) ;
163- lastPointIdx ++ ;
164- pointRow . add ( lbl , txtX , txtY , txtZ , btn ) ;
165-
166- return pointRow ;
167-
168- }
169-
170- function deletePointRow ( idx ) {
171-
172- if ( ! pointsUI [ idx ] ) return ;
173-
174- pointsList . remove ( pointsUI [ idx ] . row ) ;
175- pointsUI [ idx ] = null ;
176-
177- update ( ) ;
178-
179- }
180-
181100 return container ;
182101
183102} ;
0 commit comments