I’m slowly coming out of the fog of Maya, now that I’m done with using it for Animation Mentor, and I’ve been trying to get back into Cinema 4D. I just wanted to post this short COFFEE script snippet. This looks through all the animation curves on an object and spits out information on them.
var op = doc->GetActiveObject(); var curTime = doc->GetTime(); println("\nKey dump for ", op->GetName(), ":\n"); var t = op->GetFirstCTrack(); if (t == NULL) println("Error."); var i = 0; var j = 0; var k; var c; while (t != NULL) { i++; c = t->GetCurve(); println("\tTrack ", i, ": ", t->GetName(), " -- ", c->GetKeyCount(), " keys."); for (j = 0; j < c->GetKeyCount(); j++) { k = c->GetKey(j); var bt = k->GetTime(); println("\t\t", j, ": v", k->GetValue(), ", t:", bt->GetFrame(30)); } t = t->GetNext(); } println("Number of tracks: ", i);
The sad part is this: you can’t add new keys to curves in COFFEE; you can only read what’s there. (EPIC FAIL, Maxon.) At least now I know how to get keys and how the BaseTime class works.