Announcement

Collapse
No announcement yet.

Reading Anim curve float values at all time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reading Anim curve float values at all time

    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
    Click image for larger version

Name:	GetAnimFloatValue.png
Views:	1407
Size:	33.3 KB
ID:	1638744

    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 !!!

    #2
    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

    Comment


      #3
      Thanks mate, works great. I do obtain the right value from this anim sequence for instance

      Click image for larger version

Name:	TimeCurve.png
Views:	1350
Size:	38.3 KB
ID:	1638937

      Using this code (commented for people that might need it scrolling the forum)

      Click image for larger version

Name:	TimeCurveCode.png
Views:	1370
Size:	31.8 KB
ID:	1638938

      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 .

      Comment


        #4
        You need to use FSmartName

        Code:
                    const FRawCurveTracks& Curves = Anim->GetCurveData();
                    FSmartName CurveName;
                    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,
        Last edited by Waves; 10-26-2019, 02:46 AM.
        UE4 Tutorials for 3rd person Blueprint project from scratch: Youtube Channel
        Use Blender 2.8 to make UE4 compatible animations: Blog

        Comment


          #5
          Hello, does anybody managed to get curve value in packaged build (Curve dissapears after building the project in my case)

          Comment


            #6
            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?
            UE4 Tutorials for 3rd person Blueprint project from scratch: Youtube Channel
            Use Blender 2.8 to make UE4 compatible animations: Blog

            Comment


              #7
              Many UObjects from AnimGraph are baked once you package in Shipping mode.
              | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

              Comment


                #8
                UE4 4.24 will have a new "UniformIndexable" Compression setting that will allow reading curves like this.
                UE4 Tutorials for 3rd person Blueprint project from scratch: Youtube Channel
                Use Blender 2.8 to make UE4 compatible animations: Blog

                Comment


                  #9
                  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.

                  Comment


                    #10
                    Click image for larger version

Name:	e96d75aa0632762634be1a0b1454a3e8.png
Views:	695
Size:	56.2 KB
ID:	1759736

                    May be it is the answer, but i don`t know why not cook all Curves Data?

                    Comment


                      #11
                      Originally posted by dxd39 View Post
                      Click image for larger version

Name:	e96d75aa0632762634be1a0b1454a3e8.png
Views:	695
Size:	56.2 KB
ID:	1759736

                      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.

                      Comment

                      Working...
                      X