Create layers by materials - 3ds max

Hello I would like to know how can I create a script that locates the scene objects depending of the object materials and names the layer depending of the material name... thanks for your help!

Comments

Comment viewing options

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

Great script, thanks for

Great script, thanks for posting it.
Sometimes I have problems with it however. Max pops up an error about the addnode on the last line. I'm not experienced in scripting so any help would be great, thanks.

mainworks's picture

-- put objects onto layers

-- put objects onto layers one layer for each material and name the layer by the material name
-- by Olaf Finkbeiner for www.mainworks.de

layers = #()
obj = #()
for o in geometry where o.material != undefined do (append obj o)
m = scenematerials
c = m.count
for i = 1 to c do (
layername = m[i].name
layer = layermanager.newLayerFromName layername
for o in obj where o.material.name == m[i].name do (layer.addnode o)
)

mainworks's picture

Hi Mariano, i just looked

Hi Mariano,
i just looked for something that does that and could not find it... So i will write it now...

kind regards

Olaf

Comment viewing options

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