Vray Script Help

Hello everyone.. Well I'm new to learning scripting and have been reading here and there trying to learn what I can about Max script. I came to making a basic script and kinda got to a part where im kinda stuck on how to get the rest of this done with out errors. I was needing a script that would grab all the Vray proxys and convert them all at once. But the only problem is that if an object isnt a vray mesh it creates an error. And does make sence as to why it puts an error up. I guess im needing a way to tell the script to ignore anything that isnt a vray mesh and execute only on the vray proxy mesh objects. Here is what I've come up so far. Any help is appreciated.

Thank you
Alex

-- Known Bugs
-- Only works on Vray proxys, Selecting anything other than proxy creates error
-- Created 2010 for Vray 1.50SP4a

rollout vray_buttons "Proxy Switch V.001"

(
label label1 "Select Proxys and press button"
button button1 "Bounding Box" border:false
on button1 pressed do
$.display=0
button button2 "Preview from file" border:false
on button2 pressed do
$.display=1
button button3 "Mesh" border:false
on button3 pressed do
$.display=3
label label2 "Created for Vray 1.50SP4a " style_sunkenedge:true width:150 height:16
)
createdialog vray_buttons 170 130 bgcolor:gray fgcolor: [0,255,255]

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
edgemaster's picture

Very cool!

Cool Anubis that worked! Thank you both for your replies and helping me out with this piece of code. Like I said I'm still fairly new to learning Max script (or any type of scripting). And this script is gonna come in handy in future projects.

Anubis's picture

If you wish to work on

If you wish to work on concrete class (to avoid errors), just filter current selection by collecting only objects you need. I'm not use Vray, so check the class of Vray proxy yourself by selecting single vp object and run "classOf $". Then example filtering w'd like:

vpArray = for obj in selection where
      classOf obj == <THE_CLASS_HERE> collect obj 

my recent MAXScripts RSS (archive here)

edgemaster's picture

Im still fairly new to

Im still fairly new to learning Max script or any scripting in general. I posted what I had inserted in the script. But yeah I'll look for the scope brackets you mentioned to make my script cleaner and easier to navigate. Thanks for the quick reply.

it gives this error when running it.
--No ""showProperties""funtion for $selection

--this is what i did.

rollout vray_buttons "Proxy Switch V.001"

(
label label1 "Select Proxys and press button"
button button1 "Bounding Box" border:false
on button1 pressed do
if hasProperty $ "display" do $.display=0
button button2 "Preview from file" border:false
on button2 pressed do
if hasProperty $ "display" do $.display=1
button button3 "Mesh" border:false
on button3 pressed do
if hasProperty $ "display" do $.display=3
label label2 "Created for Vray 1.50SP4a " style_sunkenedge:true width:150 height:16
)
createdialog vray_buttons 170 130 bgcolor:gray fgcolor: [0,255,255]

Graph's picture

if hasProperty $ "display" do

if hasProperty $ "display" do $.display=0

not the preetiest way but i dont have vRay on this machine so cant check what class vRay proxys are

and please get used to using scope brackets (or whatever their called), when your scripts get bigger its much easier to navigate (ctrl(+shift)+B)

while your in the helpfiles, look up radiobuttons, i think for the purpose of this one they will fit better and neater (you can directly use the UIItem's value in as the display value)

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.