![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Change.h>
Inheritance diagram for FChange:Public Types | |
| enum class | EChangeStyle { InPlaceSwap , CommandPattern } |
Public Member Functions | |
| virtual EChangeStyle | GetChangeType ()=0 |
| virtual TUniquePtr< FChange > | Execute (UObject *Object)=0 |
| virtual void | Apply (UObject *Object)=0 |
| virtual void | Revert (UObject *Object)=0 |
| virtual bool | HasExpired (UObject *Object) const |
| virtual void | AddReferencedObjects (FReferenceCollector &Collector) |
| virtual FString | ToString () const =0 |
| virtual CORE_API void | PrintToLog (FFeedbackContext &FeedbackContext, const int32 IndentLevel=0) |
| virtual SIZE_T | GetSize () const |
| virtual | ~FChange () |
Protected Member Functions | |
| FChange () | |
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.
|
strong |
|
inlinevirtual |
Virtual destructor
|
inlineprotected |
Protected default constructor
|
inlinevirtual |
Used by GC to collect referenced objects.
Makes the change to the object
Implemented in FSwapChange, FMeshChange, FMeshReplacementChange, FMeshVertexChange, FFloatParameterProxyChange, FTransformProxyChange, FToolCommandChangeSequence, FComponentWorldTransformChange, TWrappedToolCommandChange< ChangeType >, FBeginToolChange, FActivateToolChange, and FToolChangeWrapperChange.
|
pure virtual |
Makes the change to the object, returning a new change that can be used to perfectly roll back this change
Implemented in FCommandChange, and FCompoundChange.
|
pure virtual |
What style of change is this
Implemented in FSwapChange, and FCommandChange.
Gets the approximate number of bytes this change takes up in memory.
Used to
A typical implementation returns the size of any dynamically allocated memory, such GetAllocatedSize called on its containers (TArray, TSet, TMap). You should consider adding sizeof(FMyChange), if it's not insignificant. Remember: it's enough to return the approx. allocation size; it's unreasonable to expect every FChange implementation to return the exact amount, which also is not needed for the purpose of this function. Keep in mind, that for nested containers you need to call GetAllocatedSize recursively, e.g. for a "TArray<TArray<T>> Array" you'd need to return "Array.GetAllocatedSize() + Algo::Accumulate(Array, 0, [](const TArray<T>& A){ return A.GetAllocatedSize(); })".
This function is introduced in 5.7: too many FChange implementations exist so this function will need to be implemented gradually.
Reimplemented in FBeginToolChange, FActivateToolChange, and FToolChangeWrapperChange.
|
virtual |
Prints this change to the log, including sub-changes if there are any. For compound changes, there might be multiple lines. You should not need to override this function.
Reimplemented in FCompoundChange.
Reverts change to the object
Implemented in FSwapChange, FMeshChange, FMeshReplacementChange, FMeshVertexChange, FFloatParameterProxyChange, FTransformProxyChange, FToolCommandChangeSequence, FComponentWorldTransformChange, TWrappedToolCommandChange< ChangeType >, FBeginToolChange, FActivateToolChange, and FToolChangeWrapperChange.
|
pure virtual |
Describes this change (for debugging)
Implemented in FCompoundChange, FMeshChange, FMeshReplacementChange, FMeshVertexChange, FFloatParameterProxyChange, FTransformProxyChange, FToolCommandChangeSequence, FComponentWorldTransformChange, FToolCommandChange, TWrappedToolCommandChange< ChangeType >, FBeginToolChange, FActivateToolChange, and FToolChangeWrapperChange.