Browse Source

Fix Schema outgoing connections leaving behind links to the dummy-node.
Also added a NoOp node for debugging and some cleanup

Joseph Brandenburg 9 months ago
parent
commit
8800697266
4 changed files with 44 additions and 12 deletions
  1. 28 5
      internal_containers.py
  2. 13 5
      node_container_common.py
  3. 1 2
      readtree.py
  4. 2 0
      schema_solve.py

+ 28 - 5
internal_containers.py

@@ -36,9 +36,32 @@ class DummyNode:
         self.hierarchy_dependencies = []
         self.dependencies = []
         self.executed = False
-        #
-        # 
-        self.pre_pass_done = False
-        self.execute_pass_done = False
 
-setup_container(DummyNode)
+setup_container(DummyNode)
+
+
+class NoOpNode:
+    def __init__(self, signature, base_tree):
+        self.signature = signature
+        self.base_tree = base_tree
+        self.inputs={
+          "Input"   : NodeSocket(is_input = True, name = "Input", node = self),
+        }
+        self.outputs = {
+          "Output" : NodeSocket(name = "Output", node=self),
+        }
+        self.parameters = {
+            "Input"  : None,
+            "Output" : None,
+        }
+        self.inputs["Input"].set_traverse_target(self.outputs["Output"])
+        self.outputs["Output"].set_traverse_target(self.inputs["Input"])
+        self.node_type = 'UTILITY'
+        self.prepared = True
+        self.hierarchy_connections = [];  self.connections = []
+        self.hierarchy_dependencies = []; self.dependencies = []
+        self.executed = True
+    
+    # this node is useful for me to insert in the tree and use for debugging especially connections.
+
+setup_container(NoOpNode)

+ 13 - 5
node_container_common.py

@@ -647,11 +647,19 @@ class NodeLink:
         self.is_alive = False
         self.to_node.inputs[self.to_socket].flush_links()
         self.from_node.outputs[self.from_socket].flush_links()
-
-
-
-
-
+    
+    def insert_node(self, middle_node, middle_node_in, middle_node_out, re_init_hierarchy = True):
+        to_node = self.to_node
+        to_socket = self.to_socket
+        self.to_node = middle_node
+        self.to_socket = middle_node_in
+        middle_node.outputs[middle_node_out].connect(to_node, to_socket)
+        if re_init_hierarchy:
+            from .utilities import init_connections, init_dependencies
+            init_connections(self.from_node)
+            init_connections(middle_node)
+            init_dependencies(middle_node)
+            init_dependencies(to_node)
 
 class NodeSocket:
     @property # this is a read-only property.

+ 1 - 2
readtree.py

@@ -268,7 +268,7 @@ def solve_schema_to_tree(nc, all_nc, roots=[]):
     for k, v in all_nc.items():
         # delete all the schema's internal nodes. The links have already been deleted by the solver.
         if v.signature[0] not in ['MANTIS_AUTOGENERATED'] and is_signature_in_other_signature(nc.signature, k):
-            print (wrapOrange("Culling: ")+wrapRed(v))
+            # print (wrapOrange("Culling: ")+wrapRed(v))
             delete_nc(v)
             del_me.append(k)
     for k in del_me:
@@ -569,7 +569,6 @@ def execute_tree(nodes, base_tree, context):
         nc.prepared = False
         nc.executed = False
         check_and_add_root(nc, xForm_pass)
-    pre_pass_done = []
 
     execute_pass = xForm_pass.copy()
     # exe_order = {}; i=0

+ 2 - 0
schema_solve.py

@@ -231,6 +231,8 @@ class SchemaSolver:
                             to_node = outgoing.to_node
                             from_node =frame_nc.get( (*self.autogen_path_names, from_np.name+self.index_str()) )
                             connection = from_node.outputs[link.from_socket.name].connect(node=to_node, socket=outgoing.to_socket)
+                            # we need to kill the link between the Schema itself and the next node and update the deps. Otherwise:confusing bugs.
+                            outgoing.die(); init_dependencies(to_node)
                     # else: # the node just isn't connected out this socket.