Add keys to object



  • 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



  • 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


Log in to reply