[Bf-extensions-cvs] [6d120f0] master: Fix T44567, take 2. Sometimes faces repeated the same Vert.

Howard Trickey noreply at git.blender.org
Fri May 1 20:08:42 CEST 2015


Commit: 6d120f0d2f75ed4271a48e78e4c79ab5d0940d1b
Author: Howard Trickey
Date:   Fri May 1 14:05:50 2015 -0400
Branches: master
https://developer.blender.org/rBA6d120f0d2f75ed4271a48e78e4c79ab5d0940d1b

Fix T44567, take 2. Sometimes faces repeated the same Vert.

This is really a different bug that the one that was reopened
but I didn't know that when I reopened it.
It shouldn't happen that vertices get repeated in a face, but
when doing it happens in extreme cases, and for now am fixing by
just removing those duplicates before calling the make-face routine.

===================================================================

M	mesh_inset/__init__.py

===================================================================

diff --git a/mesh_inset/__init__.py b/mesh_inset/__init__.py
index 19d8e71..316e459 100644
--- a/mesh_inset/__init__.py
+++ b/mesh_inset/__init__.py
@@ -155,7 +155,9 @@ def do_inset(mesh, amount, height, region, as_percent):
     start_faces = len(bm.faces)
     for i, newf in enumerate(blender_faces):
         bm.verts.ensure_lookup_table()
-        vs = [bm.verts[j] for j in newf]
+        vs = remove_dups([bm.verts[j] for j in newf])
+        if len(vs) < 3:
+            continue
         # copy face attributes from old face that it was derived from
         bfi = blender_old_face_index[i]
         if bfi and 0 <= bfi < start_faces:
@@ -175,6 +177,9 @@ def do_inset(mesh, amount, height, region, as_percent):
     for face in new_faces:
         face.select_set(True)
 
+def remove_dups(vs):
+    seen = set()
+    return [x for x in vs if not (x in seen or seen.add(x))]
 
 def panel_func(self, context):
     self.layout.label(text="Inset Polygon:")



More information about the Bf-extensions-cvs mailing list