当前位置: 首页>>代码示例>>Python>>正文


Python cmds.setDrivenKeyframe函数代码示例

本文整理汇总了Python中maya.cmds.setDrivenKeyframe函数的典型用法代码示例。如果您正苦于以下问题:Python setDrivenKeyframe函数的具体用法?Python setDrivenKeyframe怎么用?Python setDrivenKeyframe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setDrivenKeyframe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_fk_setup

 def create_fk_setup(self):
     """Creates the FK setup."""
     cmds.orientConstraint(self.controls['fan'], self.result_jnts[0], mo=True)
     mdl = cmds.shadingNode('multDoubleLinear', asUtility=True)
     mdl = cmds.rename(mdl, '%s_%s_MDL' % (self.side, self.modulename))
     if self.side == 'R':
         cmds.expression(s='%s.input1 = time * (-1);' % mdl, o=mdl, ae=1, uc='all')
     else:
         cmds.expression(s='%s.input1 = time;' % mdl, o=mdl, ae=1, uc='all')
     # END if
     cmds.connectAttr('%s.speed' % self.controls['fan'], '%s.input2' % mdl, f=True)
     cmds.setDrivenKeyframe('%s.rotate%s' % (self.controls['offset'], self._up_axis), cd='%s.output' % mdl, dv=0, v=0)
     cmds.setDrivenKeyframe('%s.rotate%s' % (self.controls['offset'], self._up_axis), cd='%s.output' % mdl, dv=1, v=1)
     cmds.keyTangent('%s_rotate%s' % (self.controls['offset'], self._up_axis), itt='linear', ott='linear', f=(0, 1))
     cmds.selectKey('%s_rotate%s' % (self.controls['offset'], self._up_axis), add=True, k=True, f=(0, 1))
     cmds.setInfinity(pri='cycleRelative', poi='cycleRelative')
开发者ID:jonntd,项目名称:Rigganator,代码行数:16,代码来源:fan.py

示例2: mirrorDrivenkeys

def mirrorDrivenkeys(src, dst):
    for driver, driven in getDrivenKeys(src):
        newDriver = driver.replace(src, dst)
        newDriven = driven.replace("L_", "R_")
        if not mc.objExists(newDriven) or newDriven == driven:
            newDriven = driven.replace("left", "right")
        if not mc.objExists(newDriven) or newDriven == driven:
            newDriven = driven.replace("L", "R")

        if not mc.objExists(newDriver) or not mc.objExists(newDriven):
            continue
        if newDriven == driven:
            continue

        driverValues = mc.keyframe(driven, q=True, fc=True)
        drivenValues = mc.keyframe(driven, q=True, vc=True)
        for drv, dnv in zip(driverValues, drivenValues):
            if re.search(
                "(translateX|eyeRotInner_ctl_0.rotateZ|mouthCorner_ctl_0\.translateY|mouth_ctl_0\.translateY)$",
                newDriver,
            ):
                dnv = dnv * -1
            if re.search("(mainCheek_ctl_0\.translateX)$", newDriver):
                dnv = dnv * -1
            mc.setDrivenKeyframe(newDriven, cd=newDriver, dv=drv, v=dnv)

        print "Copy Driven keys: %s : %s -> %s : %s" % (driver, driven, newDriver, newDriven)
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:27,代码来源:mirrorFaceControlDrivenkeys.py

示例3: on_btn_setDrivenkey_clicked

    def on_btn_setDrivenkey_clicked(self, args=None):
        if args==None:return
        rdnDict = {'rdn_A':'ypxn',  # -X+Y
                   'rdn_B':'y',     # +Y
                   'rdn_C':'ypxp',  # +X+Y

                   'rdn_D':'x',     # -X
                   'rdn_E':'x',     # +X

                   'rdn_F':'ynxn',  # -X-Y
                   'rdn_G':'y',     # -Y
                   'rdn_H':'ynxp'   # +X-Y
                   }
        selectRdn = ''
        for child in self.rdn_Box.findChildren(QtGui.QRadioButton):
            if child.isChecked():
                selectRdn = str(child.objectName())
                break
            else:
                continue
        #-----------------------------------------------------------
        driverAttr  = '%s.%s'%(self.__model.data(self.listView.selectedIndexes()[0], QtCore.Qt.DisplayRole), rdnDict.get(selectRdn))
        drivenAttr  = str(self.lineEdit.text())
        driverValue = mc.getAttr(driverAttr)
        drivenValue = mc.getAttr(drivenAttr)

        mc.setDrivenKeyframe(drivenAttr, cd=driverAttr, dv=driverValue, v=drivenValue)
        print driverAttr, drivenAttr, driverValue, drivenValue
开发者ID:zclongpop123,项目名称:MPToolkit,代码行数:28,代码来源:FixShape.py

