Varying the opacity of a material based on object name?
Say I have a large stack of planes, each mapped with a different diffuse/alpha map. I would like to then select these planes and apply a script to gradually vary the opacity of each plane?
Say I have "Plane001 - Plane 020"
I want to vary the total opacity of each plane so that Plane001 is completely opaque, and Plane 020 is completely transparent, with a gradient of steps in between.
I envision the script would take "100" and divide it by the number of planes in the stack. It would find that it needs to step down the opacity by 5% for each layer. It would do this based on layer name. For example, the lowest number within the plane name always has the highest opacity assigned to it.
So "Plane 10" would be 50% opacity, "Plane 15" would be 25% opacity, etc...
Ideally it would be a separate script that only applies this effect to the planes currently selected. This is actually pretty important, as I'd have a bunch of planes in the whole scene I don't want to do this with.
I can see this getting hairy though. I don't know how intelligent Maxscript is when it comes to applying functions in order based on object name.
The other thing I see being problematic is decimal handling. If I have an odd number of planes, I would hope that Max could round them. Say I have selected 65 planes. That means that they need to vary in opacity by 1.54% each step. I assume Max would just round up and call it a day, but since scripting textures seems to be independent from the material editor, I'm not sure.
Looking forward to any insight. Thanks!
P.S. Being able to apply something similar but with diffuse color mapping would be great as well, but I consider it a lower priority.
For example, to take a stack of 20 objects with ascending names, and get them to vary from one color to another based on RGB value inputs. I would imagine it could just interpolate the number for R, G, and B just like it would for the opacity gradient.