Notifications
Clear all

[Closed] Edit Poly Modifier – Better way to script this?


thePredex = "Tri_"
with undo off with redraw off 
		(
			max modify mode
			for i = 1 to (execute ("$" + thePrefex + "*")).count do
			(
				o = (execute ("$" + thePrefex + "*"))[i]
				select o
				
				addmodifier o (Edit_Poly())
				
				subobjectLevel = 4
				o.modifiers[1].Select #Face #{}
				o.modifiers[1].SetSelection #Face #{}
				o.modifiers[1].Select #Face #{2}
				o.modifiers[1].SetOperation #SetMaterial
				o.modifiers[1].materialIDToSet = 2
				o.modifiers[1].Commit ()
				subobjectLevel = 0
			)
)

I need to run this on thousands of objects, it’s really really slow using the Commit system…

All I need to do is change face 2 to materialID 2… has to be on top of the stack unfortunetly, seems a really slow way of doing it…

2 Replies

why do you add the Edit_Poly modifier at all. If need to change the face material ID you can use meshop or polyop interfaces; if you need to treat the object as editable_poly just convert the object to editable_poly.

My base node mesh has vertex animation on it, it’s just one poly, ontop of this a Shell and some other modifiers go on top, we need to change the ID of just one Face but keep the stack flexible and have the underlying animation there.