Maxscript materials

Hi,

I'm iterating over all materials in a selection in maxscript.
I want to replace the top/bottom materials with the bottom material from the current top/bottom shader.

I can't wrap my head around what I'm doeing wrong.
I don't see the result on the object in the material editor when I select an object with a top/bottom material on it ...

for o in $ where o.material != undefined do
(
if classOf o.material == topBottomMat then
(
copied_mat = copy o.material.bottomMaterial
o.material = copied_mat
)
)

Any ideas?

Regards
Bert

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

something like this should work

for item in getClassInstances topBottomMat where item != current_top_bottom do replaceInstances item current_top_bottom

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.