[Closed] Finding material and textureslot by filename
Hi,
I’m trying to do some automated analyses of 3dsMax files which contain materials with bitmaptextures. What I’m trying to achieve is the following:
[ul]
[li]go through each of the image files in the asset tracker[/li][li]figure out where the images are used in the materials[/li][li]store some material information in a text-file[/li][/ul]I’m not able to do the second point. I’m using all sorts of combinations of refs.dependents and refs.dependson but I’m stuck when I have found the bitmaptexture and the material. I’m unable to determine which channel the bitmaptexture is applied to. Is it a diffusemap, a bump, specular etc. The material type is unknown, it could be standard, vray or anything else.
Is there a way to ask a bitmaptexture in which textureslot it sits in a material?
I don’t know a simple way. Moreover if the material/texture do not expose the property to MXS.
Perhaps you can find something useful along these lines?
fn GetMatPropertiesUsingMap mat mapFilename =
(
stream = "" as stringstream
showProperties mat to:stream
seek stream 0
props = #()
while not eof stream do
(
propName = (filterstring (readline stream) ".: ")[1]
if not ispropertyanimatable mat propName do
(
prop = getproperty mat propName
if classof prop == bitmaptexture and prop.filename == mapFilename do append props (propName as name)
)
)
free stream
return props
)
It needs to be modified to work with nested materials/maps.
take a look at:
getclassinstances bitmaptexture astrackviewpick:on
see some examples on this forum and more details in the mxs help