.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_UndoRedo: UndoRedo ======== **Inherits:** :ref:`Object` **Category:** Core Brief Description ----------------- Helper to manage UndoRedo in the editor or custom tools. Member Functions ---------------- +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`add_do_method` **(** :ref:`Object` object, :ref:`String` method **)** vararg | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_do_property` **(** :ref:`Object` object, :ref:`String` property, :ref:`Variant` value **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_do_reference` **(** :ref:`Object` object **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`add_undo_method` **(** :ref:`Object` object, :ref:`String` method **)** vararg | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_undo_property` **(** :ref:`Object` object, :ref:`String` property, :ref:`Variant` value **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_undo_reference` **(** :ref:`Object` object **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_history` **(** **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`commit_action` **(** **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`create_action` **(** :ref:`String` name, :ref:`int` merge_mode=null **)** | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_current_action_name` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_version` **(** **)** const | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Numeric Constants ----------------- - **MERGE_DISABLE** = **0** - **MERGE_ENDS** = **1** - **MERGE_ALL** = **2** Description ----------- Helper to manage UndoRedo in the editor or custom tools. It works by storing calls to functions in both 'do' an 'undo' lists. Common behavior is to create an action, then add do/undo calls to functions or property changes, then committing the action. Member Function Description --------------------------- .. _class_UndoRedo_add_do_method: - :ref:`Variant` **add_do_method** **(** :ref:`Object` object, :ref:`String` method **)** vararg .. _class_UndoRedo_add_do_property: - void **add_do_property** **(** :ref:`Object` object, :ref:`String` property, :ref:`Variant` value **)** Set a property with a custom value. .. _class_UndoRedo_add_do_reference: - void **add_do_reference** **(** :ref:`Object` object **)** Add a 'do' reference 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. .. _class_UndoRedo_add_undo_method: - :ref:`Variant` **add_undo_method** **(** :ref:`Object` object, :ref:`String` method **)** vararg .. _class_UndoRedo_add_undo_property: - void **add_undo_property** **(** :ref:`Object` object, :ref:`String` property, :ref:`Variant` value **)** Undo setting of a property with a custom value. .. _class_UndoRedo_add_undo_reference: - void **add_undo_reference** **(** :ref:`Object` object **)** Add an 'undo' reference 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!). .. _class_UndoRedo_clear_history: - void **clear_history** **(** **)** Clear the undo/redo history and associated references. .. _class_UndoRedo_commit_action: - void **commit_action** **(** **)** Commit the action. All 'do' methods/properties are called/set when this function is called. .. _class_UndoRedo_create_action: - void **create_action** **(** :ref:`String` name, :ref:`int` merge_mode=null **)** Create a new action. After this is called, do all your calls to :ref:`add_do_method`, :ref:`add_undo_method`, :ref:`add_do_property` and :ref:`add_undo_property`. .. _class_UndoRedo_get_current_action_name: - :ref:`String` **get_current_action_name** **(** **)** const Get the name of the current action. .. _class_UndoRedo_get_version: - :ref:`int` **get_version** **(** **)** const Get the version, each time a new action is committed, the version number of the UndoRedo is increased automatically. This is useful mostly to check if something changed from a saved version.