Skip to content

Commit

Permalink
Editor: Fix undo/redo of points. (#28677)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jun 18, 2024
1 parent ce72acd commit 49b30e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions editor/js/Sidebar.Geometry.LatheGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function GeometryParametersPanel( editor, object ) {

const parameters = object.geometry.parameters;

points.setValue( parameters.points, false );
segments.setValue( parameters.segments );
phiStart.setValue( parameters.phiStart * THREE.MathUtils.RAD2DEG );
phiLength.setValue( parameters.phiLength * THREE.MathUtils.RAD2DEG );
Expand Down
1 change: 1 addition & 0 deletions editor/js/Sidebar.Geometry.TubeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function GeometryParametersPanel( editor, object ) {
radialSegments.setValue( parameters.radialSegments );
closed.setValue( parameters.closed );

points.setValue( parameters.path.points, false );
curveType.setValue( parameters.path.curveType );
tension.setValue( parameters.path.tension );

Expand Down
22 changes: 10 additions & 12 deletions editor/js/libs/ui.three.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,29 +571,25 @@ class UIPoints extends UISpan {

clear() {

for ( let i = 0; i < this.pointsUI.length; ++ i ) {
for ( let i = this.pointsUI.length - 1; i >= 0; -- i ) {

if ( this.pointsUI[ i ] ) {

this.deletePointRow( i, true );

}
this.deletePointRow( i, false );

}

this.lastPointIdx = 0;

}

deletePointRow( idx, dontUpdate ) {
deletePointRow( idx, needsUpdate = true ) {

if ( ! this.pointsUI[ idx ] ) return;

this.pointsList.remove( this.pointsUI[ idx ].row );

this.pointsUI.splice( idx, 1 );

if ( dontUpdate !== true ) {
if ( needsUpdate === true ) {

this.update();

Expand Down Expand Up @@ -658,7 +654,7 @@ class UIPoints2 extends UIPoints {

}

setValue( points ) {
setValue( points, needsUpdate = true ) {

this.clear();

Expand All @@ -669,7 +665,8 @@ class UIPoints2 extends UIPoints {

}

this.update();
if ( needsUpdate === true ) this.update();

return this;

}
Expand Down Expand Up @@ -753,7 +750,7 @@ class UIPoints3 extends UIPoints {

}

setValue( points ) {
setValue( points, update = true ) {

this.clear();

Expand All @@ -764,7 +761,8 @@ class UIPoints3 extends UIPoints {

}

this.update();
if ( update === true ) this.update();

return this;

}
Expand Down

0 comments on commit 49b30e6

Please sign in to comment.