Collect all Materials in scenematerials subnum node
Hey,
I was wondering if there's a less hard coded way of collecting all the materials that are wired into the scenematerials array such as multisubmaterial, blend, CoronaRaySwitchMtl, VRayBlendMtl and so on..
Each of these have different properties to check against for materials but I was hoping to see if it can be done to collect the materials in those slots by checking whether or not it's a material only node or material Array.
Has anyone done this successfully before.
HARDCODED METHOD EXAMPLE #1
crsmMat = meditMaterials[1] = CoronaRaySwitchMtl name:"CoronaRaySwitchMtl" giMat = crsmMat.giMtl
Returns:
CoronaRaySwitchMtl:CoronaRaySwitchMtl
Material #33:CoronaMtl
HARDCODED METHOD EXAMPLE #2
Mat = multimaterial numsubs:2 if Mat != undefined do objMatSubs = Mat.materialList
Returns:
#Multi/Sub-Object:Multimaterial(Standard:Material #34, Standard:Material #35) #(Material #34:Standard, Material #35:Standard)
It would be nice if scenematerial array would have a way to get those materials too.
PS.
I thought I could get those materials through the rootScene method but no luck.
w=rootscene[#Scene_Materials] for i in w.object do print i
Only returns same as the scenematerials array method. :(
Comments
You Can Use this Code :
Thanks to @Swordslayer
http://www.scriptspot.com/forums/3ds-max/general-scripting/detect-map-type-diffuse-bump-reflect-etc
Youtube, Gumroad
...
Try to play with getClassInstances fn
http://help.autodesk.com/view/3DSMAX/2016/ENU/?guid=__files_GUID_41314BE...
bga
`
Hey,
This should work:
...
Again maybe is smarter way to collect first all unique mats by class from scene materials and then search specific mat. Something like this (just concept)
I did'nt test this but as concept is ok
bga