diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2015-05-01 21:05:50 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2015-05-01 21:05:50 +0300 |
commit | 6d120f0d2f75ed4271a48e78e4c79ab5d0940d1b (patch) | |
tree | 745298e1aeaa175ebf6646ffe2f68ba530bfac45 /mesh_inset | |
parent | 44153e0c67f7ccbe3091215875c7f127ec847f1f (diff) |
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.
Diffstat (limited to 'mesh_inset')
-rw-r--r-- | mesh_inset/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mesh_inset/__init__.py b/mesh_inset/__init__.py index 19d8e711..316e4592 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:") |