|
|
@@ -35,21 +35,21 @@ def reroute_common(nc, nc_to, all_nc):
|
|
|
downlink.from_socket = from_socket
|
|
|
from_nc.outputs[from_socket].links.append(downlink)
|
|
|
if hasattr(downlink.to_node, "reroute_links"):
|
|
|
- # Recurse!
|
|
|
downlink.to_node.reroute_links(downlink.to_node, all_nc)
|
|
|
in_link.die()
|
|
|
|
|
|
def reroute_links_grp(nc, all_nc):
|
|
|
- if (nc_to := all_nc.get( ( *nc.signature, "NodeGroupInput") )):
|
|
|
- reroute_common(nc, nc_to, all_nc)
|
|
|
- else:
|
|
|
- raise RuntimeError("Cannot read graph for some goshblamed son of a reason")
|
|
|
+ if nc.inputs:
|
|
|
+ if (nc_to := all_nc.get( ( *nc.signature, "NodeGroupInput") )):
|
|
|
+ reroute_common(nc, nc_to, all_nc)
|
|
|
+ else:
|
|
|
+ raise RuntimeError("internal error: failed to enter a node group ")
|
|
|
|
|
|
def reroute_links_grpout(nc, all_nc):
|
|
|
if (nc_to := all_nc.get( ( *nc.signature[:-1],) )):
|
|
|
reroute_common(nc, nc_to, all_nc)
|
|
|
else:
|
|
|
- raise RuntimeError("error leaving a node group (maybe you are running the tree from inside a node group?)... TODO: this should still work")
|
|
|
+ raise RuntimeError("error leaving a node group (maybe you are running the tree from inside a node group?)")
|
|
|
|
|
|
def reroute_links_grpin(nc, all_nc):
|
|
|
pass
|
|
|
@@ -432,9 +432,7 @@ def parse_tree(base_tree):
|
|
|
continue
|
|
|
|
|
|
if nc.node_type in ["DUMMY"]:
|
|
|
- if nc.prototype.bl_idname in ["MantisNodeGroup", "NodeGroupOutput"]:
|
|
|
continue
|
|
|
- # continue
|
|
|
# cleanup autogen nodes
|
|
|
if nc.signature[0] == "MANTIS_AUTOGENERATED" and len(nc.inputs) == 0 and len(nc.outputs) == 1:
|
|
|
output=list(nc.outputs.values())[0]
|
|
|
@@ -445,10 +443,8 @@ def parse_tree(base_tree):
|
|
|
to_node.parameters[to_socket] = value
|
|
|
del to_node.inputs[to_socket]
|
|
|
init_dependencies(to_node)
|
|
|
- # init_connections(from_node)
|
|
|
- # it seems safe, and more importantly, fast, not to update the dependencies of these nodes.
|
|
|
- continue # in my test case this reduced the time cost by 33% by removing a large number of root nodes.
|
|
|
- # it went from 18.9 seconds to 9-10 seconds
|
|
|
+ # init_connections(from_node) # this is unnecesary
|
|
|
+ continue
|
|
|
|
|
|
if (nc.node_type in ['XFORM']) and ("Relationship" in nc.inputs.keys()):
|
|
|
if (new_nc := insert_lazy_parents(nc)):
|