Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Add keys to object

    PYTHON Development
    0
    2
    476
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 26/06/2011 at 08:25, xxxxxxxx wrote:

      Hi,

      I'd like to know if there is an easier way to do it than I did it ?

      Pastebin

      I first wanted to set the key's values with a vector, but that didn't work.

      # ...  
        c4d.CTrack(null, c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_POSITION))),  
      # ...  
            pos         = op.GetAbsPos()  
            keys        = tuple((curve.AddKey(time)["key"] for curve in curves))  
            keys[0].SetValue(keys[0].GetCurve(), pos)
      

      Thanks,
      Niklas

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 27/06/2011 at 10:37, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        I'd like to know if there is an easier way to do it than I did it ?

        Yes. There is.
        The c4d.CallCommand(12410) will add a key to the PSR tracks(creating them if they don't exist).
        So all you need to do is use a BaseTime() loop to move the slider to the next frame and execute that CallCommand().
        The same thing can be done to create special tracks and set keys(like visibility).
        By using c4d.CallCommand(12410) in conjunction with the SetKeyframeSelection() function.

        But your long version might come in handy in some cases.
        It's always good to know how to do things from scratch just in case you need it.

        -ScottA

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