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 committed 2026-10-20 09:47:43 +02:00
1 parent 0920cf8917
commit 55dc04163c
8 files changed
+60 -62

No files matched your search

@@ -14,8 +14,8 @@ namespace Artemis.UI.Shared.Services.ProfileEditor;
/// </summary>
public class ProfileEditorHistory
{
private readonly Subject<bool> _canRedo = new();
private readonly Subject<bool> _canUndo = new();
private readonly BehaviorSubject<bool> _canRedo = new(false);
private readonly BehaviorSubject<bool> _canUndo = new(false);
private readonly Stack<IProfileEditorCommand> _redoCommands = new();
private readonly Stack<IProfileEditorCommand> _undoCommands = new();
@@ -28,6 +28,9 @@ public class ProfileEditorHistory
ProfileConfiguration = profileConfiguration;
Execute = ReactiveCommand.Create<IProfileEditorCommand>(ExecuteEditorCommand);
// Whoever executes a command reports its failure (the profile editor service shows a dialog), without this
// ReactiveUI would also treat it as unhandled
Execute.ThrownExceptions.Subscribe(_ => { });
Undo = ReactiveCommand.Create(ExecuteUndo, CanUndo);
Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo);
}