ScriptSpot home

Forum topic · General Scripting

Changing the renderer to Vray

By Script_Butler · 2012-07-10

Description

Hi all.

I've been reading a lot and done a lot of google searching but am having zero success.

All I want to know is what to write to switch the renderer to Vray.

I currently have tried

vr=renderers.current

and

renderers.current = V_Ray_Adv_1_50_SP6

both do nothing for me......

This should be so simple! But when i change to the vray renderer manually nothing prints to the listener.

Any help welcome.

Comments (8)
j_forrester

For Scanline

renderers.current = Default_scanline_renderer ()

For Mental Ray

renderers.current = mental_ray_renderer ()

For Vray

renderers.current = Vray()

Script_Butler

I have

Thanks for the reply.

I have input that and get V_Ray_Adv_1_50_SP6:V_Ray_Adv_1_50_SP6

when the renderer is on Default Scanline and i type in vr=renderers.current it get
vr=renderers.current

Default_Scanline_Renderer:Default_Scanline_Renderer in the listener. It doesn't change it to Vray like it has been suggested it should.

Reply to Script_Butler
Branko Živković

The Solution

This one line of code work fine

for r in 1 to (rendererClass.classes).count where matchPattern ((rendererClass.classes)[r] as string) pattern:"V_Ray_Adv*" do Renderers.Production = RendererClass.Classes[r]()

Reply to Branko Živković
Script_Butler

Isn't there a simpler way?

Thank you for that solution barigazy. I am such a beginner I wouldn't of had a clue it would involve such a complicated sting. (It's complicated to me anyway!!)

Is there not a simpler way though?

Reply to Script_Butler
Branko Živković

another solution

First one line of code is flexibile.You can run any version of VRAY.
I use max2012 and Vray 2.3 and works well.
But in your case try this


renderers = rendererClass.classes
idx = finditem renderers V_Ray_Adv_1_50_SP6
Renderers.Production = renderers[idx]()


or just use


renderers.current = V_Ray_Adv_1_50_SP6()

Reply to Branko Živković
Script_Butler

Lovely

Thanks again for the explanation. It would be silly of me not to use the first version really as if we upgrade to vray 2, which we will eventually, my script will continue working.

But having a simpler line of code also is great for me as a learner. It seems i needed the open/closed brackets. Can i just ask why these are needed?

TsveTan

""

Had you tried input renderers.current to the listener to see what syntax, supposing vray is current renderer when you write this?