Profile editor - Fix undo and editor service bugs found by the tests (#913)

* Profile editor - Fix undoing profile editor commands

- Undoing a change to an existing keyframe's value restores the value instead of deleting the keyframe
- Undoing "remove effect" puts the effect back in its place instead of below the next one
- Undoing "toggle keyframes" restores what it was before
- Undoing a brush change on a layer that had no brush removes the brush again, using the new Layer.RemoveLayerBrush
- Undoing "add element" disables the element again
- Undoing an event path change back to no path goes back to an event start node, like a new condition
- MoveProfileElement says "Move folder" for folders
- UpdateLayerProperty without a time no longer calls itself "Add ... keyframe"

* Profile editor - Fix auto-saving, failing commands, suspended editing and smaller editor issues

- A failed auto-save no longer stops auto-saving for the rest of the session
- A failing command is no longer also reported to ReactiveUI as unhandled, on top of the error dialog
- Resuming editing applies the editor's time again right away
- Nothing is focused while editing is suspended
- A layer created on another layer gets a name that isn't in use next to it
- CanUndo and CanRedo start out false, so new subscribers know the state right away
- An empty command scope doesn't add an undo step
- New subscribers to History get the current history once
- Expanding the keyframe selection with an already selected keyframe doesn't add it twice
- Snapping can snap to a snap time of zero
This commit is contained in:
RobertBeekman authored and GitHub committed 2026-10-24 16:17:05 +02:00
1 parent 63186ee06d
commit 295038f338
22 files changed
+140 -133

No files matched your search

@@ -219,15 +219,15 @@ public class KeyframeCommandTests : ProfileEditorTestBase
}
[Fact]
public void ToggleLayerPropertyKeyframes_Undo_DoesNotRememberWhatItWasBefore()
public void ToggleLayerPropertyKeyframes_Undo_RestoresWhatItWasBefore()
{
ToggleLayerPropertyKeyframes<float> enable = new(_opacity, true, TimeSpan.Zero);
enable.Execute();
enable.Undo();
// Pinned as-is: undo sets the opposite of what the command did rather than restoring the earlier state, so
// "enabling" keyframes that were already enabled turns them off when undone
_opacity.KeyframesEnabled.ShouldBeFalse();
// "Enabling" keyframes that were already enabled leaves them enabled when undone
_opacity.KeyframesEnabled.ShouldBeTrue();
_opacity.Keyframes.ShouldBe([_first, _second]);
}
}