mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
556 lines
28 KiB
ReStructuredText
556 lines
28 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_UndoRedo:
|
|
|
|
UndoRedo
|
|
========
|
|
|
|
**Hereda:** :ref:`Object<class_Object>`
|
|
|
|
Proporciona una interfaz de alto nivel para implementar operaciones de deshacer y rehacer.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
UndoRedo works by registering methods and property changes inside "actions". You can create an action, then provide ways to do and undo this action using function calls and property changes, then commit the action.
|
|
|
|
When an action is committed, all of the ``do_*`` methods will run. If the :ref:`undo()<class_UndoRedo_method_undo>` method is used, the ``undo_*`` methods will run. If the :ref:`redo()<class_UndoRedo_method_redo>` method is used, once again, all of the ``do_*`` methods will run.
|
|
|
|
Here's an example on how to add an action:
|
|
|
|
|
|
.. tabs::
|
|
|
|
.. code-tab:: gdscript
|
|
|
|
var undo_redo = UndoRedo.new()
|
|
|
|
func do_something():
|
|
pass # Put your code here.
|
|
|
|
func undo_something():
|
|
pass # Put here the code that reverts what's done by "do_something()".
|
|
|
|
func _on_my_button_pressed():
|
|
var node = get_node("MyNode2D")
|
|
undo_redo.create_action("Move the node")
|
|
undo_redo.add_do_method(do_something)
|
|
undo_redo.add_undo_method(undo_something)
|
|
undo_redo.add_do_property(node, "position", Vector2(100, 100))
|
|
undo_redo.add_undo_property(node, "position", node.position)
|
|
undo_redo.commit_action()
|
|
|
|
.. code-tab:: csharp
|
|
|
|
private UndoRedo _undoRedo;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_undoRedo = new UndoRedo();
|
|
}
|
|
|
|
public void DoSomething()
|
|
{
|
|
// Put your code here.
|
|
}
|
|
|
|
public void UndoSomething()
|
|
{
|
|
// Put here the code that reverts what's done by "DoSomething()".
|
|
}
|
|
|
|
private void OnMyButtonPressed()
|
|
{
|
|
var node = GetNode<Node2D>("MyNode2D");
|
|
_undoRedo.CreateAction("Move the node");
|
|
_undoRedo.AddDoMethod(new Callable(this, MethodName.DoSomething));
|
|
_undoRedo.AddUndoMethod(new Callable(this, MethodName.UndoSomething));
|
|
_undoRedo.AddDoProperty(node, "position", new Vector2(100, 100));
|
|
_undoRedo.AddUndoProperty(node, "position", node.Position);
|
|
_undoRedo.CommitAction();
|
|
}
|
|
|
|
|
|
|
|
Before calling any of the ``add_(un)do_*`` methods, you need to first call :ref:`create_action()<class_UndoRedo_method_create_action>`. Afterwards you need to call :ref:`commit_action()<class_UndoRedo_method_commit_action>`.
|
|
|
|
If you don't need to register a method, you can leave :ref:`add_do_method()<class_UndoRedo_method_add_do_method>` and :ref:`add_undo_method()<class_UndoRedo_method_add_undo_method>` out; the same goes for properties. You can also register more than one method/property.
|
|
|
|
If you are making an :ref:`EditorPlugin<class_EditorPlugin>` and want to integrate into the editor's undo history, use :ref:`EditorUndoRedoManager<class_EditorUndoRedoManager>` instead.
|
|
|
|
If you are registering multiple properties/method which depend on one another, be aware that by default undo operation are called in the same order they have been added. Therefore instead of grouping do operation with their undo operations it is better to group do on one side and undo on the other as shown below.
|
|
|
|
|
|
.. tabs::
|
|
|
|
.. code-tab:: gdscript
|
|
|
|
undo_redo.create_action("Add object")
|
|
|
|
# DO
|
|
undo_redo.add_do_method(_create_object)
|
|
undo_redo.add_do_method(_add_object_to_singleton)
|
|
|
|
# UNDO
|
|
undo_redo.add_undo_method(_remove_object_from_singleton)
|
|
undo_redo.add_undo_method(_destroy_that_object)
|
|
|
|
undo_redo.commit_action()
|
|
|
|
.. code-tab:: csharp
|
|
|
|
_undo_redo.CreateAction("Add object");
|
|
|
|
// DO
|
|
_undo_redo.AddDoMethod(new Callable(this, MethodName.CreateObject));
|
|
_undo_redo.AddDoMethod(new Callable(this, MethodName.AddObjectToSingleton));
|
|
|
|
// UNDO
|
|
_undo_redo.AddUndoMethod(new Callable(this, MethodName.RemoveObjectFromSingleton));
|
|
_undo_redo.AddUndoMethod(new Callable(this, MethodName.DestroyThatObject));
|
|
|
|
_undo_redo.CommitAction();
|
|
|
|
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Propiedades
|
|
----------------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------+-----------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`max_steps<class_UndoRedo_property_max_steps>` | ``0`` |
|
|
+-----------------------+-----------------------------------------------------+-------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_do_method<class_UndoRedo_method_add_do_method>`\ (\ callable\: :ref:`Callable<class_Callable>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_do_property<class_UndoRedo_method_add_do_property>`\ (\ object\: :ref:`Object<class_Object>`, property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_do_reference<class_UndoRedo_method_add_do_reference>`\ (\ object\: :ref:`Object<class_Object>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_undo_method<class_UndoRedo_method_add_undo_method>`\ (\ callable\: :ref:`Callable<class_Callable>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_undo_property<class_UndoRedo_method_add_undo_property>`\ (\ object\: :ref:`Object<class_Object>`, property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_undo_reference<class_UndoRedo_method_add_undo_reference>`\ (\ object\: :ref:`Object<class_Object>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_history<class_UndoRedo_method_clear_history>`\ (\ increase_version\: :ref:`bool<class_bool>` = true\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`commit_action<class_UndoRedo_method_commit_action>`\ (\ execute\: :ref:`bool<class_bool>` = true\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`create_action<class_UndoRedo_method_create_action>`\ (\ name\: :ref:`String<class_String>`, merge_mode\: :ref:`MergeMode<enum_UndoRedo_MergeMode>` = 0, backward_undo_ops\: :ref:`bool<class_bool>` = false\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`end_force_keep_in_merge_ends<class_UndoRedo_method_end_force_keep_in_merge_ends>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_action_name<class_UndoRedo_method_get_action_name>`\ (\ id\: :ref:`int<class_int>`\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_current_action<class_UndoRedo_method_get_current_action>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_current_action_name<class_UndoRedo_method_get_current_action_name>`\ (\ ) |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_history_count<class_UndoRedo_method_get_history_count>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_version<class_UndoRedo_method_get_version>`\ (\ ) |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_redo<class_UndoRedo_method_has_redo>`\ (\ ) |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_undo<class_UndoRedo_method_has_undo>`\ (\ ) |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_committing_action<class_UndoRedo_method_is_committing_action>`\ (\ ) |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`redo<class_UndoRedo_method_redo>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`start_force_keep_in_merge_ends<class_UndoRedo_method_start_force_keep_in_merge_ends>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`undo<class_UndoRedo_method_undo>`\ (\ ) |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Señales
|
|
--------------
|
|
|
|
.. _class_UndoRedo_signal_version_changed:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**version_changed**\ (\ ) :ref:`🔗<class_UndoRedo_signal_version_changed>`
|
|
|
|
Llamado cuando :ref:`undo()<class_UndoRedo_method_undo>` o :ref:`redo()<class_UndoRedo_method_redo>` fue llamado.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumeraciones
|
|
--------------------------
|
|
|
|
.. _enum_UndoRedo_MergeMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **MergeMode**: :ref:`🔗<enum_UndoRedo_MergeMode>`
|
|
|
|
.. _class_UndoRedo_constant_MERGE_DISABLE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`MergeMode<enum_UndoRedo_MergeMode>` **MERGE_DISABLE** = ``0``
|
|
|
|
Hace que las operaciones de "hacer"/"deshacer" se mantengan en acciones separadas.
|
|
|
|
.. _class_UndoRedo_constant_MERGE_ENDS:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`MergeMode<enum_UndoRedo_MergeMode>` **MERGE_ENDS** = ``1``
|
|
|
|
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.
|
|
|
|
.. _class_UndoRedo_constant_MERGE_ALL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`MergeMode<enum_UndoRedo_MergeMode>` **MERGE_ALL** = ``2``
|
|
|
|
Merges this action with the previous one if they have the same name.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descripciones de Propiedades
|
|
--------------------------------------------------------
|
|
|
|
.. _class_UndoRedo_property_max_steps:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **max_steps** = ``0`` :ref:`🔗<class_UndoRedo_property_max_steps>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_max_steps**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_max_steps**\ (\ )
|
|
|
|
The maximum number of steps that can be stored in the undo/redo history. If the number of stored steps exceeds this limit, older steps are removed from history and can no longer be reached by calling :ref:`undo()<class_UndoRedo_method_undo>`. A value of ``0`` or lower means no limit.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_UndoRedo_method_add_do_method:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_do_method**\ (\ callable\: :ref:`Callable<class_Callable>`\ ) :ref:`🔗<class_UndoRedo_method_add_do_method>`
|
|
|
|
Registra una :ref:`Callable<class_Callable>` que se llamará cuando se confirme la acción.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_add_do_property:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_do_property**\ (\ object\: :ref:`Object<class_Object>`, property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_UndoRedo_method_add_do_property>`
|
|
|
|
Registra una ``property`` que cambiará su valor a ``value`` cuando se confirme la acción.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_add_do_reference:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_do_reference**\ (\ object\: :ref:`Object<class_Object>`\ ) :ref:`🔗<class_UndoRedo_method_add_do_reference>`
|
|
|
|
Registra una referencia a un objeto que se borrará si se elimina el historial de "hacer". Esto es útil para los objetos añadidos por la acción "hacer" y eliminados por la acción "deshacer".
|
|
|
|
Cuando se elimina el historial de "hacer", si el objeto es un :ref:`RefCounted<class_RefCounted>`, se liberará la referencia. De lo contrario, se liberará. No lo utilices para los recursos.
|
|
|
|
::
|
|
|
|
var node = Node2D.new()
|
|
undo_redo.create_action("Añadir nodo")
|
|
undo_redo.add_do_method(add_child.bind(node))
|
|
undo_redo.add_do_reference(node)
|
|
undo_redo.add_undo_method(remove_child.bind(node))
|
|
undo_redo.commit_action()
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_add_undo_method:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_undo_method**\ (\ callable\: :ref:`Callable<class_Callable>`\ ) :ref:`🔗<class_UndoRedo_method_add_undo_method>`
|
|
|
|
Registra un :ref:`Callable<class_Callable>` que se llamará cuando se deshaga la acción.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_add_undo_property:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_undo_property**\ (\ object\: :ref:`Object<class_Object>`, property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_UndoRedo_method_add_undo_property>`
|
|
|
|
Registra una ``property`` que cambiaría su valor a ``value`` cuando se deshaga la acción.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_add_undo_reference:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_undo_reference**\ (\ object\: :ref:`Object<class_Object>`\ ) :ref:`🔗<class_UndoRedo_method_add_undo_reference>`
|
|
|
|
Registra una referencia a un objeto que se borrará si se elimina el historial de "deshacer". Esto es útil para los objetos añadidos por la acción "deshacer" y eliminados por la acción "hacer".
|
|
|
|
Cuando se elimina el historial de "deshacer", si el objeto es un :ref:`RefCounted<class_RefCounted>`, se liberará la referencia. De lo contrario, se liberará. No lo utilices para los recursos.
|
|
|
|
::
|
|
|
|
var node = $Node2D
|
|
undo_redo.create_action("Eliminar nodo")
|
|
undo_redo.add_do_method(remove_child.bind(node))
|
|
undo_redo.add_undo_method(add_child.bind(node))
|
|
undo_redo.add_undo_reference(node)
|
|
undo_redo.commit_action()
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_clear_history:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_history**\ (\ increase_version\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_UndoRedo_method_clear_history>`
|
|
|
|
Borra el historial de deshacer/rehacer y las referencias asociadas.
|
|
|
|
Pasar ``false`` a ``increase_version`` evitará que el número de versión se incremente cuando se borre el historial.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_commit_action:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **commit_action**\ (\ execute\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_UndoRedo_method_commit_action>`
|
|
|
|
Confirma la acción. Si ``execute`` es ``true`` (que lo es por defecto), todos los métodos/propiedades "hacer" son llamados/establecidos cuando se llama a esta función.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_create_action:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **create_action**\ (\ name\: :ref:`String<class_String>`, merge_mode\: :ref:`MergeMode<enum_UndoRedo_MergeMode>` = 0, backward_undo_ops\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_UndoRedo_method_create_action>`
|
|
|
|
Create a new action. After this is called, do all your calls to :ref:`add_do_method()<class_UndoRedo_method_add_do_method>`, :ref:`add_undo_method()<class_UndoRedo_method_add_undo_method>`, :ref:`add_do_property()<class_UndoRedo_method_add_do_property>`, and :ref:`add_undo_property()<class_UndoRedo_method_add_undo_property>`, then commit the action with :ref:`commit_action()<class_UndoRedo_method_commit_action>`.
|
|
|
|
The way actions are merged is dictated by ``merge_mode``.
|
|
|
|
The way undo operation are ordered in actions is dictated by ``backward_undo_ops``. When ``backward_undo_ops`` is ``false`` 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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_end_force_keep_in_merge_ends:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **end_force_keep_in_merge_ends**\ (\ ) :ref:`🔗<class_UndoRedo_method_end_force_keep_in_merge_ends>`
|
|
|
|
Stops marking operations as to be processed even if the action gets merged with another in the :ref:`MERGE_ENDS<class_UndoRedo_constant_MERGE_ENDS>` mode. See :ref:`start_force_keep_in_merge_ends()<class_UndoRedo_method_start_force_keep_in_merge_ends>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_get_action_name:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`String<class_String>` **get_action_name**\ (\ id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_UndoRedo_method_get_action_name>`
|
|
|
|
Obtiene el nombre de la acción de su índice.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_get_current_action:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_current_action**\ (\ ) :ref:`🔗<class_UndoRedo_method_get_current_action>`
|
|
|
|
Obtiene el índice de la acción actual.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_get_current_action_name:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`String<class_String>` **get_current_action_name**\ (\ ) |const| :ref:`🔗<class_UndoRedo_method_get_current_action_name>`
|
|
|
|
Gets the name of the current action, equivalent to ``get_action_name(get_current_action())``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_get_history_count:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_history_count**\ (\ ) :ref:`🔗<class_UndoRedo_method_get_history_count>`
|
|
|
|
Devuelve cuántos elementos hay en el historial.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_get_version:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_version**\ (\ ) |const| :ref:`🔗<class_UndoRedo_method_get_version>`
|
|
|
|
Consigue la versión. Cada vez que se comete una nueva acción, el número de versión de **UndoRedo**\ s se incrementa automáticamente.
|
|
|
|
Esto es útil sobre todo para comprobar si algo cambió de una versión guardada.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_has_redo:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_redo**\ (\ ) |const| :ref:`🔗<class_UndoRedo_method_has_redo>`
|
|
|
|
Devuelve ``true`` si una acción de "redo" está disponible.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_has_undo:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_undo**\ (\ ) |const| :ref:`🔗<class_UndoRedo_method_has_undo>`
|
|
|
|
Devuelve ``true`` si se dispone de una acción de "deshacer".
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_is_committing_action:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_committing_action**\ (\ ) |const| :ref:`🔗<class_UndoRedo_method_is_committing_action>`
|
|
|
|
Devuelve ``true`` si el **UndoRedo** está actualmente cometiendo la acción, es decir, ejecutando su método "hacer" o cambio de propiedad (ver :ref:`commit_action()<class_UndoRedo_method_commit_action>`).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_redo:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **redo**\ (\ ) :ref:`🔗<class_UndoRedo_method_redo>`
|
|
|
|
Rehacer la última acción.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_start_force_keep_in_merge_ends:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **start_force_keep_in_merge_ends**\ (\ ) :ref:`🔗<class_UndoRedo_method_start_force_keep_in_merge_ends>`
|
|
|
|
Marks the next "do" and "undo" operations to be processed even if the action gets merged with another in the :ref:`MERGE_ENDS<class_UndoRedo_constant_MERGE_ENDS>` mode. Return to normal operation using :ref:`end_force_keep_in_merge_ends()<class_UndoRedo_method_end_force_keep_in_merge_ends>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_UndoRedo_method_undo:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **undo**\ (\ ) :ref:`🔗<class_UndoRedo_method_undo>`
|
|
|
|
Deshace la última acción.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Normalmente, este método debería ser sobreescrito por el usuario para que tenga algún efecto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Este método no tiene efectos secundarios. No modifica ninguna de las variables miembro de la instancia.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Este método permite agregar cualquier número de argumentos después de los descritos aquí.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Este método se utiliza para construir un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Este método no necesita una instancia para ser llamado, por lo que puede llamarse directamente utilizando el nombre de la clase.)`
|
|
.. |operator| replace:: :abbr:`operator (Este método describe un operador válido para usar con este tipo como operando izquierdo.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Este valor es un entero compuesto como una máscara de bits de las siguientes banderas.)`
|
|
.. |void| replace:: :abbr:`void (Sin valor de retorno.)`
|