Notifications
Clear all

[Closed] check if vray is installed

Since I’m developing a small script which should allow accessibility of a radiobutton, depending on an installed copy of VRay, I wanted to know whether it is possible with MAXScript to check if there’s a copy of VRay running or not.

Any suggestions?

5 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

To see if V-Ray is INSTALLED on the system, you can call

fn isVRayInstalled = (
 (for o in rendererClass.classes where matchPattern (o as string) pattern:"*V_RAY*" collect o).count > 0)

isVRayInstalled() returns TRUE if V-Ray is among the available renderer classes, false otherwise.

If you want to know whether the CURRENT renderer is V-Ray, you can do something similar:

fn isVRayCurrent = matchPattern (renderers.current as string) pattern:"*V_RAY*"
  

isVRayCurrent() returns TRUE if the current renderer is some version of V-Ray.

You can also check against the ClassID.

fn isVRayCurrent2 = renderers.current.classid as string == "#(1941615238, 2012806412)"
 

Hope this helps.

 rdg

you can try()catch() if you can create a vray material. Or activate the renderer.
I would try the material.

Georg

this is one way to do it:


  -- check if vray is installed
  if (vray != undefined) then
  (
  	--vray is installed
  	print "V-Ray is installed"
  	
  	-- check if vray is set to current renderer
  	if (renderers.current as string) == ((vray as string) + ":" + (vray as string)) then
  	(
  		-- vray is set to current renderer
  		-- do whatever
  		print "V-Ray is set to current renderer"
  	)
  	else
  	(
  		-- vray is not set to current renderer
  		print "V-Ray is not set to current renderer"
  	)
  )
  else
  (
  	-- vray is not installed
  	print "V-Ray is not installed"
  )
  

if vray is not set to current you can make it current before running the rest of your script

Hope that helps

 rdg

matt,

your sample looks well.
I had the impression that vray ads RCx to its render string and it is hard to get it. Thats why I suggested the material route.

I will try your sample.

Georg

yea i just wrote that out on vray 1.5 so i haven’t tested it with other vray versions, but i was hoping that using renderers.current would get around any problems from other versions since that should return the whole string, whatever it is, and checking that against the string returned by entering vray.

if that makes any sense…