THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/08/2009 at 08:03, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac OSX ;
Language(s) : C.O.F.F.E.E ;
---------
Hi, I'm continuing to attempt to write my coffee tag that eventually will export the tags user data for each frame to a text file. The user data for the tag is" on/off, input and print". the input will be connected to whatever via xpresso, while "on" will collect the values per frame (with a frame index number)into an array that will be dumped out to a text file when the "print" is activated. With the code I have at the moment the array is only getting the current frame.
<<
var lasttime;
main(doc,op)
{
doc->SetFps( 25 );
var number,on_off,coffee_tag,save_doc;
// create index for array
var t = doc->GetTime();
var sec = t->GetSecond();
var frame =int( t->GetFrame(doc->GetFps()));
var max_time = doc->GetMaxTime();
var max_sec = max_time->GetSecond();
var max_frame =int(max_time->GetFrame(doc->GetFps()));
var arr = new(array,max_frame,max_frame);
arr[frame] =frame,number;
coffee_tag=op->GetFirstTag();
while(coffee_tag)
{if(instanceof(coffee_tag, CoffeeExpressionTag)) break;
coffee_tag=coffee_tag->GetNext();
}
if(!coffee_tag) return;
if(!(coffee_tag#ID_USERDATA:2)) return;
number=coffee_tag#ID_USERDATA:1;
// userdata switch to print to file
save_doc=coffee_tag#ID_USERDATA:5;
var i = 0;
if (save_doc)
for (i = 0; i < max_frame; i = i + 1) {
println(arr _);}
if (!lasttime) lasttime = doc- >GetTime(); //initialize lasttime
var time = doc->GetTime(); //current document time
if (time->IsEQ(lasttime))
return;
else
println (arr[frame,frame]);
lasttime = doc->GetTime(); //write current time back to lasttime
}
>>
Any help greatly appreciated!
Conor