Created
March 23, 2011 00:06
-
-
Save julik/882373 to your computer and use it in GitHub Desktop.
CINEMA4D C.O.F.F.E.E. camera retimer tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main(doc,op) | |
{ | |
// Which frame to sample. Grab this from the userattr of the COFFEE tag! | |
var cofy = op->GetFirstTag(); | |
// Gotcha - when rendering tags get reordered and coffee tag might not come first, | |
// so walk the fucking linked list until we arrive at the tag | |
while(cofy) { | |
if(instanceof(cofy, CoffeeExpressionTag)) break; | |
cofy = cofy->GetNext(); | |
} | |
if(!cofy) return; | |
// Float attr | |
var at = cofy#ID_USERDATA:1; | |
// Sample FPS once | |
var fps = doc->GetFps(); | |
// We need to pass a BaseTime object to the track sampler | |
var atTime = new(BaseTime); | |
atTime->SetFrame(at, fps); | |
// Positions | |
var myT = op->GetFirstCTrack(); | |
var posX = myT->GetValue(doc, atTime, fps); | |
myT = myT->GetNext(); | |
var posY = myT->GetValue(doc, atTime, fps); | |
myT = myT->GetNext(); | |
var posZ = myT->GetValue(doc, atTime, fps); | |
// Then rotations | |
myT = myT->GetNext(); | |
var rotH = myT->GetValue(doc, atTime, fps); | |
myT = myT->GetNext(); | |
var rotP = myT->GetValue(doc, atTime, fps); | |
myT = myT->GetNext(); | |
var rotB = myT->GetValue(doc, atTime, fps); | |
op->SetPosition(vector(posX, posY, posZ)); | |
op->SetRotation(vector(rotH, rotP, rotB)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment