BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.09k stars 3.41k forks source link

[Tooling] Support undo/redo #14042

Open carolhmj opened 1 year ago

carolhmj commented 1 year ago

This would improve user experience on NME, GUI Editor, etc... And a generic solution can be used in future tools.

carolhmj commented 1 year ago

Some forum requests for this: https://forum.babylonjs.com/t/add-shortcuts-to-undo-and-redo-in-the-gui-editor/42326 https://forum.babylonjs.com/t/nme-improvements/35266 https://forum.babylonjs.com/t/gui-editor-improvements-suggestion-feedback-parts-1-to-6/32704 https://forum.babylonjs.com/t/nodematerial-add-undo/30672/2

Pryme8 commented 1 year ago

I have a generic script for "Commands" that you could wrap all the existing functionality in pretty easy.

https://github.com/Pryme8/Doomish/blob/main/src/Editor/Commands/Command.ts

Not sure if this would do it for you, but it has worked in every project that I have made that needs undo redo.

You can see how its used by the editor here: https://github.com/Pryme8/Doomish/blob/main/src/Editor/Editor.ts#L295

and then a simple example command would be like this: https://github.com/Pryme8/Doomish/blob/main/src/Editor/Commands/Common/DeleteRoomCommand.ts Normally you just define them inline and not on a separate file like this, here is an example of that: https://github.com/Pryme8/Doomish/blob/main/src/Editor/Gizmos/Gizmos.ts#L91

This can also be tied into a notification system that stacks little popups to the user notifying them when they have ran/undone a command etc.

If you are interested let me know, if not no worries!

borismoyosa commented 11 months ago

Hi, I'm curious if there are any updates on this feature? It would really improve the ux of the editor :)

RaananW commented 11 months ago

This is still on our agenda. It is simply not that trivial with our current architecture. If we want to deliver something, we want to deliver it the best we can. We have no timeline on this, sadly.

borismoyosa commented 11 months ago

I understand, thanks for the reply!

Jeggery commented 6 months ago

https://github.com/Pryme8/Doomish/blob/main/src/Editor/Commands/Command.ts

The link you provided cannot be opened, I would like to refer to it

dennemark commented 5 months ago

Since NME etc. are mainly based on JSON it might be very simple to use immer and Json patches? Immer can generate changes and inverseChanges

Immer however produces immutable data structures. And every change on the json would need to be wrapped by immer then. But it is pretty convenient.

github-actions[bot] commented 4 months ago

This issue has been automatically staled because it has been inactive for more than 14 days. Please update to "unstale".

Jeggery commented 3 weeks ago

Are you making progress