UndoRedo

    Provides a high-level interface for implementing undo and redo operations.

    UndoRedo.swift:29
    class UndoRedo

    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 undo method is used, the undo_* methods will run. If the redo method is used, once again, all of the do_* methods will run.

    Here’s an example on how to add an action:

    Before calling any of the add_(un)do_* methods, you need to first call createAction(name:mergeMode:backwardUndoOps:). Afterwards you need to call commitAction(execute:).

    If you don’t need to register a method, you can leave addDoMethod(callable:) and addUndoMethod(callable:) out; the same goes for properties. You can also register more than one method/property.

    If you are making an EditorPlugin and want to integrate into the editor’s undo history, use 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.

    This object emits the following signals:

    Superclasses

    Citizens in SwiftGodot

    Conformances

    • protocol CustomStringConvertible

      A type with a customized textual representation.

    • protocol Equatable

      A type that can be compared for value equality.

    • protocol Hashable

      A type that can be hashed into a Hasher to produce an integer hash value.

    • protocol Identifiable<ID>

      A class of types whose instances hold the value of an entity with stable identity.

    • protocol VariantRepresentable

      Types that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.

    • protocol VariantStorable

      Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.

    Types

    Type members

    Instance members