Quellcode durchsuchen

fix: edge case in visualize code and optimization

Joseph Brandenburg vor 6 Monaten
Ursprung
Commit
9c9bc1a260
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen
  1. 2 1
      utilities.py
  2. 3 3
      visualize.py

+ 2 - 1
utilities.py

@@ -415,7 +415,8 @@ def trace_all_nodes_from_root(root, nodes):
         connected_nodes = []
         for output in node.outputs:
             for l in output.links:
-                connected_nodes.append(l.to_node)
+                if l.to_node not in nodes:
+                    connected_nodes.append(l.to_node)
         for new_node in connected_nodes:
             nodes.add(new_node)
             if new_node not in nodes_checked:

+ 3 - 3
visualize.py

@@ -70,13 +70,13 @@ class MantisVisualizeNode(Node):
             self.location = np.location # will get overwritten by Grandalf later.
         else:
             self.label = mantis_node.signature[-1] # which is be the unique name.
-            for inp in mantis_node.inputs.keys():
+            for inp in mantis_node.inputs:
                 match mode:
                     case "DEBUG_CONNECTIONS":
                         if not inp.is_connected:
                             continue
                 self.inputs.new('WildcardSocket', inp.name)
-            for out in mantis_node.outputs.keys():
+            for out in mantis_node.outputs:
                 match mode:
                     case "DEBUG_CONNECTIONS":
                         if not out.is_connected:
@@ -183,7 +183,7 @@ def visualize_tree(nodes, base_tree, context):
 
 
     from .utilities import SugiyamaGraph
-    SugiyamaGraph(vis_tree, 16)
+    SugiyamaGraph(vis_tree, 1) # this can take a really long time
 
 from .ops_nodegroup import mantis_tree_poll_op