[Closed] Selecting by self-illu in Multimaterials
Im learning Maxscript and Im trying to select the objects in the scene which have “selfIllumAmount >0”.
It works fine if the material its “Standard” but if its “Multimaterial” isnt so easy.
I have problems with searching in every submaterial.
ie:
select (for o in Geometry where (o.material != undefined AND classof o.material != Multimaterial AND (o.material.selfIllumAmount >0) OR (classof o.material == Multimaterial AND (o.material.materialList[1].selfIllumAmount >0))) collect o)
It works fine, but it search just in the first material from the multimaterial ” [1] “. I dont know how can I build a variable for all submats.
How can I add this loop on the “collect” function? (This works fine alone but not in the “collect”)
ie:
for x = selection do
(
for h = 1 to x.material.numSubs do
(
x.material.materialList[h].selfIllumAmount =…
)
)
What I dont undestand neither is why here looks so easy
ie:
for i in 1 to sceneMaterials.count do
(
if classOf i == Multimaterial do
(
for r in i do
(
if r.selfIllumAmount = …
)
)
)
I dont have to write ” r.material.materialList[h].selfIllumAmount ” , “r.selfIllumAmount” its enough…
With the last script Im able to change the selfIllumAmount in every material on the scene… but I want to the select the objects too!!!
Who can help me?
thanks!!
Esteban
That might work: I edited your code (bold)
select (for o in geometry where o.material != undefined AND classof o.material != Multimaterial AND (o.material.selfIllumAmount > 0) OR (classof o.material == Multimaterial AND ([B]for m in o.material.materialList where m.selfIllumAmount > 0 collect m).count > 0[/B])) collect o
(I hope I got all brackets right…)
Note: It will also collect objects who have a MultiMat with an Mat with Illum > 0, but don’t use this Mat…
Thanks Piflik for the fast answer!
It works very good!
Thank you
Esteban