Live Link retargeting is currently performed by retargeting assets (Base class ULiveLinkRetargetAsset). The Live Link pose node has a pin for specifying the retarget asset to use. We provide a very simple remap asset (ULiveLinkRemapAsset) to allow mapping of transforms from Live Link on to a USkeleton. Below is an example of how to implement a retargeting asset.
A Live Link Retarget Asset has one function it needs to override:
BuildPoseForSubject(const FLiveLinkSubjectFrame& InFrame, TSharedPtr<FLiveLinkRetargetContext> InOutContext, FCompactPose& OutPose, FBlendedCurve& OutCurve)
This function takes:
- A LiveLinkSubjectFrame - the transform/skeleton as Live Link sees it, optionally buffered and interpolated.
- A FLiveLinkRetargetContext - Allows for retargeting instance data, as the ULiveLinkRetargetAsset will not be instanced for each use (can be customized by overriding CreateRetargetContext).
- An FCompactPose - This is the output pose from the retargeting FCompactPose is the format we use during animation evaluation.
- An FBlendedCurve - This is the output curve data. ULiveLinkRetargetAsset has a helper function BuildCurveData which will populate this from the supplied Live Link data.
Retarget Assets can be Blueprintable as well, allowing users to specify logic in Editor (where appropriate). This functionality is used by the Remap Asset to allow bone names to be transformed in the Editor.
Live Link Remap Asset
An example of what is required to create a new retarget asset can be found in the editor by looking at the following classes in /Engine/Plugins/Animation/LiveLink/Source/LiveLink:
In Editor, Remap Assets can be created by using the LiveLinkRemapAsset class type.
Inside the remap asset, you can override the function Get Remapped Bone Name.
This will enable you to transform the Bone Name in Editor.
In the example above, we are taking in Bone Name information from a Skeletal Mesh in Maya. That data is then being modified and mapped to the Bone Name naming convention in UE4.
For example in Maya, the naming convention used refers to our Bone Names as CharacterName:BoneName. In UE4, the Skeleton Asset uses just the BoneName portion. In order for Maya to stream data to the UE4 Skeleton, we use the Remap Asset and override the function Get Remapped Bone Name by splitting the string at the colon and only taking the string information following the colon, so just BoneName instead of CharacterName:BoneName.
In the Preview Scene Settings window, we then specify to use the Retarget Asset.