DETECT AND CLEAN UNUSED TEXTURE FROM THE SCENE
how to detect is a texture used on any object or not!
Lets say I have in my scene missing textures that are not used at all in my scene, or may be I have an object with ids: 1,2,3 with a multimaterial with 4 IDs where the textures
001.jpg for ID 1
002.jpg for ID 2
003.jpg for ID 3 and
004.jpg for ID 4!
It means there are 2 situation:
004.jpg is used in material and is unused in object!
It would be wonderful to list textures as following:
in objects
d:\folder\textures\001.jpg used
d:\folder\textures\002.jpg used
d:\folder\textures\003.jpg used
d:\folder\textures\004.jpg unused
and for example I want to delete the unused material with all its textures from multisubmaterial!
Any comments and ideas are welcome!
Comments
Smth from Barigazy:
This is how to clean:
This is how to detect textures in modifiers:
...
Search about mapPaths struct inside mxs help.
bga
oh!
You answer so fast!!!
example
bga
If mapPaths.getFullFilePath
If mapPaths.getFullFilePath returns empty string them map is missing.
-----------------------------------------------------------------------
U can use function "usedMaps()" to what is used in the scene.
Also u can predefine map classes like bitmaptex, VrayHDRI etc. then use "getclass instance" of theses clasess. After that search for the property which hold string. If not exists then collect only theses maps and search which material have this and in which slot they are. And at the and use function
setproperty testmaterial diffusemap undefined
bga
the bigest difficulty that I
the bigest difficulty that I have is to detect unused textures in scene and to find where are (were) they located in 3d max scene (materials, modifiers, viewport background, lights etc)!
I use to download often 3d models from internet and there are models that were "saved selected as" from their native scenes inside which there were missing files! Now when I open this model, I get missing files! How to clean them? There are cases when they are not in mtl editor, not in mtl slate mode! Nowhere! Here is an example
http://www.scriptspot.com/files/3ddd1366191879.rar
Take a look to this max file! How to detect the location of its 2 missing files through script? and how to clean them?