Making a script stop a render/network render until the script is okayed by a user
Hi all, I started this script
http://www.scriptspot.com/3ds-max/scripts/hide-and-unhide-all-bones-and-...
and as you can tell it's very basic. Tassel came up with a more user friendly version and i'd like to enhance my script.
What I'd like to achieve is when this script is added to the pre-render scripts area, the script halts rendering until the relevant buttons are pressed. I'll add a "Render" button to it, but forst you pick "Hide Bones" to hide them and when you click the render button, max then renders the image.
The scripts i attached to my upload dont have any use inteface and just run "behind the scenes". This was intentional so that a user can add them and forget them.
But now i'd like to add some functionality, but still keep the script able to be used in the pre-render area if possible. Presently, with Tassel's version loaded in, the script opens the dialog, but the render happens anyway before you've told it to hide/unhide bones.
So, is there a fumction i can use to halt rendering while the script is active?
Comments
good part
found a good part by ZeBoxx2 on cgtalk:
http://forums.cgsociety.org/showpost.php?p=5177416&postcount=6
i did a rough stitching of both scripts. put the attached version in your script/startup folder:
Slight tweak....
Thanks for this find le1setreter, i added it in to my startup scripts and did a test, it works well. But, when i add it to the Pre-render list, it's not so usable because it gets stuck in a loop. Because of the Render button on my script, when that is pressed, the script gets loaded again and you keep going through the same process.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Attached is a version where I've got rid of the render button and made the other two buttons render directly after they have been pressed. It's still got the loop problem, which can be negotiated but it's very annoying!
You have to say yes to "check bones before rendering", click the "hide" bones button, then click no to the "check bones before rendering when it comes up again.
I also deleted your part of the script and it seems to work still so i'm not entirely sure if your find was needed, but to be honest i don't quite know how i've made that happen without your part in.
I've attached it because i don't know how to add my script in to a window like you did.........by doing that, does all the colour formatting stay?
PS> I've managed to google how to create a scroll box, but when i add my script in (by copying and pasting directly from MAXScript) when i preview my post the scroll box dissapears......
Cheers.
Script_Butler
hi Script_Butler, hmm... what
hi Script_Butler,
hmm... what do you exactly mean with "Pre-render list"? do you mean a callbacks.addScript #preRender? if yes is it really neccessary?
why not just put my script into script/startup?
i know the loop problem and it was annoying for me too. that has been the reason why i worked with the variable "lastRenderChecked" to not get the render confirmation request after being in the hide/unhide bones dialog.
the reason why i (or better said others) used the "dialogMonitorOps" is some kind of workaround to cancel/stop/kill the already startet render! i could not find another way to cancel a render via script.
using the messagebox, querybox or yesNoCancelBox also do some pausing while you can do changes before rendering but you are limited to the properties of these boxes/windows.
the code box can be done like this but without the space after "<":
< code>
your code in here (copyNpaste)
< /code>
Pre-render list
Hello.
If you open up the Render dialog, there is a scripts rollout.
The first part is the Pre render list. Bassically i want my script to be added in there so the user can load it in just for certain maxfiles and whenever they hit render it loads the scripts listed.
If you look at my script page http://www.scriptspot.com/3ds-max/scripts/hide-and-unhide-all-bones-and-... you will see i included two scripts one for pre-render and one for pos-render.
The reason i want this script to be added in there is so that my script automatically gets run every time a render is needed and that way you don't forget to run the script or hide the bones.
If you put your version in to the startup folder it will run in every single maxfile. If you add it in the pre-render list it's on a per maxfile basis which is better in my opinion. Your version can be used either way though!
I guess theres no way around the loop? Could it be scripted so that the query box button "Yes" hides the bones and renders and the "no" button unhides the bones and renders? Looking at that piece of script i don't think it can.
Cheers.
Script_Butler
Hi, You can use "render()" Or
Hi,
You can use "render()"
Or an example of rendering in you own Renderbuffer (VFB or what they call it these days)
on btn_render pressed do
(
RenderWindow = bitmap renderwidth renderheight --(W/H is collected from Render Settings. if you want a specified size just write "bitmap 200 200" or whatever)
displayRenderWindow
Render to:RenderWindow
escapeEnable = true
rendersavefile = false
)
/ Raymond
Pre-render loading script issue....
Cheers for that Tassel,
But it still doesn't solve the problem if the script is loaded in to the Pre-render list.
Is it possible to have a script that when run stops rendering until a button is pressed?
Cheers.
Script_Butler
Do you you talking about
Do you you talking about "Pause" the render?
/ Raymond
I think that will work. I
I think that will work.
I appreciate if the script is run during normal max usage, the user can click on the render button and render the image.
But because I'd like my version to be usable when added in to the pre-render list, it would need an option to pause the render silently and then the user can turn off bones and click render!
Does that make sense?
Cheers.
Script_Butler
just to note, there is a
just to note, there is a (code) ... (/code) context in this forum, (will work if you replace the round brackets with square brackets: [ ]) which will make your code much more readably through color coding :)
Never get low & slow & out of ideas
Code Context
Thanks Br0t.
I will utilise this.
Cheers.
Script_Butler