Add Keys to (Xpresso) Userdata



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

    On 20/07/2011 at 07:18, xxxxxxxx wrote:

    Hi folks,

    I'm trying to built a script that should (acts as a configurator) creates keyframes based on userdata with 4*4*7*7 possibilites.

    This should be possible with some for - in - loops, at least a smart girl told me so.
    The major thing I don't know to handle is adding a key and setting the value.

    Here is a test from what I've  got so far:

    xtag = obj.GetFirstTag()
      ctrack_dach = xtag.GetCTracks()[0]
      curve_dach = ctrack_dach.GetCurve()
      print "Number of keys: ", curve_dach.GetKeyCount()
      print curve_dach.GetKey(1).GetGeData()

    and this returns the correct value for the actual setting.
    But how do I add a key and set this ? Since there is no SetSeData()

    I mean I could set it like so

    xtag[c4d.ID_USERDATA, 3] = 2

    But I want to add a key and store the value in it.

    Any help is much apprecciated 🙂



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

    On 20/07/2011 at 08:37, xxxxxxxx wrote:

    See the Codesnippet in this post.
    https://plugincafe.maxon.net/topic/5822/5880_add-keys-to-object&KW=keys&PID=24657#24657

    Cheers,

    PS: I'm fine, thanks, and you ?



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

    On 20/07/2011 at 09:37, xxxxxxxx wrote:

    Well, looking through your hint I found out that it appears not to work for me.

    key = my_curve.GetKey(1)                     # for example the second existing keyframe
      print "GetGedata: ",my_curve.GetKey(1).GetGeData()
      print "GetValue: ",key.GetValue()
      print "######################"
      key.SetValue(curve_dach, 4)
      print "new GetValue: ", key.GetValue()
      print "new GetGeData: ", my_curve.GetKey(1).GetGeData()

    turns out to

    GetGedata: 1
    GetValue: 0.0
    ######################
    new GetValue: 4.0
    new GetGedata: 1

    If I manually make changes in the userdata, it always affects the result from GetGeData.
    Somehow I have to acces this ... Do you have another idea ?

    Cherio

    PS: Well, back in coding life is quite hard 😄, but I'm doing fine. Ty

    ____________________________________________________________

    Edit: It works now

    I just tried rambostyle and used something that is not in the documentation

    key.SetGeData(my_curve, 4)



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

    On 21/07/2011 at 01:58, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I just tried rambostyle and used something that is not in the documentation:

    key.SetGeData(my_curve, 4)
    

    Hi,

    It's not in the documentation because of an omission. GetGeData() is documented but SetGeData() is not.

    Thanks for pointing out that. If you find something not documented don't hesitate to report it.



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

    On 21/07/2011 at 02:08, xxxxxxxx wrote:

    Sure, I bet there are more to come 


Log in to reply