View Full Version : Getting all of the bitmapTextures in a certain material?
02-17-2009, 08:33 PM
I'm way overthinking this. There must be a simple way to collect all of the bitmaptextures from a specified material. I've tried
1. recursively looping through getPropNames for the material
2. 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?
Take a look at BSLib in blurscripts, get_maps_from_mat
02-17-2009, 08:43 PM
Thank you! I'm opening it right now. I hope it's easier than I've been making it out to be.
02-18-2009, 01:05 AM
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
02-18-2009, 01:11 AM
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?
02-18-2009, 03:01 PM
Excellent response! Thanks guys, I'll figure out a solution using the methods you all posted. Thanks again,
02-18-2009, 03:01 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.