Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / standard material.maps
  RSS 2.0 ATOM  

standard material.maps
Rate this thread
 
26546
 
Permlink of this thread  
avatar
  • Total Posts: 45
  • Joined: 17 July 2007 03:08 AM

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



Replies: 0
avatar

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

Replies: 0