zbw_rig.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def addGroupAbove(obj="none", suff="none", *args):
    """name of existing obj, new group suffix. New group will be oriented to the object BELOW it"""
    #FIX THE OBJ, SUFIX TO BE EITHER SELECTED OR ENTERED
    sel = cmds.ls(sl=True, type = "transform")
    for obj in sel:
        suff = "_new"
        name = obj + suff + "_GRP"
        #get worldspace location of existing obj
        loc = cmds.xform(obj, q=True, ws=True, rp=True)
        #create new group, name it, move it to new postion in ws and Orient it
        grp = cmds.group(empty=True, name=name)
        cmds.move(loc[0], loc[1], loc[2], grp, ws=True)
        oc = cmds.orientConstraint(obj, grp)
        cmds.delete(oc)
        #check if there's a parent to the old group
        par = cmds.listRelatives(obj, p=True)
        print(par)
        if par:
            cmds.parent(grp, par)
        cmds.parent(obj, grp)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号