Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
MergeMode
UndoRedo.swift:31enum MergeMode
Cases
case disable
Makes “do”/“undo” operations stay in separate actions.
case ends
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.
case all
Makes subsequent actions with the same name be merged into one.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (23) members.
Type members
Instance members
var versionChanged: SimpleSignal
func addDoMethod(callable: Callable
) Register a
Callable
that will be called when the action is committed.func addDoProperty(object: Object?, property: StringName, value: Variant
) Register a
property
that would change its value tovalue
when the action is committed.func addDoReference(object: Object?
) 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.
func addUndoMethod(callable: Callable
) Register a
Callable
that will be called when the action is undone.func addUndoProperty(object: Object?, property: StringName, value: Variant
) Register a
property
that would change its value tovalue
when the action is undone.func addUndoReference(object: Object?
) 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!).
func clearHistory(increaseVersion: Bool
) Clear the undo/redo history and associated references.
func commitAction(execute: Bool
) Commit the action. If
execute
istrue
(which it is by default), all “do” methods/properties are called/set when this function is called.func createAction(name: String, mergeMode: UndoRedo.MergeMode, backwardUndoOps: Bool
) Create a new action. After this is called, do all your calls to
addDoMethod(callable:)
,addUndoMethod(callable:)
,addDoProperty(object:property:value:)
, andaddUndoProperty(object:property:value:)
, then commit the action withcommitAction(execute:)
.func endForceKeepInMergeEnds(
) Stops marking operations as to be processed even if the action gets merged with another in the .mergeEnds mode. See
startForceKeepInMergeEnds
.func getActionName(id: Int32
) -> String Gets the action name from its index.
func getCurrentAction(
) -> Int32 Gets the index of the current action.
func getCurrentActionName(
) -> String Gets the name of the current action, equivalent to
get_action_name(get_current_action())
.func getHistoryCount(
) -> Int32 Returns how many elements are in the history.
func getVersion(
) -> UInt Gets the version. Every time a new action is committed, the
UndoRedo
’s version number is increased automatically.func hasRedo(
) -> Bool Returns
true
if a “redo” action is available.func hasUndo(
) -> Bool Returns
true
if an “undo” action is available.func isCommittingAction(
) -> Bool Returns
true
if theUndoRedo
is currently committing the action, i.e. running its “do” method or property change (seecommitAction(execute:)
).func redo(
) -> Bool Redo the last action.
func startForceKeepInMergeEnds(
) Marks the next “do” and “undo” operations to be processed even if the action gets merged with another in the .mergeEnds mode. Return to normal operation using
endForceKeepInMergeEnds
.func undo(
) -> Bool Undo the last action.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
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 RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.