Help with a simple script (clearing Material ID name)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So the following script (link) basically renames all material IDs of any Multi/Sub-object Material to the name of whatever materials are plugged into the ID slots. For example I have a material named "Plastic" which I plug into ID 1, then I run the script and ID 1 is now named "Plastic". If I unplug the material from ID 1 and run the script again, currently nothing happens and the ID is still named "Plastic". I want ID 1 name field to be empty, since nothing is plugged into it. Basically I want the script to erase the name of IDs when nothing is plugged into them.
macroScript matname
category:"# scripts"
buttonText: "Mat to ID"
toolTip:"Material Name to Mat ID Name"
(
-- loop through scene materials
for m in scenematerials do
(
-- when you find a multi material...
if classof m == multimaterial then
(
-- loop through the names
for n=1 to m.names.count do
(
-- and copy through any names of materials unless that mateiral is undefined or
if m.materialList[n] != undefined then (if m.names[n] == "" then m.names[n] = m.materialList[n].name)
)
)
)
)
Thanks in advance!
T