Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Get Curve value

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 256 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post