From 25f884db204b8e0853cab8965b61f84c22cfbe71 Mon Sep 17 00:00:00 2001 From: Dusten Hubbard Date: Wed, 14 Oct 2026 22:00:23 -0500 Subject: [PATCH] fix(undo): record a section undo when an alignment is renamed Renaming an alignment keeps each section's transform under a new name. tformsModified compared only the transform values, so the rename looked like no change and no section undo state was saved. Undo then left the new name on every section, and undoing the next alignment change put the old name back along with it. The check now compares the alignment names too. The scaling-only check is unchanged. --- PyReconstruct/modules/datatypes/section.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PyReconstruct/modules/datatypes/section.py b/PyReconstruct/modules/datatypes/section.py index b280891c0..981f0e96e 100644 --- a/PyReconstruct/modules/datatypes/section.py +++ b/PyReconstruct/modules/datatypes/section.py @@ -357,6 +357,9 @@ def getAllModifiedNames(self) -> set: def tformsModified(self, scaling_only=False): if len(self.tforms_values_copy) != len(self.tforms): return True + # a renamed alignment keeps its matrix, so compare the names too + if not scaling_only and self.tforms_names_copy != list(self.tforms): + return True for t1, t2 in zip(self.tforms_values_copy, self.tforms.values()): if scaling_only: if abs(t1.det - t2.det) > 1e-6: @@ -372,6 +375,7 @@ def clearTracking(self): self.removed_traces = [] self.modified_contours = set() self.tforms_values_copy = [t.copy() for t in self.tforms.values()] + self.tforms_names_copy = list(self.tforms) self.flags_modified = False def setMag(self, new_mag : float):