Timer()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2008 at 14:56, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform:
Language(s) : C.O.F.F.E.E ;---------
I'm trying to change a text spline with the Timer() function to display velocity on the screen. I don't really understand what the SetTimer is doing because I commented out my Timer() function but everything is repeating still. Besides that my major problem is that I only want to alter the text of my spline and not make a new spline every cycle, but I can't figure out how to pass my spline object. I don't think I should have to pass it because I declared it globally.
VelText::WriteVel(sDoc)
{
vtObj=AllocObject(Osplinetext);
vtObj->SetName("Velocity");
//vtbc=vtObj->GetContainer();
//txt=vtbc->GetData(PRIM_text_text);
//vtbc->SetData(PRIM_text_text,txtw);
//vtObj->SetContainer(vtbc);
sDoc->InsertObject(vtObj,NULL,NULL);
println("got here");
EventAdd();
return vtObj;
}
VelText::MakeNull(sDoc)
{
mnObj=AllocObject(Onull);
mnObj->SetName("Velocity Tracker");
nulpos1=mnObj->GetPosition();
nulpos2=mnObj->GetPosition();
//timediv=500;
//SetTimer(timediv);
sDoc->InsertObject(mnObj,NULL,NULL);
EventAdd();
return mnObj;
}
VelText::CalcVel(vtObj)
{
nulpos2=mnObj->GetPosition();
vdiff=nulpos2-nulpos1;
len=vlen(vdiff);
println(vdiff);
println(len);
vel=len*1000/timediv;
println(vel);
txtw=vel;
println(txtw);
vtbc=vtObj->GetContainer();
txt=vtbc->GetData(PRIM_text_text);
vtbc->SetData(PRIM_text_text,tostring(txtw));
vtObj->SetContainer(vtbc);
//sDoc->InsertObject(vtObj,NULL,NULL);
EventAdd();
nulpos1=mnObj->GetPosition();
println("nulpos1");
return cvObj;
}
oDialog::WriteVeloc()
{
sDoc=GetActiveDocument();
if(!sDoc) return FALSE;
VText=new(VelText);
vtObj=VText->WriteVel(sDoc);
if(!vtObj) return FALSE;
mnObj=VText->MakeNull(sDoc);
if(!mnObj) return FALSE;
timediv=500;
//SetTimer(500);
//mnObj=VText->CalcVel(vtObj);
}
oDialog::CalcVel()
{
timediv=500;
SetTimer(500);
cvObj=VText->CalcVel(vtObj);
}
/*oDialog::Timer(msg)
{
mnObj=VText->CalcVel();
}*/
Thanks for any help -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/03/2008 at 07:15, xxxxxxxx wrote:
I figured it out. I was missing the line... vtbj->Message(MSG_UPDATE); in my CalcVel() function.
Also, I uncommented the Timer() function. Maybe the SetTimer was repeating and looking for this everytime. I thought it would just do nothing.