Skip to content

Commit

Permalink
cache edges and faces indexes if input params socket has multiple values
Browse files Browse the repository at this point in the history
  • Loading branch information
satabol committed Jul 28, 2023
1 parent 0ff33e5 commit 1cd97e5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nodes/generator/torus_mk2.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,26 @@ def process(self):

if self.outputs['Edges'].is_linked:
edges_list = []
edges_cache = dict()
for _, _, n1, n2, _, _, _, _, sT in zip(*parameters):
edges = torus_edges(n1, n2, sT)
if (n1, n2, sT) in edges_cache:
edges = edges_cache[(n1, n2, sT)]
else:
edges = edges_cache[(n1, n2, sT)] = torus_edges(n1, n2, sT)
edges_list.append(edges)
edges_cache.clear()
self.outputs['Edges'].sv_set(edges_list)

if self.outputs['Polygons'].is_linked:
polys_list = []
polys_cache = dict()
for _, _, n1, n2, _, _, _, _, sT in zip(*parameters):
polys = torus_polygons(n1, n2, sT)
if (n1, n2, sT) in polys_cache:
polys = polys_cache[(n1, n2, sT)]
else:
polys = polys_cache[(n1, n2, sT)] = torus_polygons(n1, n2, sT)
polys_list.append(polys)
polys_cache.clear()
self.outputs['Polygons'].sv_set(polys_list)


Expand Down

0 comments on commit 1cd97e5

Please sign in to comment.