FChange

[FChange](API\Runtime\Core\Misc\FChange) modifies a [UObject](API\Runtime\CoreUObject\UObject\UObject) and is meant to be used to implement undo/redo.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Misc/Change.h

Include

#include "Misc/Change.h"

Syntax

class FChange

Remarks

FChange modifies a UObject and is meant to be used to implement undo/redo. The change is embedded in an FTransaction which executes it instead of the standard serialization transaction (cannot be combined - see FTransaction).

The original FChange style (used by MeshEditor) was that calling Execute() would return a new FChange that applies the opposite action, and FTransaction would swap the two at each undo/redo step (eg a "DeleteObject" FChange would return a "CreateObject" FChange)

The alternative "Command Pattern"-style FChange calls Apply() and Revert() on a single FChange.

FChange may eventually be deprecated. You should subclass FSwapChange and FCommandChange to implement these different styles.

Constructors

Name Description

Protected function

FChange()

Protected default constructor

Destructors

Name Description

Public function Virtual

~FChange()

Virtual destructor

Functions

Name Description

Public function

void

 

Apply

(
    UObject* Object
)

Makes the change to the object

Public function

TUniquePtr< ...

 

Execute

(
    UObject* Object
)

Makes the change to the object, returning a new change that can be used to perfectly roll back this change

Public function

EChangeStyle

 

GetChangeType()

What style of change is this

Public function Virtual Const

bool

 

HasExpired

(
    UObject* Object
)

Public function Virtual

void

 

PrintToLog

(
    FFeedbackContext& FeedbackContext,
    const int32 IndentLevel
)

Prints this change to the log, including sub-changes if there are any.

Public function

void

 

Revert

(
    UObject* Object
)

Reverts change to the object

Public function Const

FString

 

ToString()

Describes this change (for debugging)

Enums

Name

Description

Public enum

EChangeStyle

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss