diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-13 20:58:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-13 20:58:26 +0300 |
commit | 58f13d469ee923a2c4c114cd035c69312684a247 (patch) | |
tree | 93388f438c2a241f6abe9d6332eed8781cf0a38b /release/scripts/modules | |
parent | 32f4877c8ca590e9d6bf1d5cdabb015158f094c2 (diff) |
UV mirror tool (copies UVs from one side of the mesh to the other)
WIP, suffers from editmode bug where editmode python tools cant have redo-options set. and needs options for precission.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 88dcb7eb8de..731757668bd 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -388,10 +388,19 @@ class MeshEdge(StructRNA): class MeshFace(StructRNA): __slots__ = () + @property + def center(self): + """The midpoint of the face.""" + face_verts = self.verts[:] + mesh_verts = self.id_data.verts + if len(face_verts) == 3: + return (mesh_verts[face_verts[0]].co + mesh_verts[face_verts[1]].co + mesh_verts[face_verts[2]].co) / 3.0 + else: + return (mesh_verts[face_verts[0]].co + mesh_verts[face_verts[1]].co + mesh_verts[face_verts[2]].co + mesh_verts[face_verts[3]].co) / 4.0 @property def edge_keys(self): - verts = tuple(self.verts) + verts = self.verts[:] if len(verts) == 3: return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[0]) |