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

@@ -173,15 +173,13 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
/// </summary>
public void UpdateEventNode(bool updateScript)
{
if (EventPath == null)
Type? pathType = EventPath?.GetPropertyType();
if (EventPath != null && pathType == null)
return;
Type? pathType = EventPath.GetPropertyType();
if (pathType == null)
return;
// Create an event node if the path type is a data model event
if (pathType.IsAssignableTo(typeof(IDataModelEvent)))
// Create an event node if the path type is a data model event, without a path go back to the event node a new
// condition starts with
if (pathType == null || pathType.IsAssignableTo(typeof(IDataModelEvent)))
{
EventConditionEventStartNode eventNode;
// Ensure the start node is an event node
+18
View File
@@ -857,6 +857,24 @@ public sealed class Layer : RenderProfileElement
ActivateLayerBrush();
}
/// <summary>
/// Removes the current layer brush, leaving the layer without a brush
/// </summary>
public void RemoveLayerBrush()
{
if (LayerBrush == null)
return;
BaseLayerBrush oldLayerBrush = LayerBrush;
General.BrushReference.SetCurrentValue(null!);
LayerBrush = null;
// Don't dispose the brush, only disable it
// That way an undo-action does not need to worry about disposed brushes
oldLayerBrush.InternalDisable();
ActivateLayerBrush();
}
private void ActivateLayerBrush()
{
try