Hi, Duplifaces are using face vertex order to determine duplifaced instace rotation.
I managed to find, and customize to my needs, script for rotation of selected faces (it just matter of getting list of face vertices, and then putting first vertex to the end of vertex list). This way we can rotate face. Code:
mesh = bpy.context.active_object.data bm = bmesh.from_edit_mesh(mesh) for face in bm.faces: if (face.select): vs = face.verts[:] if self.rotRight!=True: vs2 = vs[1:]+vs[:1] # put first vertex on end of list to rotate right else: vs2 = vs[len(vs)-1:]+vs[:len(vs)-1] # put last element at beginign to rotate left # face.verts =vs2 # fails because verts is read-only bm.faces.remove(face) f2 = bm.faces.new(vs2) f2.select = True bm.normal_update() # trigger UI update bmesh.update_edit_mesh(mesh)
Now I want to unify all faces rotation, because for lots of faces, manual fixing of each face rotation is not an option. I started by using:
Above command is not changign actual face rotation, it is just sorting vertex index number. But I could use this, to find first vertex for each face - first vertex would be the one with smallest index number (in image above it would be bottom left vertex for each face). But I’m stuck, how do I get next verex in clockwise direction, to create vertex list used for face creation (faces.new(VertsListClockwise))?
Or maybe there is different way to unify dupliface rotation without using sort_elements? Preferably it should work not only on planar mesh area in view_xaxis, but on whole mesh, that can have any shape. Maybe something like: foreach face: get previous face rotation and copy it. But it could be problematic for faces that have different number of edges…