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

    Setting value of keyframe not working

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 315 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 05/10/2015 at 13:06, xxxxxxxx wrote:

      I have an Alembic object that has animation on it. I don't want to adjust that.

      I want to be able to keyframe the "Start of Animation" option that's in the Object tab.

      I can add a track, get the curve, and add a key with no errors popping up, I just can't get the value to go to anything else beside "1 F"

      I think my issue is that the CKey.SetValue requires a curve and a float and the end result needs to be a baseTime object.

      Here's a snippet of the code I have currently.

      doc = c4d.documents.GetActiveDocument()
      sel = doc.GetActiveObject()
      startFrame = 200
        
      track = c4d.CTrack( sel, c4d.DescID( c4d.ALEMBIC_START_DELAY ))
      sel.InsertTrackSorted( track )
      curve = track.GetCurve()
      fKey = c4d.CKey()
      track.FillKey( doc, sel, fKey )
      fKey.SetTime( curve, c4d.BaseTime( startFrame, fps))
      fKey.SetValue( curve, startFrame )
      curve.InsertKey( fKey )
      c4d.EventAdd()
      

      This code doesn't generate errors, it just doesn't add the new value of 200.
      What am I missing or doing wrong?

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

        On 06/10/2015 at 04:48, xxxxxxxx wrote:

        Hi Herbie,

        the CTrack needs to be set up correctly with the datatype:

        track = c4d.CTrack(sel, c4d.DescID(c4d.DescLevel(c4d.ALEMBIC_START_DELAY, c4d.DTYPE_TIME))
        

        And as the keyframe is of type Basetime, you need to use SetGeData() to set the value:

        fKey.SetGeData(curve, c4d.BaseTime(startFrame, fps))
        

        There's also another thread Questions regarding Keys/CKey, which may provide you some additional infos.

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

          On 06/10/2015 at 10:25, xxxxxxxx wrote:

          Aww yes! This helps tremendously. There's no doubt I will use this all of the time now.

          Thank you!

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