-- function
fn findObjsByMtlName name = (
local theObjs = #()
theMtl = (for m in sceneMaterials where \
m.name == name collect m)[1]
if theMtl != undefined do (
theObjs = for n in (refs.dependents theMtl) where \
superClassOf n == GeometryClass collect n
)
theObjs
)
-- usage
select (findObjsByMtlName "Grass1")
Note that the function is case sensitive, ie "Grass1" is not equal to "grass1". I can modify it to become unsensitive using Max toLower() or toUpper() functions, but this way we risk to get more than one material and that is out of the goal.
No comments:
Post a Comment
Thanks for your comment