View Full Version : Selecting object by raytraced material
akisey 06-19-2007, 03:50 PM Hi
I'm new to Maxscript and I would like to create a script to select all the object in the scene which have a raytrace map in their material (diffuse or reflection slot)
I already tried a few things but failed. I think it can be done with one single for loop.
select (for o in objects where o.material ... = raytrace () collect o)
=> I wonder how to reach the material maps after o.material
Can anyone help me?
|
|
MoonDoggie
06-19-2007, 04:25 PM
Create a box, assign a standard material to the box and type:
show $.material
You'll find out all of the properties a material has, this one looks interesting!
.reflectionMap
If you put a raytrace material in the slot and type
classof $.material.reflectionMap
It spits out
Raytrace
evaluate:
(classof $.material.reflectionMap) == Raytrace
true
True! Perfect! You'll also want to check the classof $.material for RaytraceMaterial to get the actual RT Mat.
^ Use these to help you figure out these problems in the future :)
If you're using VRay Materials, then calling .diffuseMap will throw an exception, use the method described above to find it's properties! Also check for isProperty $.material #reflectionMap to see if it exists so it doesn't throw an error.
Best of luck Scripting,
Colin
akisey
06-19-2007, 06:27 PM
Moondoggie
I couldn't dream for a better reply than yours, thanks a lot for your very useful help!!!
It's all clear now :)
MoonDoggie
06-20-2007, 06:02 PM
Absolutely, Happy scripting!
-Colin
CGTalk Moderation
06-20-2007, 06:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.