Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra undoState saved when redo is pressed on SegmentEditor #6183

Closed
mauigna06 opened this issue Feb 12, 2022 · 1 comment
Closed

Extra undoState saved when redo is pressed on SegmentEditor #6183

mauigna06 opened this issue Feb 12, 2022 · 1 comment
Labels
Type: Bug Something isn't working correctly

Comments

@mauigna06
Copy link
Contributor

Redo adds an extra undoState breaking up expected behaviour (and our customApp segmentEditor logic)

Steps to reproduce

Use a example CT on the segment editor module. Select Paint effect. Paint 3 separed lines (or brush strokes) on axial view, Press undo button (there will be 2 lines on the axial view). Paint another separed line (now there are 3 lines again) because of this action an extra undoState is added that means you need to press undoButton 3 times (the expected would be 2) to have only one line on the sliceView.

Environment

  • Slicer version: Slicer-4.13.0-2022-02-09
  • Operating system: Windows 10
@mauigna06 mauigna06 added the Type: Bug Something isn't working correctly label Feb 12, 2022
lassoan added a commit to lassoan/Slicer that referenced this issue Feb 14, 2022
When save state is requested in vtkSegmentationHistory then the history must contain the current state and all previous states.
This means that if save state is requested when the current state is already stored in the history then there is no need to save the state again
(it would just result in having two identical states in the history).

When a state is saved we also set the current state as last restored state. This avoids creation of an extra (identical) saved state when SaveState is called but the segmentation is not modified.

Fixes Slicer#6183
@lassoan
Copy link
Contributor

lassoan commented Feb 14, 2022

Thank you for the clear error report, I've pushed a fix.

lassoan added a commit to jamesobutler/Slicer that referenced this issue Feb 16, 2022
When save state is requested in vtkSegmentationHistory then the history must contain the current state and all previous states.
This means that if save state is requested when the current state is already stored in the history then there is no need to save the state again
(it would just result in having two identical states in the history).

When a state is saved we also set the current state as last restored state. This avoids creation of an extra (identical) saved state when SaveState is called but the segmentation is not modified.

Fixes Slicer#6183
riep pushed a commit to riep/Slicer that referenced this issue Apr 4, 2022
When save state is requested in vtkSegmentationHistory then the history must contain the current state and all previous states.
This means that if save state is requested when the current state is already stored in the history then there is no need to save the state again
(it would just result in having two identical states in the history).

When a state is saved we also set the current state as last restored state. This avoids creation of an extra (identical) saved state when SaveState is called but the segmentation is not modified.

Fixes Slicer#6183

(cherry picked from commit d547e8a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working correctly
Development

No branches or pull requests

2 participants