Xpresso COFFEE keyframe trouble

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

On 20/11/2008 at 17:43, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   11 
Platform:      Mac OSX  ; 
Language(s) :   C.O.F.F.E.E  ;   XPRESSO  ;

---------
Hi,

I've had success moving keyframes with both a COFFEE tag and also a COFFEE Xpresso node, in both the editor and renderer (picture viewer), with animation tracks, using this code:

main()
{
     var doc = Input1->GetDocument(); // when in Xpresso
     var obj = doc->FindObject("Cube");
     var track = obj->GetFirstCTrack();
     var myKey = track->GetCurve()->GetKey(0); // key 0 is first key
     var time = new(BaseTime);
     time->SetFrame(5,doc->GetFps()); // move to frame 5...
     myKey->SetTime(track->GetCurve(),time);
}

However, when it comes to moving a keyframe on a Tag, the code works in a COFFEE tag in both the editor and renderer, but only in the editor with a COFFEE Xpresso node:

main()
{
     var doc = Input1->GetDocument(); //when in Xpresso
     var obj = doc->FindObject("Cube")->GetFirstTag();
     var track = obj->GetFirstCTrack();
     var myKey = track->GetCurve()->GetKey(0); // key 0 is first key
     var time = new(BaseTime);
     time->SetFrame(5,doc->GetFps()); // move to frame 5...
     myKey->SetTime(track->GetCurve(),time);
}

... when rendering and using Xpresso the line 'var myKey...' throws the error (5) Incompatible values... NIL / OBJECT

Can anyone please shed any light on this?

Thanks

Jon

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

On 21/11/2008 at 03:24, xxxxxxxx wrote:

OK, I eventually figured the tag wasn't being recognised at all, and with a bit of hunting learnt that when rendering in the picture viewer an invisible tag is placed as the first tag (pretty obvious huh!?!?)

Here's a way around it:

main()
{
     var doc = Input1->GetDocument(); // when in Xpresso
     var obj = doc->FindObject("Cube");
     var tagb = obj->GetFirstTag();
     if(doc!=GetActiveDocument()){ // if rendering...
          tagb = tagb->GetNext();     // skip invisible tag
     };
     var track = tagb->GetFirstCTrack();
     var myKey = track->GetCurve()->GetKey(0); // key 0 is first key
     var time = new(BaseTime);
     time->SetFrame(5,doc->GetFps()); // move to frame 5...
     myKey->SetTime(track->GetCurve(),time);
}

Ta

Jon