NoisyMonk
07-29-2009, 01:37 AM
Two parts to this..
1: Pretty simple one here. I'm trying to write a script that will go through all (or just the currently selected object's) materials in my scene and rename the material, and also rename the diffuse (or any) map name.
I need to do this since I'm working on scenes that are being exported and used in a real-time app. And if 2 materials, or maps, have the same name, then they get all messed up and confused when exported. Don't ask me how this happens, but when merging/swapping scenes many different times, max sometimes doesn't rename duplicates.
I've tried.. showProperties($.material)
and gotten the list of properties for the currently selected object, but I don't see any for 'material name' or 'diffuse/spec/etc map name'.. am I just missing it? Or do I have to get it a different way? I'm pretty sure I can handle the loop that will do all the work, but I just can't find the right properties.. any ideas?
I usually get the scene second hand, and have no control over how the other person organizes (or doesn't) the scene. Even if I can just rename them 'Material 1', 'Material 2', 'Map 1', 'Map 2', etc.. thats fine with me :P
Now that I think of it, something exactly like the 'Rename Objects' tool, but for materials.
-------------------
2: This one is a little more difficult, i think. The scenes that I'm working on are generally high poly (for renders), that I then convert to low poly (for real-time). As such, the materials are generally not 'Standard', and usually 'Arch&Design'. The real-time app we use obviously doesn't support these types of materials, so I have to go through each one, copy the attributes (usually only; diffuse color/map, spec level, and opacity) and switch them to 'Standard'. This is an utterly painful process (some scenes have 200+ mats). I'm looking to take care of this with some scripts.
I can think of a few way to do this one, but I'm looking for some advice. Should I just record the attributes that are useful (diffuse color/map, spec level, and opacity) into variables, create a new material, and then transfer over these attributes? Or can someone think of a different/better way?
Thanks in advance,
Noisymonk.
1: Pretty simple one here. I'm trying to write a script that will go through all (or just the currently selected object's) materials in my scene and rename the material, and also rename the diffuse (or any) map name.
I need to do this since I'm working on scenes that are being exported and used in a real-time app. And if 2 materials, or maps, have the same name, then they get all messed up and confused when exported. Don't ask me how this happens, but when merging/swapping scenes many different times, max sometimes doesn't rename duplicates.
I've tried.. showProperties($.material)
and gotten the list of properties for the currently selected object, but I don't see any for 'material name' or 'diffuse/spec/etc map name'.. am I just missing it? Or do I have to get it a different way? I'm pretty sure I can handle the loop that will do all the work, but I just can't find the right properties.. any ideas?
I usually get the scene second hand, and have no control over how the other person organizes (or doesn't) the scene. Even if I can just rename them 'Material 1', 'Material 2', 'Map 1', 'Map 2', etc.. thats fine with me :P
Now that I think of it, something exactly like the 'Rename Objects' tool, but for materials.
-------------------
2: This one is a little more difficult, i think. The scenes that I'm working on are generally high poly (for renders), that I then convert to low poly (for real-time). As such, the materials are generally not 'Standard', and usually 'Arch&Design'. The real-time app we use obviously doesn't support these types of materials, so I have to go through each one, copy the attributes (usually only; diffuse color/map, spec level, and opacity) and switch them to 'Standard'. This is an utterly painful process (some scenes have 200+ mats). I'm looking to take care of this with some scripts.
I can think of a few way to do this one, but I'm looking for some advice. Should I just record the attributes that are useful (diffuse color/map, spec level, and opacity) into variables, create a new material, and then transfer over these attributes? Or can someone think of a different/better way?
Thanks in advance,
Noisymonk.
