|
Is there a way to get the index into this array as a string?
I have this ugly code:
if rootMaterial.mapEnables[1] then (
texMap = rootMaterial.maps[1]
if classOf texMap == BitmapTexture then
(
format "Ambient Map: %\n" texMap.filename to:outFile
)
)
if rootMaterial.mapEnables[2] then (
texMap = rootMaterial.maps[2]
if classOf texMap == BitmapTexture then
(
format "Diffuse Map: %\n" texMap.filename to:outFile
)
)
if rootMaterial.mapEnables[3] then (
texMap = rootMaterial.maps[3]
if classOf texMap == BitmapTexture then
(
format "Specular Map: %\n" texMap.filename to:outFile
)
)
if rootMaterial.mapEnables[4] then (
texMap = rootMaterial.maps[4]
if classOf texMap == BitmapTexture then
(
format "Specular Level Map: %\n" texMap.filename to:outFile
)
)
See the only difference in all those if blocks is the string I am using. This would be alot prettier if I could do a for loop instead.
Any suggestions on condensing?
I am brand new to maxscript
|
|
|
|
Your best bet is to check for the maps explicitly with <standard>.ambientMapEnable and <standard>.ambientMap and so on. You’re not guaranteed that the map channels line up that way even for the standard material. Each shader has it’s own list (see StandardMaterial and “Map Channels for Standard Material Shaders” in the help).
--
James Kelly
fo co mo so
|
|
|