#rnx
#rb none
#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)
[CL 10870549 by ryan durand in Main branch]
A collection of major and minor optimizations to anim instance initialization.
Major:
- Added defered root node init. When an anim instance is set to init to refpose, this defers the first call to initialize the blend tree until just before the first Update() call, on a worker thread.
- Skip ConditionallyCacheBonesForState in state machines in the case where we would call CacheBones_AnyThread during first Initialize_AnyThread. This avoids duplicate work being done, as graph traversal counters will let through sychronization calls if they have yet to be updated (ie. their count is INDEX_NONE).
- Cache access to nodes that need pre-update, dynamic reset, one-time initialization, as well as state machines in the generated class to avoid iterating all anim nodes on initialization.
Minor:
- Cache access to node properties when re-linking nodes to avoid duplicate memory round-trips.
- Cache access to LUT size in FBaseBlendedCurve::GetValidElementCount, avoiding duplicate memory round-trips.
- Prevent FName rehashing from string (intended to strip whitespace) when initializing FBoneReferences.
- Cache access to AnimCurveMapping smart name container on USkeleton, preventing a TMap lookup every time we access the smart name container.
- USkeleton::GetCurveMetaData now uses a 'fast path' when accessing using smart name UID. In this case we can avoid the TMap lookup as the UID is always a direct index to metadata at runtime (slow path still applies in editor builds).
- Avoid calling FAnimNode_LayeredBoneBlend::ReinitializeBoneBlendWeights in Initialize_AnyThread, as CacheBones_AnyThread will be called straight after anyways.
- Cache access to curve UID count and LinkedBones array in FAnimNode_LayeredBoneBlend::ReinitializeBoneBlendWeights, avoiding duplicate memory round-trips.
Upgrade notes:
- Breaking change! Custom anim nodes that implement OnInitializeAnimInstance now need to return true for the new accessor NeedsOnInitializeAnimInstance to be called at init time.
- The meaning of HasPreUpdate and NeedsDynamicReset has changed slightly. Previously these were called at init time, so if their results were mutable it was possible to re-init an anim instance with new settings. Now they are called at CDO load time this is no longer possible.
#rb Martin.Wilson
#ROBOMERGE-SOURCE: CL 8686415 via CL 8686419 via CL 8689513
#ROBOMERGE-BOT: (v422-8689730)
[CL 8695271 by thomas sarkanen in Main branch]