示例4: resetFn

    def resetFn(self, wid):
        print 'resetting', wid
        try:
            cmds.undoInfo(openChunk=True)
            #get original pose from driven dict
            initialPoseDict = json.loads(cmds.getAttr(self.currentFace.blendBoard + '.initialPoseDict'))
            initialPoseAttrs = initialPoseDict[wid.pose]

            #store current slider/attr val
            preVal = cmds.getAttr(wid.pose)

            #iterate over the attrs and set them bvack to original
            #TODO: rotate order?
            cmds.setAttr(wid.pose, 1.0)
            for att in wid.driven:
                #print att, initialPoseAttrs[att]
                cmds.setAttr(att, initialPoseAttrs[att])

            #set the old driven keyframe
            cmds.setDrivenKeyframe(wid.driven, cd=wid.pose)

            #reset the slider/attr val
            cmds.setAttr(wid.pose, preVal)
            self.checkForEditedPoses()

        except Exception, err:
            import traceback
            print(traceback.format_exc())
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:28,代码来源:poseEditor_UI.py

示例5: setDrivenKey

def setDrivenKey(driverInfo, drivenInfo):
    """Automate the set driven key through the use of set driven key
    @param driverInfo list of values of the driver attribute. The key should be the target attribute
    @param drivenInfo list of values of the driven attribute. The key should be the target attribute

    @code
    import libUtilities
    #Set up the driver info
    driverInfo = {"ctrl.tx":[0,1]}
    drivenInfo = {"cube.rz":[0,360]}
    libUtilities.setDrivenKey(driverInfo, drivenInfo )
    @endcode

    @warning The number of values in both driver and driven attribute should be same
    """

    if type(driverInfo) != dict or type(drivenInfo) != dict:
        raise Exception("Not a dictInfo")

    driver = driverInfo.keys()[0]
    driven = drivenInfo.keys()[0]
    currentDriverValue = cmds.getAttr(driver)
    currentDrivenValue = cmds.getAttr(driven)

    cmds.setDrivenKeyframe(driven, itt="linear", ott="linear", cd=driver)
    for driveAttr, drivenAttr in zip(driverInfo[driver], drivenInfo[driven]):
        cmds.setAttr(driver, driveAttr)
        cmds.setAttr(driven, drivenAttr)
        cmds.setDrivenKeyframe(driven, itt="linear", ott="linear", cd=driver)

    cmds.setAttr(driver, currentDriverValue)
    cmds.setAttr(driven, currentDrivenValue)
开发者ID:mds-dev,项目名称:mds_repository,代码行数:32,代码来源:libUtilities.py

示例6: stampSDK

def stampSDK( *args ):
    global drivenAttrs
    drivenAttrs = cmds.ls(sl=True)
    
    # Stamp SDK
    for sel in drivenAttrs:
        cmds.setDrivenKeyframe( "%s.%s" %(sel, cmds.channelBox( "mainChannelBox", q=True, sma=True )[0]), 
            cd=driverAttr)    
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:8,代码来源:rigTools.py

示例7: updateFn

    def updateFn(self, wid):
        #check that the pose is fully on
        if wid.poseSlider.value() != 100:
            cmds.warning('Pose slider is not fully on, must be 1.0 in able to save edit.')
            return False

        cmds.setDrivenKeyframe(wid.driven, cd=wid.pose)
        self.checkForEditedPoses()
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:8,代码来源:poseEditor_UI.py

示例8: dpSetHandFollowSDK

 def dpSetHandFollowSDK(self, *args):
     """ Create the setDrivenKey.
     """
     armWristIkCtrl = args[0]
     cmds.setDrivenKeyframe(armWristIkCtrl+"_Orient_Grp_ParentConstraint."+self.spineChestACtrl+"W0", currentDriver=armWristIkCtrl+"."+self.langDic[self.langName]['c_Follow'])
     cmds.setDrivenKeyframe(armWristIkCtrl+"_Orient_Grp_ParentConstraint."+self.globalCtrl+"W1", currentDriver=armWristIkCtrl+"."+self.langDic[self.langName]['c_Follow'])
     cmds.setDrivenKeyframe(armWristIkCtrl+"_Orient_Grp_ParentConstraint."+self.rootCtrl+"W2", currentDriver=armWristIkCtrl+"."+self.langDic[self.langName]['c_Follow'])
     cmds.setDrivenKeyframe(armWristIkCtrl+"_Orient_Grp_ParentConstraint."+self.spineHipsBCtrl+"W3", currentDriver=armWristIkCtrl+"."+self.langDic[self.langName]['c_Follow'])
     cmds.setDrivenKeyframe(armWristIkCtrl+"_Orient_Grp_ParentConstraint."+self.headCtrl+"W4", currentDriver=armWristIkCtrl+"."+self.langDic[self.langName]['c_Follow'])
