View Full Version : if render completed/cancelled, do?
01-13-2013, 02:55 PM
I'm wondering if there is a way to determine if a render was cancelled mid-script since if I cancel a render for my baking script, it still proceeds with the rest.
This is an interesting problem, mainly due to the fact that I can't seem to find any built-in commands to query the current render state.
What you can do is find out what procedure is called when a particular renderer requires a render, via the `renderer -q -renderProcedure (currentRenderer())` command. Then you have to follow the breadcrumbs through the maze of .mel scripts in Maya's installfolder.
I spent a while scanning over those scripts, and the only really useful piece of information I found was this:
global int $gRenderViewRenderAborted;
I found it in mentalrayPreviewRender.mel, which seems the main rendering procedure linked to mentalRay. Basically, it gets set to 1 if the render is aborted. I assume that this happens with any renderer, though I'm too lazy to read through every renderProcedure of every available renderer.
So try utilizing that variable with your script, basically breaking out of the script if that variable happens to be 1 at a given point.
That's all I can offer at this moment, haven't ever really dealt with renderers in scripts.
01-13-2013, 11:52 PM
Probably is not the cleanest way to work this out, but can't you check the file state on disk?
What I mean is checking the file size or maybe trying to read it (with the help of a module like this http://excamera.com/articles/26/doc/openexr.html working in your app) and then decide to go on or return?
01-14-2013, 05:16 PM
the problem with a file detection is that the image could exist from a previous bake. I supposed I could add a deletion of the file at the start of the script.
Also, I'm using V-Ray, so a mental ray script doesn't help much.
Maybe what I can do is add a prompt after the render to ask if it's okay to proceed, but I'll need to rejig my for loop and put all the last bit at the end.
01-14-2013, 05:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.