Navigation
API > API/Runtime > API/Runtime/Core
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.
| Name | FChange |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/Change.h |
| Include Path | #include "Misc/Change.h" |
Syntax
class FChange
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FChange () |
Protected default constructor | Misc/Change.h | |
| Non-copyable. | Misc/Change.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FChange() |
Virtual destructor | Misc/Change.h |
Enums
Public
| Name | Remarks |
|---|---|
| EChangeStyle |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddReferencedObjects
(
FReferenceCollector& Collector |
Used by GC to collect referenced objects. | Misc/Change.h | |
void Apply
(
UObject* Object |
Makes the change to the object | Misc/Change.h | |
TUniquePtr< FChange > Execute
(
UObject* Object |
Makes the change to the object, returning a new change that can be used to perfectly roll back this change | Misc/Change.h | |
EChangeStyle GetChangeType() |
What style of change is this | Misc/Change.h | |
virtual SIZE_T GetSize () |
Gets the approximate number of bytes this change takes up in memory. | Misc/Change.h | |
virtual bool HasExpired
(
UObject* Object |
Misc/Change.h | ||
virtual void PrintToLog
(
FFeedbackContext& FeedbackContext, |
Prints this change to the log, including sub-changes if there are any. | Misc/Change.h | |
void Revert
(
UObject* Object |
Reverts change to the object | Misc/Change.h | |
FString ToString() |
Describes this change (for debugging) | Misc/Change.h |
Protected
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Misc/Change.h |