load vrmesh or vray proxy via maxscript

load vrmesh or vray proxy via maxscript

Anonymous
Not applicable
4,459 Views
3 Replies
Message 1 of 4

load vrmesh or vray proxy via maxscript

Anonymous
Not applicable

hello experts,

I have a problem with loading vrmesh via maxscript. here's the break down.
lets say

i have a setup for rendering many (meaning thousands of variations) objects. so i created them as proxies so i can render them in same setup.
also the proxy objects are instanced over a few places, so if need objects to be changed, they change at all places at once. so proxy worked this thing for me.
 
now i need to render each time, change proxy, change output path, and hit render again. i want to automate this process.

so i tried to write a maxscript which runs after each render, that can be done via postRenderEval MaxScript i read, but to load diff vrmesh sources
via maxscript? i am unable to do that. can someone please tell me how i can achieve this?

the scene has single proxy object, say named "vrayproxy001", which is instansed over places, and all vrmeshes files that i have prepared
 needs to be loaded in this object only, and rendered. so the object place
is exactly same. so basically here's what i want maxscript to do:
1. fire when render finishes
2. load the next vrmesh file in the folder located. (it can be done by default index numbering of the folder, doesnt matter)
3. change the output path accroding to the new vrmesh file name.
4. start render.

Can someone please help me out? really got stuck... 😞 😞
Thanks in advance.

0 Likes
4,460 Views
3 Replies
Replies (3)
Message 2 of 4

Swordslayer
Advisor
Advisor

Don't use postrender scripts, call render from a loop. Something like this (not tested and I don't even have vray here to test but it should get you started):

 

(
	local names = getFiles @"--vrmesh-path\*.vrmesh"
	local outputPath = @"--jpeg-path"

	local bm = bitmap renderWidth renderHeight gamma:1.0 hdr:true

	for name in names do
	(
		$vrayproxy001.filename = name
		render to:bm
		bm.gamma = fileOutGamma
		bm.filename = outputPath + getFilenameFile name + ".jpg"
		save bm
	)
)

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for this piece Swordslayer!

 

that i got... now just one more obstacle.

 

The macrorecorder returns this code for the action of changing the vrmesh through browse and locating it...

 

$VRayProxy001.filename = "{B28AD38B-E481-4946-869E-358A5494F0E4}"

 

and when i try to change it accroding to a real file address and name, the listener returns the path in blue, telling it finds the file allright, but the proxy turns to a box, meaning it doesnot loads it.

 

$VRayProxy001.filename = "{G:\eNVy\TestStuff\proxy_01.vrmesh}"

 

the proxy turns a box - as it does when no vrmesh file is assigned to a vrayproxy.

(i've checked the visibility options and also rendered, its blank for sure.)

 

 

so could you please tell me what would be the code to change a vrmesh through browse for a vrayproxy?

0 Likes
Message 4 of 4

Swordslayer
Advisor
Advisor

If you replace the @"--vrmesh-path\" part with some real path, like @"C:\temp\etc" and the same with @"--jpeg-path" (note the @ sign, verbatim string literal, without it you'd have to escape the \ character), it will do that for you; if you only want to do it once, it would be @"G:\eNVy\TestStuff\proxy_01.vrmesh".

 

By the way, macrorecorder is fine when you are just starting and playing around but as soon as you have even the slightest idea what a for loop is (or even before you do), work through the Learning Maxscript chapter of the maxscript reference and don't look back 🙂 Macrorecorder output is mostly unusable - and listener returning the path in blue doesn't tell you anything about it recognizing it as a file, it just returns the string (maxscript is expression based an every expression returns something, even if it is just OK or undefined) - you could just as well set it to "Heck, this is definitely not a file" and the result would be still the same.

0 Likes