dictionarymaxscript3ds

Replacing 3DS Max Material Maps file paths


I'm trying to replace the file paths of all the materials and their maps from its standard file path to a unc file path.
My problem is that different types of materials can have different maps associated with them, especially when you consider V-Ray materials. I'm hoping there's a way to change the filename by iterating through the map numbers of each material in a scene with two nested while loops like:

i = 1   
while (i < 24) do(
    j = 1
    while (j < 24) do(
        if (meditMaterials[i][#Maps][j].filename != undefined) then(
            bitmap = meditMaterials[i][#Maps][j].filename
            convertBitmapUNC bitmap ....
        )
    )
)

Unfortunately, I'm not sure how to get the url of the bitmap based off its map number. It's easy to get it with .opacityMap or .bitmap, but that would take forever to code for all the different types of maps it could be.

Thanks in advance for the help!!


Solution

  • This code allows you to iterate all bitmap textures in your scene

    for bmt in getClassInstances bitmaptex do
    (
        print bmt.filename
        bmt.filename = "yournaminghere"
    )
    

    Read up on getClassInstances as it's very useful in many situations!