Browse Source

fix: branching up-trace is painfully slow

I don't know why this happens.. it seems the links are being duplicated?
Anyways it is fixed by simply using a set instead of a list to track
the sockets that need to be checked.
Joseph Brandenburg 4 months ago
parent
commit
dfc62ec47a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      node_container_common.py

+ 3 - 3
node_container_common.py

@@ -67,7 +67,7 @@ def trace_line_up_branching(node : MantisNode, output_name : str,
     if hasattr(node, "outputs"):
         # Trace a single line
         if (socket := node.outputs.get(output_name) ):
-            check_sockets=[socket]
+            check_sockets={socket}
             while (check_sockets):
                 # This is bad, but it's efficient for nodes that only expect
                 #  one path along the given line
@@ -78,8 +78,8 @@ def trace_line_up_branching(node : MantisNode, output_name : str,
                         socket = other
                         if break_condition(socket.node):
                             leaf_nodes.append(socket.node)
-                        elif socket.can_traverse:
-                            check_sockets.append(socket.traverse_target)
+                        elif socket.is_input and socket.can_traverse:
+                            check_sockets.add(socket.traverse_target)
                         else: # this is an input.
                             leaf_nodes.append(socket.node)
     return leaf_nodes