Notifications
Clear all

[Closed] a maxscript loop question

This is a loop maxscript,it can work.

but if scene have Multi/sub-object, it can’t work. why

code:

(sms = sceneMaterials
for i in sms do (
i.Soften = 0.1
)
)

6 Replies

It’s because your multi\material isn’t technically a material, it’s an array of materials so your code will have to look something like this

mats = sceneMaterials

for mat in mats do
(
if (classof mat == standardMaterial) then
mat.soften = 0.1

else if (classof mat == multimaterial) then
(
	for sMat in mat do
		sMat.soften = 0.1
)

)

Hope this helps

Thanks Wahooney!!~:bowdown: :bowdown: :bowdown:

That would only work for one level of multi materials (I think). I would think that this needs to be recursive, but I am not sure if that can be done in max.

As far as I know you can only effectively have one level in a multimaterial. Reason being that max doesn’t have any kind of compound/complex material ID assignment.

I understand now about nested multi/subs not working, but I am still not sure how it works for other compound materials (such as composite). I do not know if they are treated as distinct materials, or what.

Btw, thanks for the explanation Wahooney. Helped me too.

My pleasure