|
|
@@ -70,45 +70,35 @@ def reroute_links_grpout(group_output, all_nodes):
|
|
|
"(maybe you are running the tree from inside a node group?)")
|
|
|
|
|
|
# FIXME I don't think these signatures are unique.
|
|
|
+# TODO this is a really silly and bad and also really dumb way to do this
|
|
|
def insert_lazy_parents(nc):
|
|
|
from .link_nodes import LinkInherit
|
|
|
- from .base_definitions import NodeLink
|
|
|
inherit_nc = None
|
|
|
if nc.inputs["Relationship"].is_connected:
|
|
|
from .node_container_common import trace_single_line
|
|
|
node_line, last_socket = trace_single_line(nc, 'Relationship')
|
|
|
- for other_node in node_line:
|
|
|
- if other_node.node_type == 'XFORM':
|
|
|
+ # if last_socket is from a valid XFORM, it is the relationship in
|
|
|
+ # because it was traversed from the xForm Out... so get the traverse target.
|
|
|
+ if last_socket.traverse_target is None:
|
|
|
+ return # this is not a valid lazy parent.
|
|
|
+ for other_node in node_line[1:]: # skip the first one, it is the same node
|
|
|
+ if other_node.node_type == 'LINK':
|
|
|
+ return # this one has a realtionship connection.
|
|
|
+ elif other_node.node_type == 'XFORM':
|
|
|
break
|
|
|
- if other_node.node_type in ["XFORM"] and last_socket in ["xForm Out"]:
|
|
|
+ if other_node.node_type in ["XFORM"] and last_socket.traverse_target.name in ["xForm Out"]:
|
|
|
+ for link in other_node.outputs['xForm Out'].links:
|
|
|
+ if link.to_node == nc: link.die()
|
|
|
inherit_nc = LinkInherit(("MANTIS_AUTOGENERATED", *nc.signature[1:], "LAZY_INHERIT"), nc.base_tree)
|
|
|
- for from_link in other_node.outputs["xForm Out"].links:
|
|
|
- if from_link.to_node == nc and from_link.to_socket == "Relationship":
|
|
|
- break # this is it
|
|
|
- from_link.to_node = inherit_nc; from_link.to_socket="Parent"
|
|
|
- from_link.to_node.inputs[from_link.to_socket].is_linked=True
|
|
|
-
|
|
|
- links=[]
|
|
|
- while (nc.inputs["Relationship"].links):
|
|
|
- to_link = nc.inputs["Relationship"].links.pop()
|
|
|
- if to_link.from_node == other_node and to_link.from_socket == "xForm Out":
|
|
|
- continue # don't keep this one
|
|
|
- links.append(to_link)
|
|
|
- to_link.from_node.outputs[from_link.from_socket].is_linked=True
|
|
|
-
|
|
|
- nc.inputs["Relationship"].links=links
|
|
|
- inherit_nc.inputs["Parent"].links.append(from_link)
|
|
|
- inherit_nc.parameters = {
|
|
|
- "Parent":None,
|
|
|
- "Inherit Rotation":True,
|
|
|
- "Inherit Scale":'FULL',
|
|
|
- "Connected":False,
|
|
|
- }
|
|
|
+ l = other_node.outputs['xForm Out'].connect(inherit_nc, 'Parent')
|
|
|
+ l1 = inherit_nc.outputs['Inheritance'].connect(nc, 'Relationship')
|
|
|
+ inherit_nc.parameters = { "Parent":None,
|
|
|
+ "Inherit Rotation":True,
|
|
|
+ "Inherit Scale":'FULL',
|
|
|
+ "Connected":False, }
|
|
|
# because the from node may have already been done.
|
|
|
- init_connections(other_node)
|
|
|
- init_dependencies(other_node)
|
|
|
- init_connections(inherit_nc)
|
|
|
- init_dependencies(inherit_nc)
|
|
|
+ init_connections(other_node); init_dependencies(other_node)
|
|
|
+ init_connections(inherit_nc); init_dependencies(inherit_nc)
|
|
|
return inherit_nc
|
|
|
|
|
|
# *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** # *** #
|