开发者ID:utsdab,项目名称:usr,代码行数:9,代码来源:dpAddHandFollow.py

示例9: on_actionQuickSDK_triggered

    def on_actionQuickSDK_triggered(self, clicked=None):
        if clicked==None:return

        DriverAttribute = str(self.driverAttributelineEdit.text())


        for i in range(self.drivenAttributelineEdit.count()):
            Drivenattr = str(self.drivenAttributelineEdit.item(i).text())
            mc.setDrivenKeyframe(Drivenattr, cd=DriverAttribute)
开发者ID:zclongpop123,项目名称:MPToolkit,代码行数:9,代码来源:quickSDKTool.py

示例10: getDrivenKeyInfo

def getDrivenKeyInfo(obj):
    DrivenInfo = []
    attributes = mc.setDrivenKeyframe(obj, q=True, dn=True)
    if re.match('^No driven attributes', attributes[0]):
        return DrivenInfo
    
    for attr in attributes:
        DrivenInfo.append((mc.setDrivenKeyframe(attr, q=True, dr=True), attr))
        
    return DrivenInfo
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:10,代码来源:mirrorDrivenKeys.py

示例11: _setKeyFrame

    def _setKeyFrame(self, DriverValueSpinbox, DrivenValueSpinbox):
        DriverAttibute = str(self.DriverAttributeLineEdit.text())
        DrivenAttibute = str(self.DrivenAttributeLineEdit.text())
        DriverValue = DriverValueSpinbox.value()
        DrivenValue = DrivenValueSpinbox.value()

        if len(DriverAttibute) == 0:return
        if len(DrivenAttibute) == 0:return

        mc.setDrivenKeyframe(DrivenAttibute, cd=DriverAttibute, dv=DriverValue, v=DrivenValue)
开发者ID:zclongpop123,项目名称:MPToolkit,代码行数:10,代码来源:quickSetDrivenKey.py

示例12: _dynamic_settings

    def _dynamic_settings(self, dyCtrl, hairSys, fol):
        """
        Responsible for setting the dynamic control attributes.
        """
        # header
        cmds.addAttr(dyCtrl, ln="dynamic", at="enum",
                     en="settings:", k=True)
        cmds.setAttr("{0}.dynamic".format(dyCtrl), l=True)

        # EN
        cmds.addAttr(dyCtrl, ln="EN", at="enum", en="on:off", k=True)

        # off
        cmds.setAttr("{0}.EN".format(dyCtrl), 1)
        cmds.setAttr("{0}Shape.simulationMethod".format(hairSys), 0)
        cmds.setDrivenKeyframe("{0}Shape.simulationMethod".format(hairSys),
                          "{0}.EN".format(dyCtrl))

        # on
        cmds.setAttr("{0}.EN".format(dyCtrl), 0)
        cmds.setAttr("{0}Shape.simulationMethod".format(hairSys), 3)
        cmds.setDrivenKeyframe("{0}Shape.simulationMethod".format(hairSys),
                          "{0}.EN".format(dyCtrl))

        # motion drag
        cmds.addAttr(dyCtrl, ln="motionDrag", at="float", k=1, hnv=1, hxv=1)
        cmds.connectAttr("{0}.motionDrag".format(dyCtrl),
                         "{0}Shape.motionDrag".format(hairSys), f=1)

        # drag
        cmds.addAttr(dyCtrl, ln="drag", at="float",
                     k=1, hnv=1, hxv=1)
        cmds.connectAttr("{0}.drag".format(dyCtrl),
                         "{0}Shape.drag".format(hairSys), f=1)

        # damp
        cmds.addAttr(dyCtrl, ln="damp", at="float",
                     dv=0, k=1, hnv=1, hxv=1)
        cmds.connectAttr("{0}.damp".format(dyCtrl),
                         "{0}Shape.damp".format(hairSys), f=1)

        # iterations
        cmds.addAttr(dyCtrl, ln="iterations", at="float", k=1, hnv=1, hxv=1)
        cmds.connectAttr("{0}.iterations".format(dyCtrl),
                         "{0}Shape.iterations".format(hairSys), f=1)

        # stiffness
        cmds.addAttr(dyCtrl, ln="stiffness", at="float", k=0, hnv=1, hxv=1,
                     dv=1, min=0, max=1)
        cmds.connectAttr("{0}.stiffness".format(dyCtrl),
                         "{0}Shape.stiffness".format(hairSys), f=1)
开发者ID:ABCTD,项目名称:abc_pipe,代码行数:51,代码来源:overlap_tool.py

