[maxscript] recall material under sub-material

Hello,
how can recall in maxscript a material inside of sub-material? i can’t get it.

Thanks a lot.

Your question is unclear. Could you please rephrase and provide a clearer explanation of the problem?

If your object is using a MultiMaterial (maxscript doc), the property <object>.material.materialList is a list of the materials inside the multi material.

You can get the material a face in your object is using by the getFaceMatID function, and you can match it up via <object>.material.materialIDList

rollout RolloutTemplate "Rename Material from Mesh"
	(


		local sceneMats = #()

		
		
		button subDivsButton "Rename Mat from Mesh" width:170 height:30 pos:[0,20]
		on subDivsButton pressed do
		(
						
			
					
							for object in objects do
							(
							  
										for i in selection do
									(
									  
											
											object.material.materialList[i] = sceneMats[i]
											print(sceneMats.count)
									)
									
								
							)
						
				

		)	

		
	)

i have this code to make a “simple” script where:
renaming material (inside sub-material) like name of mesh.
each mesh have only one material
how can fix it?