[Closed] Maxscript – loop – wait for finished rendering?
Hi folks,
is it possible to make a “for-loop” wait for a finished render-process an then contiue looping?
background:
i’ve got variuos “for-loops” walking through focusdistance, focallength, aperture, iso-speed and shutterspeed of the camera. I need this output for a project.
now i don’t want to create thousands of keyframes (which works), because i want to determine the filenames of the renderoutput – therefore i want to use maxscript to start the rendering.
The issue is, to make the for-loops wait for the rendering to finish
short version of the code:
for a=1 to dist.count do
(
for b=1 to focal.count do
(
for c=1 to aperture.count do
(
-- change camera-parameters and other stuff
--
-- determine renderoutput-filename "aperture_focal_dist.jpg"
-- start rendering
-- wait for rendering
)
)
)
any suggestions? – or maybe a complete other solution how to get this done?
wait for the render to finish = PostRender CallBack
i think that what you should dig
Thanks.
so – i gotta change it all – packing it into functions and “count” the parameters after the renderjob – and than start it all over again … right?
I would think that if you call the render() function from within the loop it should continue looping after the render is done. It does not happen that way?
:banghead::banghead::banghead::banghead:
I thought that would’nt work – have been working with flash a whole lot – so I didn’t suggest that max would WAIT – and ist DOES yeehaw
Another quoestion:
I’m rendering the scene and a zDepth-pass – how can I define the NAME of the render-element’s Outputfile??? – (needs a special counter in it)
I’m not sure if you can do it from the render function directly, but maybe using the RenderElementMgr interface?
Thanks for the advice – i’m quite new to MS (it’s my third day)
i think i’ve found some source maybe i’ll get it to work for me … ‘m not sure ^^
[left]elementlist = #(specular,diffuse,self_illumination,reflection,refraction,shadowrenderelement,atmosphere,blend,z_depth,alpha,backgroundrenderelement)
[/left]
[left]
[/left]
[left]re = maxOps.GetCurRenderElementMgr() [color=green]-- get the [current]( http://forums.cgsociety.org/) render element [manager]( http://forums.cgsociety.org/) [/color]
[/left]
[left]re.removeallrenderelements() [color=green]-- [remove]( http://forums.cgsociety.org/) all renderelements[/color]
[/left]
[left]re.numrenderelements() [color=green]-- get number of render elements[/color]
[/left]
[left]
[/left]
[left]theManager = maxOps.GetRenderElementMgr #Production
[/left]
[left]theManager.numrenderelements()
[/left]
[left]rendoutputfilename = [color=maroon]"c:\ est.tga"[/color]
[/left]
[left][color=green]-- adds all renderelements to be rendered.[/color]
[/left]
[left][color=blue]for[/color] n [color=blue]in[/color] elementlist [color=blue]do[/color]
[/left]
[left](
[/left]
[left]re.addrenderelement (n elementname:([color=maroon]"foo_" [/color]+ (n [color=blue]as[/color] string)))
[/left]
[left]format [color=maroon]"
Added % renderelement" [/color]n
[/left]
[left])
[/left]
[left]rendsavefile = true
[/left]
[left]setsilentmode true [color=green]-- used to avoid error message when [checking]( http://click.adbrite.com/mb/click.php?sid=684637&banner_id=12724662&variation_id=1412881&uts=1245693565&cpc=302e3031&keyword_id=42750&inline=y&ab=168296602&sscup=9598776ae5561d4ce19a999ae6b2c225&sscra=d670a8aaa565b2b5ed1ac269447996f1&ub=3564779869&guid=8dc8bd51-034d-4fbe-b222-77d97038ef4c&odc=svx&rs=&r=) the filename of element[/color]
[/left]
[left]renderSceneDialog.[open]( http://forums.cgsociety.org/)() [color=green]-- open Render Dialog[/color]
[/left]
[left][color=green]-- get all render elements set and return name of render element and output filename[/color]
[/left]
[left][color=blue]for[/color] n = 0 [color=blue]to[/color] (theManager.numrenderelements()- 1) [color=blue]do[/color]
[/left]
[left](
[/left]
[left]el = re.getrenderelement n
[/left]
[left]format [color=maroon]"
Getting % render element"[/color] el.elementname
[/left]
[left]format [color=maroon]"
Render element outputfilename: %"[/color] (re.GetRenderElementFileName n)
[/left]
[left])
[/left]
Well – i found sth. that seems to work – thanks!
rendOutputFilename = "D:\\01_studium\\2008-2009 - diplom\\diplom\\300_-_verteidigung\\prototyp\\sources\\render\\stadt_" + (dist[a] as string) + "_"+(focal[b] as string)+"_"+(aperture[c] as string)+".jpg";
re = maxOps.GetCurRenderElementMgr() -- get the current render element manager
re.removeallrenderelements();
re.addrenderelement (z_depth elementname:("zdepth_" + (dist[a] as string) + "_"+(focal[b] as string)+"_"+(aperture[c] as string)));
re.SetRenderElementFilename 0 ("D:\\01_studium\\2008-2009 - diplom\\diplom\\300_-_verteidigung\\prototyp\\sources\\render\\stadt_zdepth_" + (dist[a] as string) + "_"+(focal[b] as string)+"_"+(aperture[c] as string)+".jpg");
--rendsavefile = true;
--setsilentmode = true;
max quick render();
erm … one last question (at the moment)
is there something like a “timeout” for a script?
I let my script run – it worked fine – but it only renderen 355 frames – then 3dsmax crashed …?
Most likely it ran out of memory… try adding gc() at the end of the loop. And monitor the system memory to see if that’s really the problem.
THANKS!
just “gc()” … nothing more specific?
Oh lord – i’m sooo lost with MS