Merge pull request #106121 from KoBeWi/you_can_undo_but_you_can't_save

Allow undoredo actions to not make history unsaved
This commit is contained in:
Thaddeus Crews
2025-05-14 09:44:11 -05:00
11 changed files with 93 additions and 11 deletions

View File

@@ -96,11 +96,13 @@
<param index="1" name="merge_mode" type="int" enum="UndoRedo.MergeMode" default="0" />
<param index="2" name="custom_context" type="Object" default="null" />
<param index="3" name="backward_undo_ops" type="bool" default="false" />
<param index="4" name="mark_unsaved" type="bool" default="true" />
<description>
Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property], and [method add_undo_property], then commit the action with [method commit_action].
The way actions are merged is dictated by the [param merge_mode] argument. See [enum UndoRedo.MergeMode] for details.
If [param custom_context] object is provided, it will be used for deducing target history (instead of using the first operation).
The way undo operation are ordered in actions is dictated by [param backward_undo_ops]. When [param backward_undo_ops] is [code]false[/code] undo option are ordered in the same order they were added. Which means the first operation to be added will be the first to be undone.
If [param mark_unsaved] is [code]false[/code], the action will not mark the history as unsaved. This is useful for example for actions that change a selection, or a setting that will be saved automatically. Otherwise, this should be left to [code]true[/code] if the action requires saving by the user or if it can cause data loss when left unsaved.
</description>
</method>
<method name="force_fixed_history">