Navigation
API > API/Plugins > API/Plugins/IKRig > API/Plugins/IKRig/FIKRetargetOpSettingsBase
Description
NOTE ON RETARGET OP POSTLOAD() / SERIALIZE() BEHAVIOR: If custom op settings require load-patching for backwards compatibility, it is NOT enough to rely on the archive being tagged with custom versioning from the UIKRetargeter itself. This is because these settings structs can be stored OUTSIDE of the retargeter (ie, in BP classes), which means they must take full control of their own back compatibility.
BUT, because the settings are also stored as FInstancedStruct inside the retarget asset, and because these instanced structs do not run custom serialization, the patch must ALSO be applied explicitly from within FIKRetargetOpBase::PostLoad().
This leads us to this recommended pattern for op settings that need serialization patches:
Override virtual FIKRetargetOpSettingsBase::PostLoad() in your custom settings struct. This will be called by the retargeter to apply patching for any op settings stored in the asset.
Add the type trait WithSerializer and implement bool MyOp::Serialize().
Call SerializeOpWithVersion() within the custom MyOp::Serialize() This will ensure the settings are saved with a custom version and it will call OpSettings::PostLoad() after loading
Following this pattern ensures that op settings are properly patched both when they are stored in a retarget asset as an instanced struct AND if they are stored alone as a BP variable.
| Name | SerializeOpWithVersion |
| Type | function |
| Header File | /Engine/Plugins/Animation/IKRig/Source/IKRig/Public/Retargeter/IKRetargetOps.h |
| Include Path | #include "Retargeter/IKRetargetOps.h" |
template<typename T>
static bool SerializeOpWithVersion
(
FArchive & Ar,
T & Self
)