ScriptSpot

Forum topic · General Scripting

Maxscript materials

By Bert Van Eeckhout · 2021-01-12

Description

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 (1)

.

jahman · 2021-01-15

something like this should work


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