Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

py node get animated value by frame

Author
Message
  Topic Search Topic Search
Jops View Drop Down
Member
Member


Joined: 2005 Apr 25
Online Status: Offline
Posts: 52
Direct Link To This Post Topic: py node get animated value by frame
    Posted: 2018 Jun 24 at 8:29am

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
Back to Top
MaximeA View Drop Down
Forum Moderator
Forum Moderator

Forum Moderator

Joined: 2018 Jan 04
Location: France - Nantes
Online Status: Offline
Posts: 119
Direct Link To This Post Posted: 2018 Jun 26 at 2:22am
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

MAXON
SDK Specialist
Back to Top
Jops View Drop Down
Member
Member


Joined: 2005 Apr 25
Online Status: Offline
Posts: 52
Direct Link To This Post Posted: 2018 Jul 05 at 7:02am
Sorry for posting in the wrong category.
and thanks for the help :)

best regards
Jops
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.098 seconds.