fix [#28558] more edge_keys than edges
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Sep 2011 23:36:32 +0000 (23:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Sep 2011 23:36:32 +0000 (23:36 +0000)
release/scripts/modules/bpy_types.py
release/scripts/startup/bl_ui/properties_data_modifier.py

index 101416f49430971d8c6fe6fa343c506b42d8aa37..ef03951108fc95f2560a75961af8e9d69d82c1ee 100644 (file)
@@ -356,7 +356,10 @@ class Mesh(bpy_types.ID):
 
     @property
     def edge_keys(self):
-        return [edge_key for face in self.faces for edge_key in face.edge_keys]
+        return list({edge_key
+                     for face in self.faces
+                     for edge_key in face.edge_keys
+                     })
 
 
 class MeshEdge(StructRNA):
@@ -376,17 +379,31 @@ class MeshFace(StructRNA):
         face_verts = self.vertices[:]
         mesh_verts = self.id_data.vertices
         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
+            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
+            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 = self.vertices[:]
         if len(verts) == 3:
-            return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[0])
-
-        return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[3]), ord_ind(verts[3], verts[0])
+            return (ord_ind(verts[0], verts[1]),
+                    ord_ind(verts[1], verts[2]),
+                    ord_ind(verts[2], verts[0]),
+                    )
+        else:
+            return (ord_ind(verts[0], verts[1]),
+                    ord_ind(verts[1], verts[2]),
+                    ord_ind(verts[2], verts[3]),
+                    ord_ind(verts[3], verts[0]),
+                    )
 
 
 class Text(bpy_types.ID):
index 058e8161fe6e3529f1d0f128f4c5b3092193cca2..348ca554e63a860214281fbd3d04caf16c3d0a0d 100644 (file)
@@ -738,7 +738,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "narrowness", slider=True)
 
     @staticmethod
-    def weight_vg_mask(layout, ob, md):
+    def vertex_weight_mask(layout, ob, md):
         layout.label(text="Influence/Mask Options:")
         split = layout.split()
         col1 = split.column()
@@ -798,7 +798,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
             # Common mask options…
             layout.separator()
-            self.weight_vg_mask(layout, ob, md)
+            self.vertex_weight_mask(layout, ob, md)
 
     def VERTEX_WEIGHT_MIX(self, layout, ob, md):
         if ob.type == 'MESH':
@@ -823,7 +823,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
             # Common mask options…
             layout.separator()
-            self.weight_vg_mask(layout, ob, md)
+            self.vertex_weight_mask(layout, ob, md)
 
     def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md):
         if ob.type == 'MESH':
@@ -850,7 +850,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
             # Common mask options…
             layout.separator()
-            self.weight_vg_mask(layout, ob, md)
+            self.vertex_weight_mask(layout, ob, md)
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)