-
-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Describe the project you are working on
An editor plugin for editing dialogue sequences using a node graph.
Describe the problem or limitation you are having in your project
My GDScript editor plugin has a window for editing user-configurable variables to use in their dialogue sequences. Values changed in this window should also have support for undo-redo actions through EditorUndoRedoManager. While this window is open, however, CTRL+Z (undo) and CTRL+Y (redo) input actions are consumed by the window.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Other parts of the engine such as the Animation Library Editor window and the floating Shader Editor window solve this issue by calling undo() and redo() directly from EditorNode whenever receiving the "ui_undo" or "ui_redo" input actions.
https://github.com/godotengine/godot/blob/master/editor/animation/animation_library_editor.cpp#L999
EditorNode (which is not available to GDScript editor plugins) then directly uses EditorUndoRedoManager.undo().
https://github.com/godotengine/godot/blob/master/editor/editor_node.cpp#L3199
If EditorUndoRedoManager.undo() and EditorUndoRedoManager.redo() were exposed to GDScript editor plugins, I could replicate this behavior seen in the engine, but it is currently impossible to do.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
To my knowledge, this simply consists of binding the methods with ClassDB. I am unsure why EditorUndoRedoManager does not expose these methods while UndoRedo does.
If this enhancement will not be used often, can it be worked around with a few lines of script?
This enhancement would enable having undo/redo buttons in an editor plugin, as it would be trivial to inform EditorUndoRedoManager about alternate undo/redo requests. It seems to be currently impossible. A possible solution could be to capture the "ui_undo" and "ui_redo" input actions and parse them in the editor's viewport? I could not get this to work.
Is there a reason why this should be core and not an add-on in the asset library?
This is about improving the core GDScript EditorUndoRedoManager experience.