select object with VRayFastSSS2 material
I want to find and select all object in my scene which have assign VRayFastSSS2 material on it. I evaluate the below script, it print "ok" in maxscript listener, but didn't select any object from the scene? Hoping someone from here can help me, thank you.
select (for o in objects where o.mat == (getClassInstances VRayFastSSS2) collect o)
Comments
In both of examples we use
In both of examples we use getClassInstances VRayFastSSS2 to get all instances of VRayFastSSS2 material as an array.
Then in first example we iterate through all scene objects and check if array of VRayFastSSS2 (from previous step) contains current object's material and if it does collect this object. And then select objects that are collected
In second example we iterate through collected VRayFastSSS2 materials and collect objects that're dependents of this material.
And then again select collected objects
Suggest you to check maxscript reference for a in detail explanation
getClassInstances
getClassInstances VRayFastSSS2 -- returns array
o.mat -- returns material if it's applied or undefined
These two will never be equal so it's meaningless to compare them.
You will always get an empty array as a result.
But what if your sss material is a submaterial?
That's the way to go
jahman, thank you for reply,
jahman, thank you for reply, both of your code are work!
i don't understand my code also got a selectMore obj, but why it didn't select anything?
could please explain abit detail about your code?
Regards,
Jackie Teh
website: https://www.sporadicstudio.com/