Fix Keyframes don't get restored after trim in undo#1794
Fix Keyframes don't get restored after trim in undo#1794
Conversation
bmatherly
left a comment
There was a problem hiding this comment.
The same change is not needed for trim out because we do not delete keyframes beyond the end of a clip when we trim out - so they are still there before an undo opteration.
| } else if (m_model.trimClipInValid(trackIndex, clipIndex, delta, ripple || roll)) { | ||
| if (!m_undoHelper) { | ||
| m_undoHelper.reset(new UndoHelper(m_model)); | ||
| if (!ripple) { |
There was a problem hiding this comment.
Removing SkipXML for trim in causes the undo helper to create XML to capture the keyframe state.
I notice that the RestoreTracks logic here and in timelinecommands.cpp is inverted. So I made them match.
There was a problem hiding this comment.
Pull request overview
Fixes an undo regression where trimming a clip could alter filter/link keyframes and those keyframes would not be restored when the trim was undone. This is achieved by ensuring trim-in operations retain enough state (XML) and by explicitly restoring filter/link properties during undo of clip resizes.
Changes:
- Adjust trim-in undo hinting to avoid skipping XML capture for non-ripple trims and to restore tracks for ripple trims.
- Enhance
UndoHelper::undoChanges()to restore filter and link properties from the pre-change XML when undoing a clip resize/trim. - Align
TrimClipInCommandhint usage with the updated trim-in behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/docks/timelinedock.cpp |
Changes trim-in undo helper hints so XML is no longer skipped for non-ripple trim-in, enabling keyframe restoration. |
src/commands/undohelper.cpp |
Restores filter/link properties from stored XML during undo of clip resize to recover keyframes affected by trimming. |
src/commands/timelinecommands.cpp |
Updates TrimClipInCommand to set RestoreTracks for ripple trims. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| info.out_delta, | ||
| info.in_delta); | ||
| if (!info.xml.isEmpty() && !info.isBlank) { | ||
| // Pass all properties for links and filters to restore keyframes that might have been affected by a resize. |
| m_undoHelper->setHints(UndoHelper::SkipXML); | ||
| } else { | ||
| if (ripple) { | ||
| m_undoHelper->setHints(UndoHelper::RestoreTracks); |
There was a problem hiding this comment.
This is what I was afraid of. The trim methods are called with high frequency while dragging the handles.
|
Superseded by #1795 |
As reported here:
https://forum.shotcut.org/t/keyframes-dont-get-restored-after-undo/48044