Skip to content

Commit

Permalink
Updated undo for path deformation.
Browse files Browse the repository at this point in the history
  • Loading branch information
seagetch committed Sep 12, 2023
1 parent 6701a6a commit a7c50d2
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions source/creator/actions/mesheditor.d
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,15 @@ public:
vec3[] newRefOffsets;
ulong[] oldSelected;
ulong[] newSelected;
vec2[] oldDeformation;
vec2[] newDeformation;
float oldOrigX, oldOrigY, oldOrigRotZ;
float newOrigX, newOrigY, newOrigRotZ;

IncMeshEditorOneDrawableDeform selfDeform() {
return cast(IncMeshEditorOneDrawableDeform)self();
}

auto path() {
if (self !is null)
return self.getPath();
Expand All @@ -372,8 +378,11 @@ public:
}
if (self !is null) {
oldSelected = self.selected;
if (selfDeform !is null)
oldDeformation = selfDeform.deformation;
} else {
oldSelected = null;
oldDeformation = null;
}

if (this.path && this.path.target !is null)
Expand All @@ -395,6 +404,8 @@ public:
}
if (self !is null) {
newSelected = self.selected;
if (selfDeform !is null)
newDeformation = selfDeform.deformation;
}
if (path !is null && path.target !is null)
newTargetPathPoints = path.target.points.dup;
Expand All @@ -417,7 +428,11 @@ public:
oldOrigY = 0;
oldOrigRotZ = 0;
}
if (self !is null) oldSelected = self.selected;
if (self !is null) {
oldSelected = self.selected;
if (selfDeform !is null)
oldDeformation = selfDeform.deformation;
}
else oldSelected = null;
if (path !is null && path.target !is null)
oldTargetPathPoints = path.target.points.dup;
Expand All @@ -443,7 +458,11 @@ public:
path.origRotZ = oldOrigRotZ;
path.update(); /// FIX ME: we need to recreate path object if needed.
}
if (oldSelected !is null) self.selected = oldSelected.dup;
if (oldSelected !is null) {
self.selected = oldSelected.dup;
}
if (oldDeformation !is null)
selfDeform.deformation = oldDeformation.dup;
if (oldTargetPathPoints !is null && oldTargetPathPoints.length > 0 && path !is null && path.target !is null) {
path.target.points = oldTargetPathPoints.dup;
path.target.update(); /// FIX ME: we need to recreate path object if needed.
Expand All @@ -467,7 +486,11 @@ public:
path.origRotZ = newOrigRotZ;
path.update();
}
if (newSelected !is null) self.selected = newSelected.dup;
if (newSelected !is null) {
self.selected = newSelected.dup;
}
if (newDeformation !is null)
selfDeform.deformation = newDeformation.dup;
if (newTargetPathPoints !is null && newTargetPathPoints.length > 0 && path !is null && path.target !is null) {
path.target.points = newTargetPathPoints.dup;
path.target.update();
Expand Down

0 comments on commit a7c50d2

Please sign in to comment.