Basic Maxscript help please

I’ve just started playing around with Maxscript and I’m trying to write a bit of code to turn off the max frame buffer and turn on the Vray frame buffer. I can turn off the max frame buffer using the following code -

rendShowVFB = off

I can’t seem to find a way to use the Vray VFB instead. Is it possible?

Please excuse the simple question, I only started using Maxscript half an hour ago :smile:

Nevermind, I figured it out -

vr = renderers.current
vr.output_on = true

I’m not sure how you’re implementing this, but just so you know if you enable the V-Ray frame buffer, you don’t have to disable the max frame buffer :slight_smile:

If you’re making a button or shortcut, try this:

vr = renderers.current
if classof vr == V_Ray_Adv_2_10_01 then 
	(
	vr.output_on = true
	)else messagebox "You're not using V-Ray!"

Or if you want to toggle try this:

vr = renderers.current
if classof vr == V_Ray_Adv_2_10_01 then 
	(
	if vr.output_on != true then (vr.output_on = true) else (vr.output_on = false)
	)else messagebox "You're not using V-Ray!"

You would need to change ‘V_Ray_Adv_2_10_01’ to your version of V-ray, but I’m guessing a boffin here knows a better way to handle that than me.

You can use:


vr = renderers.current
if matchPattern ((classOf vr) as String) pattern:"*V?Ray*" then
...

Excellent - thank you! :smile: