Hello there !
I am currently working on a system for stop animations to detect the right timing to start and for this I need to evaluate the float value of an animation curve (to find the right foot height for instance).
I started a quick script to do so but I can seem to understand how to find the UID of an animation curve, given I have its name.
Here a quick screenshot to see where I am at
From what I understand I need to access the FSmartNameMapping, then given the name of the curve, get its UID. Any idea how to do so ?
Thanks a lot !!!
hey, from the AnimSequenceBase you can access the FRawCurveTracks, this struct holds arrays of float, vectors of transforms curves, and from those you can simple evaluate to get your value
Thanks mate, works great. I do obtain the right value from this anim sequence for instance
Using this code (commented for people that might need it scrolling the forum)
My only regret is that I can’t seem to find a way to get the right curve with the name and not just a number that might change depending on the anim sequence.
If you have any idea about this I take it, else well, I will have to put things in order :).
You need to use FSmartName
const FRawCurveTracks& Curves = Anim->GetCurveData();
Anim->GetSkeleton()->GetSmartNameByName(USkeleton::AnimCurveMappingName, TEXT("Distance"), CurveName);
const FFloatCurve* DistanceCurve = static_cast<const FFloatCurve*>(Curves.GetCurveData(CurveName.UID));
You can get the FSmartName from the AnimSequence skeleton. Then get UID from the SmartName,
Hello, does anybody managed to get curve value in packaged build (Curve dissapears after building the project in my case)
You are correct. Packing the project with Shipping build causes the curves to go missing. There are no 'With_Editor" macros involved in any of the needed class members or functions that I could find. Perhaps this happens due to cooking/compression on the animation or curve data?
Many UObjects from AnimGraph are baked once you package in Shipping mode.
UE4 4.24 will have a new “UniformIndexable” Compression setting that will allow reading curves like this.
UniformIndexable still doesn’t seem to fix shipping builds for me. I can get the curve’s FSmartName and UID, but UAnimSeq->RawCurveData.FloatCurves is empty.
May be it is the answer, but i don`t know why not cook all Curves Data?
Why does UE4 reset he curveData before serialize the anim sequence? I go through the montage code and the curveData is not reseted.