I'm in need of a script to load and assign materials form material library's and assign the materials to the specific layers layers based on the material name to the layer name.
I was hoping I could add directories to the script.
Example: Layers: AFUPA-3D-TL-GL, AFUPA-3D-TL-BK assign Material "black plastic 123" from material library in a directory on my D-Drive an so on.
Also if the layer does not exist to skip it and move on.
Here is what I have based on Miauu awesome help.
I would appreciate any help! I'm trying to learn maxcript but is a bit overwhelming. :)
(
local layersNameAndMatArr = #(#("AFUPA-3D-TL-GL", meditMaterials[1]), \
#("*Black Plastic 123", meditMaterials[2]), \
#("White Plastic 125", meditMaterials[3]) )
for i = 0 to LayerManager.count - 1 do
(
local layer = LayerManager.getLayer i
for j = 1 to layersNameAndMatArr.count do
(
if matchPattern layer.name pattern:layersNameAndMatArr[j][1] do
(
local theNodes
layer.nodes &theNodes
theNodes.material = layersNameAndMatArr[j][2]
)
)
)
)
miauu · 2016-02-03