zbw_rig.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:zTools 作者: zethwillie 项目源码 文件源码
def jointFromList(xformList=[], orient="xyz", secAxis="zup", strip="", suffix="", *args):
    """
    uses the xformlist arg (a list of transforms in scene) to create a joint chain in order.
    Arguments: xformList (a list), orient ("xyz", etc), secAxis ("xup", "zdown", etc), strip (string to strip off), suffix (string to add to the joints)
    """
    jointList = []

    #if no list is provided, get the list from selection order
    if not xformList:
        sel = getSelection()

        if sel:
            xformList = sel
        #if no list && no selection then throw error
        else:
            cmds.error("you must provide a list of transforms or have the transforms selected in order")

    #clear selection
    cmds.select(cl=True)
    #for each thing in the list create a joint at that location (they'll be parented to the previous)
    for xform in xformList:
        xformPos = cmds.xform(xform, q=True, ws=True, t=True)
        jointName = "%s%s"%(xform.rstrip(strip), suffix)
        thisJoint = cmds.joint(n=jointName, p=xformPos)
        jointList.append(thisJoint)

    #now orient the joint chain based on args and return a list of the joints
    cmds.joint(jointList[0], e=True, ch=True, oj=orient, sao=secAxis)
    return(jointList)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号