Unique Material ID for polygon for editable mesh for multiple selection.
I've been learning to Maxscript and
I've be trying to create unique material id for polygon faces for editable mesh objects.
I found a code below that's been able to do so by selecting an object.
But somehow I can only do so one selection at a time. My model has 1000 objects.
And I would love to select all and do the below function for each of the objects automatically.
I've been dissecting the code but with no prevail...
Thanks so much for any help at all.
fn setPolygonMtlID obj =
(
local obj = selection[1]
local uniqueFaces = #()
for f in 1 to obj.numfaces do appendifunique uniqueFaces ((meshop.getPolysUsingFace obj #{f}) as array)[1]
meshPolygonsArr = for i in uniqueFaces collect ((meshop.getPolysUsingFace obj #{i}) as array)
for mid in 1 to meshPolygonsArr.count do
(
for f in meshPolygonsArr[mid] do setFaceMatID obj f mid
)
free meshPolygonsArr ; free uniqueFaces ; update obj
)
for obj in selection where iskindof obj.baseobject Editable_Mesh do
(
setPolygonMtlID obj.baseobject
)
Comments
.
Tools and Scripts for Autodesk 3dsMax
Genius!!!!
OMG THANK YOU SO MUCH!!!!