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
Forum topic · General Scripting
By tassel · 2011-09-19
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
tassel · 2011-09-19
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]
tassel · 2011-09-19
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.
try .category
Anubis · 2011-09-19
What your
vray_materialsarray 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!