THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/12/2006 at 10:50, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.6
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Hi,
I want to implement a caching function just as Hair or Clothilde does. I have a working solution using SetTime() and AnimateDocument(). Here is some corresponding code:
while(frame>=mintime-1 && calccache)
{
StopAllThreads();
BaseTime nt = BaseTime(frame+1,doc->GetFps());
doc->SetTime(nt);
doc->Message(MSG_UPDATE);
op->SetDirty(DIRTY_DATA);
DrawViews(DA_STATICBREAK);
doc->AnimateDocument(NULL,TRUE,TRUE);
EventAdd(EVENT_ANIMATE);
This happens when the user hits the calculation button in the AM. (more happens but not really relevant here :-)
It works, but there are some fundamental differences to how the hair/cloth solution:
1. The timeline doesn´t move with the simulation
2. When the user clicks somewhere into c4d while it´s calculating, it stops and the interface freezes
3. The mouse pointer doesn´t look like an hour glass. :D
So, I am asking myself how to achieve this. Is it simply that I should use my own thread for the calculation and I simply wait for the thread to end?
How should I prevent any user interaction with the interface during the calculation (as in hair, when you click it also seems that nothing happens)?
As my timeline doesn´t move, I thought maybe using RunAnimation() and SetDocumentTime() may be more appropriate for this kind of process. But I have no clue, when I use these instead of SetTime and AnimateDocument, simply nothing happens. :-/
Any ideas or confirms for my thoughts and questions are appreciated. :)
Thanks
Samir