You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in the title. This will likely need a major refactor ☠️ , in traffic editor we were fortunate to have Qt's built in QAction based undo/redo workflow. For Site Editor, we should support some way of undoing a change.
Implementation Considerations
There are several ways to support undo/redo. The naivest way is to snapshot the current world state and keep it in a buffer. This will not scale well as worlds get more complex.
A less naive way would be to require that every forward edit has an equivalent inverse edit. For instance in Qt, this is exactly what the QAction class does. TBF, I'm not sure of the best way we would implement this particularly, with the context of bevy_impulse in mind.
Special care will have to be taken when we handle moving and deletion of objects as well.
If I remember correctly, one of the intentions behind using the ChangePlugin for submitting changes to components rather than writing directly to their value was exactly for this reason, to be able to intercept them and save an undo redo buffer (there is a comment about it).
Note however that the Change plugin does not cover everything. Specifically entity creation and deletion does not go through a Change plugin. However I can imagine intercepting the Delete events to undo / redo deletion and keeping track of what was created to undo creation.
There might also be other component changes that don't go through a Change plugin but I'm not 100% sure
Yeah I do believe that was one of the reasons to use the change plugin, IIRC that it does not cover movement (which is often the thing I want to undo most often).
Before proceeding, is there an existing issue or discussion for this?
Description
As mentioned in the title. This will likely need a major refactor ☠️ , in traffic editor we were fortunate to have Qt's built in
QAction
based undo/redo workflow. For Site Editor, we should support some way of undoing a change.Implementation Considerations
There are several ways to support undo/redo. The naivest way is to snapshot the current world state and keep it in a buffer. This will not scale well as worlds get more complex.
A less naive way would be to require that every forward edit has an equivalent inverse edit. For instance in Qt, this is exactly what the QAction class does. TBF, I'm not sure of the best way we would implement this particularly, with the context of
bevy_impulse
in mind.Special care will have to be taken when we handle moving and deletion of objects as well.
Alternatives
Saving intermediate
.ron
files ☠️ .Additional information
No response
Mildly related issue:
#216
The text was updated successfully, but these errors were encountered: