Skip to content

Commit

Permalink
commenting
Browse files Browse the repository at this point in the history
  • Loading branch information
satabol committed Sep 25, 2023
1 parent bc644d8 commit 047b12a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 44 deletions.
2 changes: 2 additions & 0 deletions nodes/modifier_change/extrude_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def process(self):
if face_data:
face_data_matched = repeat_last_for_length(face_data, len(faces))

# see: https://github.com/nortikin/sverchok/pull/4999#issuecomment-1734256435
need_fake_face = True
loops = [[faces]]
if need_fake_face:
Expand Down Expand Up @@ -307,6 +308,7 @@ def process(self):

extrude_geom = new_geom

# see: https://github.com/nortikin/sverchok/pull/4999#issuecomment-1734256435
if need_fake_face:
for loop in loops:
bm.verts.ensure_lookup_table()
Expand Down
44 changes: 0 additions & 44 deletions nodes/modifier_change/mesh_separate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,50 +48,6 @@ def process(self):
verts_out = []
poly_edge_out = []
for ve, pe in zip_long_repeat(verts, poly):
# # build links
# node_links = {}
# for edge_face in pe:
# for i in edge_face:
# if i not in node_links:
# node_links[i] = set()
# node_links[i].update(edge_face)

# nodes = set(node_links.keys())
# n = nodes.pop()
# node_set_list = [set([n])]
# node_stack = collections.deque()
# node_stack_append = node_stack.append
# node_stack_pop = node_stack.pop
# node_set = node_set_list[-1]
# # find separate sets
# while nodes:
# for node in node_links[n]:
# if node not in node_set:
# node_stack_append(node)
# if not node_stack: # new mesh part
# n = nodes.pop()
# node_set_list.append(set([n]))
# node_set = node_set_list[-1]
# else:
# while node_stack and n in node_set:
# n = node_stack_pop()
# nodes.discard(n)
# node_set.add(n)
# # create new meshes from sets, new_pe is the slow line.
# if len(node_set_list) > 1:
# for node_set in node_set_list:
# mesh_index = sorted(node_set)
# vert_dict = {j: i for i, j in enumerate(mesh_index)}
# new_vert = [ve[i] for i in mesh_index]
# new_pe = [[vert_dict[n] for n in fe]
# for fe in pe
# if fe[0] in node_set]
# verts_out.append(new_vert)
# poly_edge_out.append(new_pe)
# elif node_set_list: # no reprocessing needed
# verts_out.append(ve)
# poly_edge_out.append(pe)

vo, po, _ = separate_loose_mesh(ve, pe)
verts_out.extend(vo)
poly_edge_out.extend(po)
Expand Down
9 changes: 9 additions & 0 deletions utils/mesh/separate_loose_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
from sverchok.utils.nodes_mixins.sockets_config import ModifierLiteNode

def separate_loose_mesh(verts_in, poly_edge_in):
''' separate a mesh by loose parts.
input:
1. list of verts
2. list of edges/polygons
output: list of
1. separated list of verts
2. separated list of edges/polygons with new indices of separated elements
3. separated list of edges/polygons (like 2) with old indices
'''
verts_out = []
poly_edge_out = []
poly_edge_old_indexes_out = [] # faces with old indices
Expand Down

0 comments on commit 047b12a

Please sign in to comment.