ss
import maya.cmds as cmds
cmds.select(hierarchy=True)
selected_hierarchy = cmds.ls(sl=True,transforms=True)
Rename_Col = []
Parent_Col = {}
Count = 1000
for i in selected_hierarchy:
■■■■if cmds.nodeType(i) != "joint":
■■■■parent_Node = cmds.listRelatives( i, parent=True )
■■■■pos = cmds.xform(i,ws=True,q=True,t=True)
■■■■rot = cmds.xform(i,ws=True,q= True,ro=True)
■■■■Obj_name = str(i)
■■■■cmds.select( d=True )
■■■■Joint = cmds.joint(n="Tt_Joint_"+Obj_name,p=(0,0,0))
■■■■cmds.setAttr(Joint+".translate",pos[0],pos[1],pos[2],type="double3")
■■■■cmds.setAttr(Joint+".rotate",rot[0],rot[1],rot[2],type="double3")
■■■■Co = str(Count)
■■■■if parent_Node == None:
■■■■■■Parent_Col.update({Co+"|"+Joint:None})
■■■■else:
■■■■■■Parent_Col.update({Co+"|"+Joint:parent_Node})
■■■■Count =+ Count+1
#for key, value in sorted(Parent_Col.items()):
#for key, value in sorted(Parent_Col.items(),key=lambda x:x[1]):
for key, value in sorted(Parent_Col.items()):
■■dst = key[5:]
■■print dst
■■print "__"
■■print value
■■#if value =! "None":
■■■■#cmds.parent(dst,value)
■■#else:
■■■■#pass
■■#cmds.parent(key,value[5:])