def add_top_level_ctrl(origCtrl, type, geo, *args):
"""
creates a new ctrl, orients it to the geo and parent constrains the orig ctrl rig under itself
:param origCtrl: the control we're working from
:param type: the ctrl type of shape see zbw_rig.createControl for options
:param geo: the geo to orient to
:param args:
:return: topCtrl (the new ctrl), grp (the top ctrl grp freeze grp)
"""
# THIS IS THE XTRA CTRL LAYER, THIS ORIENTS CTRL AND CONNECTS ORIG CTRL TO THE NEW CTRL
origCtrlPos = cmds.xform(origCtrl, q=True, ws=True, rp=True)
topCtrl = rig.createControl(name="{0}_moveCtrl".format(origCtrl.rpartition("_")[0]), type=type, axis="z",
color="yellow")
grp = rig.groupFreeze(topCtrl)
cmds.xform(grp, ws=True, t=origCtrlPos)
nc = cmds.normalConstraint(geo, grp, worldUpType="vector", upVector=(0, 1, 0))
cmds.delete(nc)
pc = cmds.parentConstraint(topCtrl, origCtrl, mo=True)
sc = cmds.scaleConstraint(topCtrl, origCtrl, mo=True)
return(topCtrl, grp)
评论列表
文章目录