How to select all object with Vray material in scene

Hi,

I'm stucked here. How can i select all object with Vray materials in a max scene?

This does not work:

vmats = for o in objects where (findItem vray_materials (classof o.material)) > 0 collect o

Edit: I'm usin 3ds max 2012 and Vray1.5

Comments

Comment viewing options

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

In case someone needs a

In case someone needs a script for the same purpose.
Here is a fast, dirty and functional script (thanks to Anubis)

--Destroy the dialog if it is already open 
try(destroyDialog roll_matselection)catch()
 
-- UI STUFF
rollout roll_matselection "Material Selector V1.0"
(
		group "Select Materials:"
		(
		button btn_VRay "Select Object with VRay Materials" height:22 width:190 tooltip:"Select Object with VRay Materials" align:#center
		button btn_Standard "Select Object with Standard Materials" height:22 width:190 tooltip:"Select Object with Standard Materials" align:#center
		button btn_MentalRay "Select Object with MentalRay Materials" height:22 width:190 tooltip:"Select Object with MentalRay Materials" align:#center
		button btn_Brazil "Select Object with Brazil Materials" height:22 width:190 tooltip:"Select Object with Brazil R/S Materials" align:#center
		)
 
		HyperLink hl_homepage "..:: Raymond H. Ingebretsen ::.." address:"http://www.homme3d.com/" color:(color 255 255 255) hovercolor:(color 111 111 111) visitedcolor:(color 255 255 255) align:#center
 
 
	-- select all objs with VRay mat's
	on btn_VRay pressed do
	(
		select (for o in objects where o.mat.category == #vray collect o)
	)
 
	on btn_Standard pressed do
	-- select all objs with standard mat's
	(
		select (for o in objects where o.mat.category == #standard collect o)
	)
 
	on btn_MentalRay pressed do
	-- select all objs with mr mat's
	(
		select (for o in objects where o.mat.category == #mental_ray collect o)
	)
 
	on btn_Brazil pressed do
	-- select all objs with brazil mat's
	(
		select (for o in objects where o.mat.category == #Brazil_r_s collect o)
	)
 
) -- End Rollout
 
-- Create Dialog Stuff
createDialog roll_matselection 210 160 pos:[150,150] 

/ Raymond

tassel's picture

The solution you came up with

The solution you came up with did the job, so i used this with VRay:
select (for o in objects where o.mat.category == #vray collect o)

Thank you so much :)

EDIT: The purpose was to select all objects in the scene with Vray materials, and fix them to arc_and_design for rendering with Mentalray.

/ Raymond

Anubis's picture

try .category

What your vray_materials array hold? If their're classes then your code would work fine. Also may try ".category" property of the material. Examples:

-- select all objs with standard mat's
select (for o in objects where o.mat.category == #standard collect o)
 
-- select all objs with mr mat's
select (for o in objects where o.mat.category == #mental_ray collect o)
 
-- select all objs with brazil mat's
select (for o in objects where o.mat.category == #Brazil_r_s collect o)

I not work with VRay, so just select 1 vr-mat and get the category from it ;) Cheers!

my recent MAXScripts RSS (archive here)

Comment viewing options

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