Add/Remove Keyframes with Xpresso/Coffee

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2013
Add/Remove Keyframes with Xpresso/Coffee


I've got an object with numerous userdata sliders. Now, I would like to do an Xpresso setup where I use a boolean userdata entry to add (and one to remove) keyframes to/from all of the userdata sliders of that object. I've gone through all the nodes in the help file but I could have missed it along the way. Is it possible to add or remove key frames with Xpresso? If so, could you please tell me how? I don't know C.O.F.F.E.E. at all, so if there isn't a way with Xpresso but there is with C.O.F.F.E.E., could someone please tell me what the scripting should be?
Software Used:
3D: Cinema 4D, MotionBuilder
Finished Work:
  03 March 2013
1. simply open the context menu on a attribute manger element (works with selections
over multiple elments and objects) and execute Animation>DeleteTrack

2. if it has to be for some unknown reason a script here is a possible approach. it will
flush all userdata keys for all currently selected objects while keeping all other keys.
you could also use it from within an xpresso setup as a python node, but this would
require some modifications. this is a simple script version.

import c4d

def main():
    selection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHIL  DREN)
    for obj in selection:
        for id, bc in obj.GetUserDataContainer():
            trackdata = obj.FindCTrack(id)
            if trackdata != None:

if __name__=='__main__':

edit: meh the board adds a typo to the code. remove the whitespace at
  03 March 2013
Thank you for the reply.

I think I might not have been as clear as I could've been in my question. I know how to add and delete keyframes (even on multiple parameters) manually but what I would like to do is to have 2 boolean 'buttons' that will take all of the userdata sliders specified in the Xpresso setup and add or remove keyframes from them all at once. So, in effect, it will serve the same purpose as the "Record Sliders" button in the pose morph tag except that it will have one that adds keyframes for sliders specified in the Xpresso setup and one to delete keyframes. The reason I'd like to have this, is because it would save me huge amounts of time during animation.

I don't know COFFEE or Python at all and, as a result, I don't think I'll be able to modify code without instructions. However, from what I gather, COFFEE is the simpler of the 2 so if COFFEE can do it, and you could give me a basic COFFEE script, that'd be awesome.
Software Used:
3D: Cinema 4D, MotionBuilder
Finished Work:
  03 March 2013
1. there are no button elements for userdata/xpresso. you would have to use checkboxes
as a substitutes.

2. it is not possible to get hold of the currently selected element in the attribute manger.
you have either to add/flush the user data keys of all currently selected objects or none.

3. my snippet shows how to delete keys, adding is almost the same. try it for yourself,
i will help you, when you get stuck while trying
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:08 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.