godotengine / godotengine/godot-docs
EditorUndoRedoManager.create_action() needs more context
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
4.2.2, 4.3
**URL to the documentation page:**
https://docs.godotengine.org/en/stable/classes/class_editorundoredomanager.html#class-editorundoredomanager-method-create-action
**Issue description:**
EditorUndoRedoManager.create_action() defines a custom_context parameter and states only this information:
`If custom_context object is provided, it will be used for deducing target history (instead of using the first operation).`
@KoBeWi here provides further explanation that should be added.
https://github.com/godotengine/godot-proposals/issues/2153#issuecomment-1685358047
> If the object can be identified as part of a scene, the action will be performed in the context of the scene and mark it as dirty.
> Scene actions show as white in History dock, global actions show with "accent color"
> Unlike scene actions, the global actions only make the project dirty (you can see * in the Godot's title bar).
The documentation should be expanded with this additional information, which we were able to use in order to link Terrain3D to all of our EditorUndoRedoManager actions which now mark the scene as unsaved without having to implement `_get_unsaved_status()`. https://github.com/TokisanGames/Terrain3D/pull/508
However note that the above seems contradictory and should be verified for accuracy:
* 'global actions mark the scene dirty, scene actions don't.' \*\*
* 'If an object can be identified, actions are done in scene context'
* 'Scene actions appear white'
\*\* I think this might be the opposite. We linked Terrain3D to our actions, the history is white, an undo action now causes our scenes to be dirty. Before this link, our custom_context was null, our history was still white, but the scenes were not marked as dirty.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.