Skip to content

Commit 491d3a2

Browse files
committed
Clarify UndoRedo MergeMode and add_*_reference docs
1 parent 7e4c150 commit 491d3a2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/classes/UndoRedo.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
<return type="void" />
113113
<param index="0" name="object" type="Object" />
114114
<description>
115-
Register a reference for "do" that will be erased if the "do" history is lost. This is useful mostly for new nodes created for the "do" call. Do not use for resources.
115+
Register a reference to an object that will be erased if the "do" history is deleted. This is useful for objects added by the "do" action and removed by the "undo" action.
116+
When the "do" history is deleted, if the object is a [RefCounted], it will be unreferenced. Otherwise, it will be freed. Do not use for resources.
116117
[codeblock]
117118
var node = Node2D.new()
118119
undo_redo.create_action("Add node")
@@ -143,7 +144,8 @@
143144
<return type="void" />
144145
<param index="0" name="object" type="Object" />
145146
<description>
146-
Register a reference for "undo" that will be erased if the "undo" history is lost. This is useful mostly for nodes removed with the "do" call (not the "undo" call!).
147+
Register a reference to an object that will be erased if the "undo" history is deleted. This is useful for objects added by the "undo" action and removed by the "do" action.
148+
When the "undo" history is deleted, if the object is a [RefCounted], it will be unreferenced. Otherwise, it will be freed. Do not use for resources.
147149
[codeblock]
148150
var node = $Node2D
149151
undo_redo.create_action("Remove node")
@@ -272,10 +274,10 @@
272274
Makes "do"/"undo" operations stay in separate actions.
273275
</constant>
274276
<constant name="MERGE_ENDS" value="1" enum="MergeMode">
275-
Makes so that the action's "undo" operations are from the first action created and the "do" operations are from the last subsequent action with the same name.
277+
Merges this action with the previous one if they have the same name. Keeps only the first action's "undo" operations and the last action's "do" operations. Useful for sequential changes to a single value.
276278
</constant>
277279
<constant name="MERGE_ALL" value="2" enum="MergeMode">
278-
Makes subsequent actions with the same name be merged into one.
280+
Merges this action with the previous one if they have the same name.
279281
</constant>
280282
</constants>
281283
</class>

0 commit comments

Comments
 (0)