Fix T100807: Snap Utilities Line doesn't create faces for non-boundary edges

This commit is contained in:
Germano Cavalcante 2022-09-05 11:36:38 -03:00
parent 8d63239a0e
commit 0cd92169d4
Notes: blender-bot 2023-02-14 18:15:01 +01:00
Referenced by issue #100807, Square didn't close with the Mesh: Snap_Utilities_Line addon
1 changed files with 21 additions and 1 deletions

View File

@ -170,8 +170,28 @@ def make_line(self, bm_geom, location):
break
ed_list.update(get_loose_linked_edges(v2))
ed_list = list(ed_list)
# WORKAROUND: `edgenet_fill` only works with loose edges or boundary
# edges, so remove the other edges and create temporary elements to
# replace them.
targetmap = {}
ed_new = []
for edge in ed_list:
if not edge.is_wire and not edge.is_boundary:
v1, v2 = edge.verts
tmp_vert = bm.verts.new(v2.co)
e1 = bm.edges.new([v1, tmp_vert])
e2 = bm.edges.new([tmp_vert, v2])
ed_list.remove(edge)
ed_new.append(e1)
ed_new.append(e2)
targetmap[tmp_vert] = v2
bmesh.ops.edgenet_fill(bm, edges=ed_list + ed_new)
if targetmap:
bmesh.ops.weld_verts(bm, targetmap=targetmap)
bmesh.ops.edgenet_fill(bm, edges=list(ed_list))
update_edit_mesh = True
# print('face created')