[Bf-extensions-cvs] [9fe7021] master: Fix T47255: inset polygon addon left old edges

Howard Trickey noreply at git.blender.org
Mon Feb 1 16:19:48 CET 2016


Commit: 9fe70215a0a9ec58e338571c029a80a44b075d73
Author: Howard Trickey
Date:   Mon Feb 1 10:15:59 2016 -0500
Branches: master
https://developer.blender.org/rBA9fe70215a0a9ec58e338571c029a80a44b075d73

Fix T47255: inset polygon addon left old edges

Not sure why this used to work. The old code used the bmesh faceseq
delete, which kills only the faces. This fix uses the utility
bmesh.ops.delete() with an arg that will maybe kill edges and verts too.
Also made code select all the new polys. This is not ideal (ideal would
be to select only the inner ones), but making the ideal change requires
more work.

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

M	mesh_inset/__init__.py

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

diff --git a/mesh_inset/__init__.py b/mesh_inset/__init__.py
index 316e459..28fa213 100644
--- a/mesh_inset/__init__.py
+++ b/mesh_inset/__init__.py
@@ -151,10 +151,10 @@ def do_inset(mesh, amount, height, region, as_percent):
     for i in range(orig_numv, len(m.points.pos)):
         bvertnew = bm.verts.new(m.points.pos[i])
     bm.verts.index_update()
+    bm.verts.ensure_lookup_table()
     new_faces = []
     start_faces = len(bm.faces)
     for i, newf in enumerate(blender_faces):
-        bm.verts.ensure_lookup_table()
         vs = remove_dups([bm.verts[j] for j in newf])
         if len(vs) < 3:
             continue
@@ -167,13 +167,13 @@ def do_inset(mesh, amount, height, region, as_percent):
             # bfacenew.copy_from_face_interp(oldface)
         else:
             bfacenew = bm.faces.new(vs)
-    # remove original faces
+        new_faces.append(bfacenew)
+    # deselect original faces
     for face in selfaces:
         face.select_set(False)
-        bm.faces.remove(face)
-    bm.faces.index_update()
-    # mesh.update(calc_edges=True)
-    # select all new faces
+    # remove original faces
+    bmesh.ops.delete(bm, geom=selfaces, context=5)  # 5 = DEL_FACES
+    # select all new faces (should only select inner faces, but that needs more surgery on rest of code)
     for face in new_faces:
         face.select_set(True)



More information about the Bf-extensions-cvs mailing list