Notifications
Clear all

[Closed] can you solve the question?

Close“`thx!!!

9 Replies

I’m not sure I understand what you’re asking.

Do you mean:

You have an OBJECT with map/material ID’s
You want to “scan” that object and BUILT a multi/sub material with the appropriate id’s assigned to the correct number of slots…or are we just completely confused…??

Shane

1 Reply
(@sunboy69)
Joined: 11 months ago

Posts: 0
  Oh, I'm sorry I didn't say clearly and thanks for your answer.For this:
  Because in the Max,there're some objects,So in the material editor there're some materials and multi/sub-objs,now I want to make a new multi/sub-obj and put only all the scenematerials in the new multi/sub-object, If there're some multi/sub-objs in the material editor,please put all materials of them in the new multi/sub-obj,And the result is: in the material editor,there is only one multi/sub-object,and in the mult/sub-object, there is only scenematerials and could’t have some multi/sub-object.Notice:In the end it don't have the repeated materials,Can you help me to put the scenematerials of some multi/sub-objs in the new multi/sub-obj use the script?

Yes, I have a solution. I’m some what disappointed by how easy that was…

Shane

1 Reply
(@sunboy69)
Joined: 11 months ago

Posts: 0

Oh,thanks! It’s hardly for me to write the script,Because I’m studing maxscritp now,waitting for you,honorific!!!

This is the basics

(

	--local lstMaterials = #()
	
	/*
		Returns all the materials and sub materials contained by the parent material
		
		The optional material list provides a means to weed out duplicates...
	*/
	fn getAllMaterialsFrom mParent materialList:#() = (
		
		local lstTextures = #()
		
		for iIndex = 1 to (getNumSubMtls mParent) do (
			
			local subMtl = getSubMtl mParent iIndex
				
			if subMtl != undefined do (
				
				-- Makre sure our parent list doesn't already have the
				-- material
				if (finditem materialList subMtl) == 0 then (
					
					append lstTextures subMtl
					
					join lstTextures (getAllMaterialsFrom subMtl materialList:materialList)
					
				)
				
			)
			
		)
		
		lstTextures
			
	)

	-- Create the master material array	
	local lstMaterials = #()
	for mat in sceneMaterials do (
	
		join lstMaterials ((getAllMaterialsFrom mat materialList:lstMaterials))
			
	)
	
	-- Create the new multi material and place it in the material editor at slot 1	
	medit.PutMtlToMtlEditor (MultiMaterial name:"Super Multisub" numsubs:lstMaterials.count mm.materialList:lstMaterials) 1

)

I’m sure there’s room for improvement, but there’s a start…

Yes,dear RustyKnight!! Thank you so much for your great help all the time!
I can read it in a measure,but i could’t accomplish the script still.

Please clarify what you mean. What is the script missing that it isn’t doing for you?

I think he means that he doesn’t yet know how to write the script himself…