Exemple #1
0
 def getCurve(uValue, l_newCurves):
     _crv = d_curves.get(uValue)
     if _crv: return _crv
     _crv = mc.duplicateCurve("{0}.u[{1}]".format(_shape, uValue),
                              ch=0,
                              rn=0,
                              local=0)[0]
     if offset:
         DIST.offsetShape_byVector(_crv, offset, component='cv')
     d_curves[uValue] = _crv
     log.debug("|{0}| >> created: {1} ...".format(_str_func, _crv))
     l_newCurves.append(_crv)
     return _crv
def get_shapeCurve(shape, value, mode='u', offset=None, d_curves={}):
    _str_func = 'get_shapeCurve'

    _crv = d_curves.get(value)
    if _crv: return _crv
    _crv = mc.duplicateCurve("{0}.{1}[{2}]".format(shape, mode, value),
                             ch=0,
                             rn=0,
                             local=0)[0]
    if offset:
        DIST.offsetShape_byVector(_crv, offset, component='cv')
    if d_curves:
        d_curves[value] = _crv
    log.debug("|{0}| >> created: {1} ...".format(_str_func, _crv))
    return _crv
Exemple #3
0
def leverBAK(self, ml_handles=None):
    try:
        _str_func = 'lever'
        log_start(_str_func)

        mBlock = self.mBlock
        mRigNull = self.mRigNull
        _offset = self.v_offset
        _jointOrientation = self.d_orientation['str']
        ml_formHandles = self.ml_formHandles

        #Get our curves...
        ml_targets = []
        for i, mHandle in enumerate(ml_formHandles[:2]):
            ml_targets.append(mHandle.loftCurve)
            if i:
                continue
            ml_sub = mHandle.msgList_get('subShapers')
            if ml_sub:
                for mSub in ml_sub:
                    ml_targets.append(mSub)

        ml_new = []
        for mTar in ml_targets:
            mDup = mTar.doDuplicate(po=False)
            DIST.offsetShape_byVector(mDup.mNode, _offset)
            mDup.p_parent = False
            ml_new.append(mDup)

        CURVES.connect([mTar.mNode for mTar in ml_new], mode='even')

        return ml_new[0]

        mLeverControlJoint = mRigNull.getMessageAsMeta('leverDirect')
        mLeverControlFK = mRigNull.getMessageAsMeta('leverFK')
        if not mLeverControlJoint:
            mLeverControlJoint = mLeverControlFK
        else:
            mLeverControlJoint = mLeverControlJoint
        log.debug("|{0}| >> mLeverControlJoint: {1}".format(
            _str_func, mLeverControlJoint))

        dist_lever = DIST.get_distance_between_points(
            ml_prerigHandles[0].p_position, ml_prerigHandles[1].p_position)
        log.debug("|{0}| >> Lever dist: {1}".format(_str_func, dist_lever))

        #Dup our rig joint and move it
        mDup = mLeverControlJoint.doDuplicate()
        mDup.p_parent = mLeverControlJoint

        mDup.resetAttrs()
        ATTR.set(mDup.mNode, 't{0}'.format(_jointOrientation[0]),
                 dist_lever * .8)

        mDup2 = mDup.doDuplicate()
        ATTR.set(mDup2.mNode, 't{0}'.format(_jointOrientation[0]),
                 dist_lever * .25)

        ml_clavShapes = BUILDUTILS.shapes_fromCast(
            self,
            targets=[
                mDup2.mNode,
                #ml_fkJoints[0].mNode],
                mDup.mNode
            ],
            aimVector=self.d_orientation['vectorOut'],
            offset=_offset,
            f_factor=0,
            mode='frameHandle')

        mHandleFactory.color(ml_clavShapes[0].mNode, controlType='main')
        CORERIG.shapeParent_in_place(mLeverControlFK.mNode,
                                     ml_clavShapes[0].mNode,
                                     True,
                                     replaceShapes=True)
        #CORERIG.shapeParent_in_place(mLeverFKJnt.mNode,ml_clavShapes[0].mNode, False, replaceShapes=True)

        mc.delete([mShape.mNode
                   for mShape in ml_clavShapes] + [mDup.mNode, mDup2.mNode])

    except Exception, err:
        cgmGEN.cgmExceptCB(Exception, err, localDat=vars())