Progress within a loop
On 13/02/2016 at 07:17, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ; Mac ;
Language(s) : C++ ;
Some time I posted "Different behavior on Mac versus PC" asking an explanation of the difference between pc and mac.
PC updates the gui during a loop, while the mac does not.
I solved it, with the help of Andreas, using threading.
Now I have something similar.
In Command I download multiple images.
for x=o to 10
for y=0 to 10
set slider to indicate progress
On the pc the slider is updated. On the Mac the slider is not updated. Only after the whole loop, the slider is updated.
While the loop is running cinema gui is completely blocked.
I can put the loop in a thread, but I was wondering if there is no other way to do this.
How did others solve this issue?
On 13/02/2016 at 08:57, xxxxxxxx wrote:
Coroutine programming would be your only other choice. But
C++ doesn't (yet) support it natively and even if it would, the C4D SDK
would probaby need to be updated to support it.
You have to stick to threading.
Edit: If you do want to look into Coroutines, there's boost::coroutine
for example. Haven't tried it myself though.
On 15/02/2016 at 01:25, xxxxxxxx wrote:
as Niklas said, the best solution would be so do your operations from a background thread and to update the GUI from the main thread. Please be aware that we cannot provide any support for the use of third party libraries as boost.
On 15/02/2016 at 05:25, xxxxxxxx wrote:
Ok, I will stick to threading and have a look at Coroutines.