Notifications
Clear all
[Closed] Retrieving texture list with maxscript
Apr 28, 2005 10:33 pm
Hello,
So I know this is super simple, but how do you list all the texture paths in a scene using Maxscript?
Thanks!
2 Replies
Apr 28, 2005 10:33 pm
For starters, you’ll need the system global sceneMaterials. This is an array of all mats in the scene.[b][b]
[/b][/b]You should from there be able to index into that array and grab the filename (as I recall it’s something like bitmaptexture.filename).
Apr 28, 2005 10:33 pm
The following function will format and return all texture objects used in the scene. To modify this to inspect the Material Editor Window exchange the ‘allTextureFiles = (getAllTextureFiles sceneMaterials);’ with ‘allTextureFiles = (getAllTextureFiles meditMaterials);’
function getAllTextureFiles inputMaterials =
(
local allTextureFiles = #();
for eachMat in inputMaterials do
(
format "-- Material: %
" eachMat.name;
for i = 1 to (getNumSubTexmaps eachMat) do
(
try (if (getNumSubTexmaps (getSubTexmap eachMat i)) != 0 then
(
join allTextureFiles (getAllTextureFiles #((getSubTexmap eachMat i)));
)
) catch ();
if (isProperty (getSubTexmap eachMat i) #filename) then
(
append allTextureFiles (getSubTexmap eachMat i);
format "---- TextureFile: \"%\"
" (getSubTexmap eachMat i).filename;
);
);
);
return allTextureFiles;
);
allTextureFiles = (getAllTextureFiles sceneMaterials);