Thank you so much! That was it. I was thinking I would try to create this standalone, before moving it into creating a GUI, and I didn't know about the Timer in GeDialog. This is now working, and all I needed to do is remove the multithreading and change it to the timer.
Latest posts made by brian.michael
-
RE: Multithreading/waiting for render to complete
-
RE: Multithreading/waiting for render to complete
The goal of the script is that there will be multiple items to set in my script, that then will take those items and loop through rendering. Batch, and deadline are on the list, but I also wanted something that the user is use as they use it all the time - the picture viewer. It would be sorta like Render all takes, but I would set the options between takes/ a bunch of different settings.
In my script I was thinking that I would start a thread that will wait and watch the Picture viewer, and when done change some settings and do it again. I was trying to thread the waiting part of the script, and not the running picture viewer part. Problem is that the picture viewer doesn't do anything until the main thread is done - which makes sense. but when the main thread is done, it seems to kill my threaded thread if I remove thread.Wait() and thread.End().
Looking into c4d.documents.RenderDocument looks promising but I still cant find how to get the feedback of seeing the render as it renders in picture viewer. Played quickly with RENDERFLAGS_CREATE_PICTUREVIEWER, and RENDERFLAGS_OPEN_PICTUREVIEWER - but neither opened the picture viewer. Only thing that did was - c4d.bitmaps.ShowBitmap(bmp) after the single frame was done.
-
Multithreading/waiting for render to complete
I am working on a script that will do some things, and then render to picture viewer, and then do more things and render to picture viewer again. I know I could save out files and submit to the render server or deadline - and that is an option - but I would like/really be nice to have this to be an option as well. So - below is a sudo code of what I have so far.
class WaitForRender(c4d.threading.C4DThread): def Main(self): bc = c4d.BaseContainer() time.sleep(1) #added this to see if it will wait a couple seconds for render to start before checking, but locks up everything while c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING): if self.TestBreak(): break time.sleep(1) self.End() class DoRender: def start_render(self): self.thread = WaitForRender(self) #wait for render to be done. self.thread.Start() # start up the waiting thread. c4d.CallCommand(self.PICTURE_VIEWER_COMMAND) # Render to Picture Viewer c4d.EventAdd() #tried this to see if it affects render/force render to start now - doesn't seem to. self.thread.Wait(False) #didnt really understand this, both true and false seem to have the same effect #close the thread thread.End() def process_shots(self): for loop through renderlist: self.start_render()
It seems Picture Viewer does not start until the whole script is finished - and holds up on the threaded sleep commands. I also tried to put the whole script into a thread, and call the picture viewer command - but picture viewer wouldn't seem to run/start when called from a threaded command. I am new to cinema, and their API's so I am probably missing something.