Skip to content

Commit

Permalink
polypen: can knife selected edge (issue #1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
vxlcoder committed Jan 11, 2025
1 parent fbb8b31 commit 225f242
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions retopoflow/common/bmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def is_valid(self):
all(bme.is_valid for bme in self.loose_bmes),
))

def update(self, context, co, *, distance=1.84467e19, distance2d=10):
def update(self, context, co, *, distance=1.84467e19, distance2d=10, ignore_selected=True):
# NOTE: distance here is local to object!!! target object could be scaled!
# even stranger is if target is non-uniformly scaled

Expand All @@ -459,7 +459,8 @@ def update(self, context, co, *, distance=1.84467e19, distance2d=10):
bmes = []
if bme_idx is not None: bmes += [self.loose_bmes[bme_idx]]
if bmf_idx is not None: bmes += self.bm.faces[bmf_idx].edges
bmes = [bme for bme in bmes if not any(bmv.select for bmv in bme.verts)]
if ignore_selected:
bmes = [bme for bme in bmes if not any(bmv.select for bmv in bme.verts)]
if not bmes: return

inf = float('inf')
Expand Down
7 changes: 6 additions & 1 deletion retopoflow/rftool_polypen/polypen_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def update(self, context, event, insert_mode, parallel_stable):
if self.nearest.bmv:
self.hit = Vector(self.nearest.bmv.co)

self.nearest_bme.update(context, self.hit)
self.nearest_bme.update(context, self.hit, ignore_selected=False)


###########################################################################################
Expand All @@ -190,6 +190,11 @@ def update(self, context, event, insert_mode, parallel_stable):
self.state = PP_Action.VERT
return

if self.nearest_bme.bme:
if self.nearest_bme.bme.select and not self.nearest_bme.bme.hide:
self.state = PP_Action.EDGE_VERT
return

if len(self.selected[BMEdge]) == 0 or insert_mode == 'EDGE-ONLY':
if not self.nearest.bmv and self.nearest_bme.bme:
self.state = PP_Action.VERT_EDGE_EDGE
Expand Down

0 comments on commit 225f242

Please sign in to comment.