[Closed] Getting all of the bitmapTextures in a certain material?
I’m way overthinking this. There must be a simple way to collect all of the bitmaptextures from a specified material. I’ve tried
- recursively looping through getPropNames for the material
and - tried utilizing refs.dependents to get them, but they are not visible to it!
I have alot of different kinds of materials and basically I just need a simple list of the bitmaptextures applied to them, however far they might be nestled away in maps.
Any quick ideas or should I continue down the getPropNames route?
Thanks all,
Colin
Thank you! I’m opening it right now. I hope it’s easier than I’ve been making it out to be.
Not sure if you are still looking for a solution for this, but although bitmap textures do not appear when using refs.dependents on a supplied material it does work the other way around: refs.dependents on a bitmap texture will contain any materials it belongs to.
It requires a bit more calculation since it is cycling through all instances of bitmap textures, but this should do the trick.
fn getBitmapsFromMaterial mat =
(
local foundMaps = #()
for x in getClassInstances bitmaptexture do
(
for y in refs.dependents x where y == mat do
(
append foundMaps x
)
)
foundMaps
)
also have a peek at the “Material Common Properties, Operators, and Methods” topic near the bottom at the functions added since 3ds Max 6 – there’s functions there explicitly for accessing sub-materials and sub-maps of a given material/map only (so no fiddling with properties that never yield a material/map). Looping / traversing these should be pretty simple, and all you have to do is add any found bitmapTexture to an array.
refs.dependents -should- work as well, though? Just check if your material of interest is one of the dependent objects?
Excellent response! Thanks guys, I’ll figure out a solution using the methods you all posted. Thanks again,
Colin