示例13: create_ik_stretch

 def create_ik_stretch(self):
     """Creates the IK stretch setup."""
     arm_dist, start_loc, end_loc = self.c.distance_node(self.guides['thigh'], self.guides['foot'])
     arm_dist = cmds.rename(arm_dist, '%s_%s_%s' % (self.side, 'leg', self.nc.distance))
     start_loc = cmds.rename(start_loc, '%s_%s_%s' % (self.side, 'legLengthStart', self.nc.locator))
     end_loc = cmds.rename(end_loc, '%s_%s_%s' % (self.side, 'legLengthEnd', self.nc.locator))
     cmds.parent(end_loc, self.controls['ik'])
     cmds.parent(arm_dist, self.top_grp)
     driver = '%sShape.distance' % arm_dist
     if self.side == 'R':
         mult = cmds.shadingNode('multiplyDivide', asUtility=True)
         mult = cmds.rename(mult, '%s_%s_stretch_negative_MDN' % (self.side, 'leg'))
         cmds.connectAttr('%sShape.distance' % arm_dist, '%s.input1X' % mult, f=True)
         cmds.setAttr('%s.input2X' % mult, -1)
         driver = '%s.outputX' % mult
     # END if
     thigh_len = cmds.getAttr('%s.tx' % self.ik_jnts[1])
     shin_len = cmds.getAttr('%s.tx' % self.ik_jnts[2])
     sum_len = thigh_len + shin_len
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len*2, v=thigh_len*2, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len*2, v=shin_len*2, itt='linear', ott='linear')
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[1], 1)
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[2], 1)
开发者ID:jonntd,项目名称:Rigganator,代码行数:29,代码来源:leg.py

示例14: create_ik_arm_stretch

 def create_ik_arm_stretch(self):
     """Creates the IK stretch setup."""
     arm_dist, start_loc, end_loc = self.c.distance_node(self.guides['upperArm'], self.guides['hand'])
     arm_dist = cmds.rename(arm_dist, '%s_%s_%s' % (self.side, 'arm', self.nc.distance))
     start_loc = cmds.rename(start_loc, '%s_%s_%s' % (self.side, 'armLengthStart', self.nc.locator))
     end_loc = cmds.rename(end_loc, '%s_%s_%s' % (self.side, 'armLengthEnd', self.nc.locator))
     cmds.parent(end_loc, self.controls['handik'])
     cmds.parent(arm_dist, self.top_grp)
     driver = '%sShape.distance' % arm_dist
     if self.side == 'R':
         mult = cmds.shadingNode('multiplyDivide', asUtility=True)
         mult = cmds.rename(mult, '%s_%s_stretch_negative_MDN' % (self.side, 'arm'))
         cmds.connectAttr('%sShape.distance' % arm_dist, '%s.input1X' % mult, f=True)
         cmds.setAttr('%s.input2X' % mult, -1)
         driver = '%s.outputX' % mult
     # END if
     upper_arm_len = cmds.getAttr('%s.tx' % self.ik_jnts[1])
     fore_arm_len = cmds.getAttr('%s.tx' % self.ik_jnts[2])
     sum_len = upper_arm_len + fore_arm_len
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len*2, v=upper_arm_len*2, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len*2, v=fore_arm_len*2, itt='linear', ott='linear')
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[1], 1)
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[2], 1)
     # stretch the result joints
     curve = '%s_%s_%s' % (self.side, 'upperArm', self.nc.curve)
     self.stretch_result_joints(curve, 'upperArm', self.upper_arm_jnts)
     curve = '%s_%s_%s' % (self.side, 'foreArm', self.nc.curve)
     self.stretch_result_joints(curve, 'foreArm', self.fore_arm_jnts)
开发者ID:jonntd,项目名称:Rigganator,代码行数:34,代码来源:arm.py

示例15: on_actionMirrorSDK_triggered

    def on_actionMirrorSDK_triggered(self, clicked=None):
        if clicked == None:return

        ReverDt = {'X':1, 'Y':1, 'Z':1}
        
        if self.REVERX.isChecked():ReverDt['X'] = -1
        if self.REVERY.isChecked():ReverDt['Y'] = -1
        if self.REVERZ.isChecked():ReverDt['Z'] = -1
        
        for i,DrivenInformations in enumerate(self.targentAtrLst):
            DrivenAttr = str(list(self.Model.stringList())[i])
            for driverValue, value in zip(DrivenInformations[2], DrivenInformations[3]):
                mc.setDrivenKeyframe(DrivenAttr, cd=DrivenInformations[0], dv=driverValue, v=value * ReverDt.get(DrivenInformations[0][-1], 1))
                print DrivenInformations[0], DrivenAttr
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:14,代码来源:mirrorSDK.py


注:本文中的maya.cmds.setDrivenKeyframe函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。