zbw_spaceBuffer.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def createJointFromObj(objs = [], *args):
    """
    creates a joint at obj location/orientation. Can be arg[list] or selection
    :param objs: a list of objects to operate on
    :param args:
    :return:
    """

    if not objs:
        objs = cmds.ls(sl=True, type="transform")

    if objs:
        for obj in objs:
            pos = cmds.xform(obj, q=True, ws=True, rp=True)
            rot = cmds.xform(obj, q=True, ws=True, ro=True)

            jnt = cmds.joint(name="{0}_JNT".format(obj))
            grp = cmds.group(jnt, n="{0}_JNT_GRP".format(obj))

            if cmds.listRelatives(grp, p=True):
                cmds.parent(grp, w=True)

            cmds.xform(grp, ws=True, t=pos)
            cmds.xform(grp, ws=True, ro=rot)
    else:
        cmds.warning("You need to select object(s)")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号