DETECT MAT ID FOR THE TEXTURES INSIDE MULTISUBOBJECT MATERIAL

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)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
artrender.info's picture

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

Anubis's picture

or...

mat = meditMaterials[activeMeditSlot]
if classof mat != multimaterial then
	messageBox "Select a MultiMaterial!"
else
(
	mIDList = mat.materialIDList
 
	format "Sub-materials (ID | Material):\n"
	for m in mIDList do
	format "\t% | %\n" i mIDList[i]
 
	txtList = for i in mIDList collect \
	#(i, getClassInstances bitmaptex target:mIDList[i])
 
	for itm in txtList do
	format "Textures under mat with ID: %\n\t%" itm[1] itm[2]
)

my recent MAXScripts RSS (archive here)

PerfectCell's picture

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.

Anubis's picture

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)

PerfectCell's picture

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.

PerfectCell's picture

See what you can get out of

See what you can get out of this ;)

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]
 
		if classof 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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.