Get Curve value

On 19/12/2013 at 12:06, xxxxxxxx wrote:

I'm working on a nondestructive keyframe to slider plugin and I need a little help. I have gotten to the point where I can get the value of the curve on a specific frame. However I can not figure out how to get the value between the frames.

For example, posY on frame 43 is 16 and on frame 44 it is 16.921. If I use frame 43.5, Curve.GetValue(key,fps) rounds the key to a whole and I get 16.921

Is there a way to get the value of a curve between frames?

Thanks in advance.

On 19/12/2013 at 14:09, xxxxxxxx wrote:

Hi Shawn,

you are talking about keys but CCurve.GetValue() does not expect CKey as its first parameter. Passing a
BaseTime object, just as the documentation states, works fine for me.
>
>
>
> import c4d
>
>
>
>
> def DescID(*args) :
>
>     return c4d.DescID(*map(c4d.DescLevel, args))
>
>
>
>
> def main() :
>
>     descid = DescID(c4d.ID_BASEOBJECT_REL_POSITION, c4d.VECTOR_Y)
>
>     track = op.FindCTrack(descid)
>
>     curve = track.GetCurve()
>
>     fps = doc.GetFps()
>
>
>
>
>     for i in xrange(100) :
>
>         x = i / 99.0
>
>         print curve.GetValue(c4d.BaseTime(x), fps)
>
>
>
>
> main()

This script prints out the Y position of the selected object from second 0 to 1 in 100 steps.

Best,
-Niklas

On 06/01/2014 at 13:00, xxxxxxxx wrote:

Thanks NiklasR! In my code I realized I was giving an integer rather than a float. Works great!