Notifications
Clear all

[Closed] Apply modifier to selections od objects

Hi all.
I have a simple question: I have an array of objects from the scene es:
scene = #($Mesh1, $Mesh2, $Mesh3)
and i want convert temporarily in one mesh : MeshTot because i need some functions like getvert and getFaces ecc…

Manually the Edit_mesh modifier is very useful because don’t create a new mesh but transform temporarily the selection in one objects, and for my script i need this way, but i don’t know now add this modifier for an array of objects !

1 Reply

this is a equivalent function that i use but i think isn’t well written and is slow for many objects in the scene

--objectsArray is the list of objects
  (
  		FacesMemo = for obj in  objectsArray collect obj.numFaces
  		format "Faces = %
" FacesMemo
  		theMesh = convertToMesh (copy objectsArray[1])
  		for i=2 to objectsArray.count do attach theMesh (copy objectsArray[i])
  		
  		VertsArray = for v=1 to theMesh.numVerts collect getVert theMesh v
  		UVWArray   = for v=1 to theMesh.numtverts collect getTVert theMesh v
  		format "Verts and UV = % %
" VertsArray.count UVWArray.count
  		i = 1
  		k = 0
  		FaceGroups=#()
  		for j=1 to theMesh.numFaces do
  		(
  		if k==FacesMemo[i] do
  			(
  			format "Faces% = %
" i FaceGroups.count
  			append FaceGroupsArray FaceGroups
  			FaceGroups = #()
  			k=0
  			i+=1
  			)
  		k+=1
  		append FaceGroups ((getFace theMesh j) - [1,1,1])
  		)
  		append FaceGroupsArray FaceGroups
  		delete theMesh
  		data = STRUCTURE  Groups:FaceGroupsArray  Verts:VertsArray   Quads:UVWArray
  )