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:
Cinema 4D Version: 9.6
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
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)
BaseTime nt = BaseTime(frame+1,doc->GetFps());
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.
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.
On 08/12/2006 at 11:27, xxxxxxxx wrote:
Ok, I now use a thread, but still the same. When clicking into the layout it freezes. However, the calculations go on! I don´t know how to prevent this.
And still no clue why the timeline doesn´t move with the animation.
On 08/12/2006 at 12:38, xxxxxxxx wrote:
1. As noted in other threads, AnimateDocument() only 'animates' the current frame (applies key values to the animated objects). But setting the document time should be sufficient to update the timeline one would think (?) I have not ever needed to call doc->Message() afterwards though. I take it that you've tried a simple EventAdd() call.
2. I get this on my plugin imports also because of StopAllThreads() (which is recommended) and being in the main thread. In my case, I don't want users to do 'other' things while importation is ongoing. But I have never been able to keep the interface updated during this process either. To avoid this, you have to move the entire operation (not just AnimateDocument(thread)) into a separate thread so that the main thread is not interrupted. But that doesn't bode well for DrawViews() - must be called from main thread (!).
3. SetMousePointer(MOUSE_BUSY) ?
On 08/12/2006 at 13:06, xxxxxxxx wrote:
thanks first of all.
1. Ah now I see! Yes, EventAdd is called after AnimateDocument. That shouldn´t make any difference, it should update it in either case. But that doesn´t work. I call doc->Message() for "just in case" situations.
2. Yep, am using an own thread already. Making the thread asynchronous though is not the intention as I also want to make sure the user doesn´t interrupt the process in any way. But how is that done? I am really stuck here. I mean I could tell my customers to not do anything during this time, but that´s far from being a solution to the problem.
3. There it is again, the simplicity. thx!
On 08/12/2006 at 13:36, xxxxxxxx wrote:
1. Maybe a GeSyncMessage(EVMSG_TIMECHANGED) is called for here? I know that this (with the other flag) is useful for Tool plugins in order to update the tool's AM. Have you tried commenting out StopAllThreads() to see if that has an impact. For the most part I'm guessing as I don't have any experience where I need to actually 'see' the document or timeline animated, just be able to get at the animated results of objects therein.
2. I was going to suggest a GeModalDialog, but that suffers even worse - your calculations will wait until it is dismissed.
In either case, you might want also to have a look at c4d_gui.cpp (esp. GeDialog::Message() and GeModalDialog::Message(), BFM_INTERACTSTART). I might look at these myself.
On 08/12/2006 at 13:53, xxxxxxxx wrote:
Hey GeSyncMessage() does indeed update the timeline correctly! Great thx!
However, the click & freeze is still there. So if anybody knows how to prevent this, I´d be glad to know.
GeModalDialog is definetly no option though! Btw. I am NOT in a dialog, but in a generator object!
On 08/12/2006 at 13:56, xxxxxxxx wrote:
ah and, yes, of course I already tried it without StopAllThreads(). Makes no difference.
On 09/12/2006 at 14:14, xxxxxxxx wrote:
I almost forgot about this last night. Ya know, I was loading a C4D document (standard stuff) in R9.5 and it did the same thing to the interface if I did anything or popped up the Windows TaskBar - as a test. Seems that certain processes will not allow the general interface to refresh. Maybe this is the case for what you are doing. (?)
What seems to happen is that Cinema 4D is doing some process that is working without full messaging (or something) and when you click, the window goes blank and you can usually see (Not Responding) in the Task Manager. Cinema 4D is okay, it's just not at home during the process.
On 10/12/2006 at 05:49, xxxxxxxx wrote:
that´s true, but there must be a way to refresh the general interface because the hair module and the clothilde module are doing the exact same thing! And it works for them. So it should work for me too.
But it seems developer support has stopped here at plugincafe. I am still sitting here on some problems that have never been adressed and that customers will definetly argue about. Very disappointing.
On 10/12/2006 at 07:37, xxxxxxxx wrote:
Methinks that the developers et al are working feverishly to fix and finalize R10 and its SDK (I hope).
On 10/12/2006 at 08:04, xxxxxxxx wrote:
Well, the sdk support does now consist of 2 people, Matthias and Mikael (both are NOT c4d developers but official plugincafe support), and me thinks that it should be feasible to look into the cafe once a week for one of them, to give third party developers the needed support.
MAXON has always been developer friendly but since Cinema 4D is growing, this gets worse every year (I am here for about 5 years) and that´s a shame. I know they also have other stuff to do beside keeping the cafe running, but sometimes I have to wait several weeks until I get an answer and sometimes I don´t get an answer at all, even when I say that it´s URGENT.
I have lost my client due to an unanswered question from some weeks ago although they said, they´d give me an answer. (the environment bug, my client simply couldn´t use it because of this issue and so he skipped the job! who gives me the lost money back?). Bad support these days, that simple.
On 10/12/2006 at 11:08, xxxxxxxx wrote:
Maybe they are on vacation, together? ...
I know the feeling - especially about urgency. Or worse is that it is difficult to focus on a particular feature/problem, ask for assistance here, and then wait and wait. It's usually not possible to just shift gears and do something else - either what you are doing has your full attention or it is critical before any other forward motion can occur (etc.). And it is not very professional to go to customers with "It took me three weeks to add this key-check to my interface."
And I know about the client problem. My big stink over PLA and other special animation in R10 was mainly motivated not only by the needs of two commercial plugins, but also by the request from a client from last year wanting R10 support for several commissioned plugins - and by the end of the month (November) or stick to R9. At first I was like "I don't know, but let's see", then I was like "Maybe, support is getting to it". And then it had to be "Probably not, but I'll tug on my end and you tug on yours" (he was going to contact Maxon UK personally about it). In the end, hmmm, it's Dec. 10 and the update was completely abandoned since there seem to be no answers forthcoming. A month and a half (from release, not including demo time) and still no sign of SDK documentation or examples to put some of these changes into affect. Matthias did offer one workaround solution for PLA that will suffice for one of my commercial plugins - but that is it.
As an aside, I was really aghast when helping Murakami with the modal dialog key tests to find that nothing happens! How can you design a GUI where keystrokes are ignored by part of the GUI? I still don't see a solution here considering that none of the virtual methods is even called on a keystroke - that's scary!
On 12/12/2006 at 09:38, xxxxxxxx wrote:
Back on topic:
Hair doesn't really update the interface, except for some parts: Timeslider, AM, and View. You can see that it kind of freezes, when you try to move the window or move another window on top of it. It will only redraw some parts. I believe Hair does it exactly as you do. It might just make some updates via GeSyncMessage(). How about EVMSG_DOCUMENTRECALCULATED, to update the AM ? Beside, does the drawing in the views work for you ?
On 12/12/2006 at 15:33, xxxxxxxx wrote:
thanks, I will try that message! Do you mean drawing while caching? Well, sometimes it works and sometimes it doesn´t. I haven´t found out when or why though. Will let you know when I know.
On 13/12/2006 at 00:44, xxxxxxxx wrote:
Caching goes like this:
for (f=start; f<=stop; f++)
On 13/12/2006 at 06:50, xxxxxxxx wrote:
Thanks Dave! That definetly helps!