-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add very basic skin editor undo / redo support #22506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally code seems inoffensive on a read-through, some structure issues from me though
namespace osu.Game.Screens.Edit | ||
{ | ||
/// <summary> | ||
/// Tracks changes to the <see cref="Editor"/>. | ||
/// </summary> | ||
public partial class EditorChangeHandler : TransactionalCommitComponent, IEditorChangeHandler | ||
public abstract partial class EditorChangeHandler : TransactionalCommitComponent, IEditorChangeHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the way this is being abstracted away further, I'm not sure that the namespace or the xmldoc here make much sense.
Namespace comment also applies to IEditorChangeHandler
and TransactionalCommitComponent
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly wasn't sure if we should still keep the underlying TransactionalCommitComponent
, but left it there to reduce changes for the time being. I'd be okay with moving this to another namespace, but I'm honestly not sure where they should exist. Open to suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave this where it is until the dust settles and we see the final shape of the skin editor better for now I guess.
I can break this pretty hard using the "scene library" toolbar.
2023-02-06.19-08-59.mp4It appears that the initial save in the skin editor change handler fails when doing this (resulting json is Careful not to trip over #22263 and #17391 when reproducing. I also got this to crash once on a mismatched |
Never mind, I repro'd the second thing immediately.
2023-02-06.19-17-28.mp4Crash trace is, unsurprisingly:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
This actually goes a bit deeper. osu/osu.Game/Overlays/SkinEditor/SkinBlueprintContainer.cs Lines 56 to 62 in 26efb8e
Edit: And of course, the |
… be closer to first change
…n inside `SkinEditor` directly Seems saner? Maybe?
I've fixed both the issues you found. See what you think of the solutions. |
Changes look okay (the On a quick look the first one may not be very easy to fix, may just need to update assertions? Second issue should be trivial to resolve (not sure where that conditional access in the ctor there even comes from). |
Seems solid enough for an initial implementation as far as I'm concerned. I did find one issue with the "Revert to default" option and how it interacts with undo, but I think it's relatively minor and don't really want to be blocking this PR too much longer, so I'll open a follow-up issue for it. |
Tracking aforementioned issue as #22562 |
I made this work and it seems like it might be okay to get it in in this state? I'm hesitant to write tests or spend more time on this due to the fact that #22388 will likely require deep modifications in how change handling is done (assuming we move every target container to a single json structure or similar).
Put another way, I wasn't sure if I should work on undo/redo support before considering the aforementioned restructure, but getting it working to a MVP level was quick enough that I propose we get this out to users so they can benefit from it while the larger restructuring tasks happen in the background.
Of note: if any new elements are added or removed, all elements will be recycled. This is the simplest way of handling this, especially since we don't have any ID for tracking movement of elements around. There may be room to use
SkinnableTargetContainer
's bindableComponents
list to better handle this in the future.osu.2023-02-03.at.10.02.43.mp4
PRing this to get some initial feedback on direction.
Issues of note:
SettingsSourceAttribute
s do not trigger state saves.