Skip to content

Commit e5568b9

Browse files
Thibault-Pelletierlassoan
authored andcommitted
BUG: Fix Undo/Redo in the segment editor logic
Fix Undo/Redo in the segment editor not activated when loading a saved scene. Problem was due to not observing the segmentation node modified event and not synchronizing the segmentation history to the segmentation the first time it was set. This fix properly calls the observer reconnect and segmentation history synchronization methods on set. Closes Slicer#8721
1 parent 76db15f commit e5568b9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Modules/Loadable/Segmentations/Logic/vtkSegmentEditorLogic.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ void vtkSegmentEditorLogic::SetSegmentEditorNode(vtkMRMLSegmentEditorNode* newSe
764764
});
765765

766766
this->SegmentEditorNodeObs = newSegmentEditorNode->AddObserver(vtkCommand::ModifiedEvent, updateCommand);
767+
768+
// Update the segment editor's segmentation node observers
769+
this->ReconnectSegmentationNodeObserver();
767770
}
768771
}
769772

@@ -2212,6 +2215,9 @@ void vtkSegmentEditorLogic::ReconnectSegmentationNodeObserver()
22122215

22132216
auto obs = newSegmentationNode->AddObserver(vtkCommand::ModifiedEvent, updateCommand);
22142217
this->SegmentationObs = std::make_tuple(obs, newSegmentationNode);
2218+
2219+
// Synchronize the segmentation history for the new segmentation node
2220+
this->SynchronizeSegmentationHistorySegmentation();
22152221
}
22162222
}
22172223

0 commit comments

Comments
 (0)