# # # #Traverses a network of linked nodes top-down def getBoneNamesFromRoot(in_srcRoot): #input root and traverse linked structure and extract all bone names bones = [] bones = traverseOutputs(in_srcRoot, 0, bones) return bones def traverseOutputs(in_node, in_level, in_rtn): outputs = in_node.outputs() if len(outputs) > 0: in_level += 1 for child in outputs: #only check bone objects if "bone" in child.type().name(): #and skip 'root' bones. The root is the pelvis. if "root" not in child.name(): in_rtn.append(child.name()) print(child.name()) traverseOutputs(child, in_level, in_rtn) return in_rtn