py node get animated value by frame



  • On 24/06/2018 at 08:29, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    Hi There,

    I right now am setting up a car rig. and there are always problems with the memory node in xpresso, as it is dependent on the framerate in the editor.
    It fluctuates a lot.

    I need to calculate speed and acceleration.

    I was wondering, If there is a posibility to read out the values of an animated value (f.e. Userdata) by frame or time.

    something like:
    read_fcurve_value(frame)

    then I could read the value for the actual frame and the frame before and should get stable values.

    Unfortunately my python skills are not exceptional good (that means they are quite bad :)

    maybe someone could give me a hint or a code snipped. that would be very appreciated.

    thanks a lot
    Jops



  • On 26/06/2018 at 02:22, xxxxxxxx wrote:

    Hi Jops,

    First of all SDK Help category is more about C++, while you question is more pythonic if I'm right, then please next time use the correct category (Python Development). :)

    About your question, to get value from Fcurve you have to get the correct Ctrack, then the Ccurve and finally you can have the value.

        cTrack = op.GetFirstCTrack()
        cCurve = cTrack.GetCurve()
        value = cCurve.GetValue(doc.GetTime())
    

    For more information, you can read the C++ manual about Animation. Even if it's in C++ you can find some valuable information for python.
    Please note that using this method you will only get value from Keyframe, no dynamic.

    Hope it's helpful, and if you have any other question please let me know.
    Cheers,
    Maxime


Log in to reply