Browse Source

cleanup xForm get_parent_node

Joseph Brandenburg 2 weeks ago
parent
commit
234a1fba6b
1 changed files with 3 additions and 2 deletions
  1. 3 2
      xForm_nodes.py

+ 3 - 2
xForm_nodes.py

@@ -26,8 +26,7 @@ def reset_object_data(ob):
 def get_parent_node(node_container, type = 'XFORM'):
     # type variable for selecting whether to get either
     #   the parent xForm  or the inheritance node
-    node_line, socket = trace_single_line(node_container, "Relationship")
-    parent_nc = None
+    node_line, _last_socket = trace_single_line(node_container, "Relationship")
     for i in range(len(node_line)):
         # check each of the possible parent types.
         if ( (node_line[ i ].__class__.__name__ == 'LinkInherit') ):
@@ -269,6 +268,8 @@ class xFormBone(xFormNode):
     def bSetParent(self, eb):
         from bpy.types import EditBone
         parent_nc = get_parent_node(self, type='LINK')
+        if parent_nc is None:
+            raise RuntimeError(wrapRed(f"Cannot set parent for node {self}"))
         node_lines, _last_socket = trace_single_line(parent_nc, 'Parent')
         for other_node in node_lines:
             if isinstance(other_node, (xFormArmature, xFormBone)):