diff options
-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:") |