ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
DETECT MAT ID FOR THE TEXTURES INSIDE MULTISUBOBJECT MATERIAL
Submitted by artrender.info on Tue, 2013-02-12 10:02
And how can I find out the IDs for all the textures in a certain multisubobject material (not especial for a certain object to find IDs from faces but inside material)
mat = meditMaterials[activeMeditSlot]ifclassof mat != multimaterial then
messageBox "Select a MultiMaterial!"else(
mIDList = mat.materialIDList
format"Sub-materials (ID | Material):\n"for m in mIDList doformat"\t% | %\n" i mIDList[i]
txtList = for i in mIDList collect \
#(i, getClassInstances bitmaptex target:mIDList[i])for itm in txtList doformat"Textures under mat with ID: %\n\t%" itm[1] itm[2])
rollout subIDTest "Untitled" width:211 height:176(
button btn "Button" pos:[58,134] width:89 height:32
listBox idList "ListBox" pos:[20,7] width:165 height:7
local id = #()
local derp = #()
on btn pressed do(
mat = meditMaterials[activemeditslot]ifclassof mat == multimaterial then
(
id = mat.materialIDlist
for i in 1 to id.count do(
append derp (id[i] as string)
idList.items = derp
))else(
messagebox "Select a multimaterial!")))
createdialog subIDTest
Comments
Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeey
Thaaaaaaaank youuuuuu BOTH! You're all AWESOME! But tell me please, who could answer to this question http://www.scriptspot.com/forums/3ds-max/general-scripting/detect-map-trees-for-all-the-textures
or...
my recent MAXScripts RSS (archive here)
For my sake, can you explain
For my sake, can you explain why you modified my code the way you did? I'm still learning and have no idea about Maxscript best practices.
Hi PerfectCell
Why you think I modify your code?
Your code only display mat id's in listBox, but not the textures under them (what is the actual user question).
Also for simplify sake my code has no ui rollout.
my recent MAXScripts RSS (archive here)
Oh ok. I understood his
Oh ok. I understood his question differently.
I made a rollout so he could simply dump the code into his scene and have an instant visual result to see what's going on and play with it from there.
Thanks for the reply.
See what you can get out of
See what you can get out of this ;)