• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.poleVectorConstraint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: surfJnts

 def surfJnts(name, pairL):
     jntPairs = []
     iks = []
     j = 0
     for pair in pairL:
         jnts = []
         i = 0
         suff = ['_root', '_aim', '_up']
         for point in pair:
             cmds.select(point)
             pos = cmds.xform(point, q=True, t=True, ws=True)
             jnts.append(place.joint(0, name + str(j) + suff[i] + '_jnt', pad=2, rpQuery=False)[0])
             i = i + 1
         j = j + 1
         # parent ik joints
         cmds.parent(jnts[1], jnts[0])
         # orient ik joints
         cmds.joint(jnts[0], e=True, oj='zyx', secondaryAxisOrient='yup')
         jnt.ZeroJointOrient(jnts[1])
         # orient up vector jnt
         cmds.parent(jnts[2], jnts[0])
         jnt.ZeroJointOrient(jnts[2])
         cmds.parent(jnts[2], w=True)
         # append pairs to list
         jntPairs.append(jnts)
         # ik
         ikhndl = cmds.ikHandle(sj=jnts[0], ee=jnts[1], sol='ikRPsolver', sticky='sticky')[0]
         cmds.setAttr(ikhndl + '.visibility', False)
         cmds.poleVectorConstraint(jnts[2], ikhndl)
         iks.append(ikhndl)
         # cleanup
         place.cleanUp(jnts[0], SknJnts=True)
         place.cleanUp(jnts[2], SknJnts=True)
         place.cleanUp(ikhndl, World=True)
     return jntPairs, iks
开发者ID:boochos,项目名称:work,代码行数:35,代码来源:atom_reindeer_lib.py


示例2: ikControllerConstraintsAlt

def ikControllerConstraintsAlt(constraint, target, constraint2, target2):
    #3b. select parent of target joint
    mc.select(constraint, target)
    mc.parentConstraint(mo=1)
    mc.select(constraint2, target2)
    snapToPos()
    mc.select(constraint2,target)
    mc.poleVectorConstraint()
开发者ID:imclab,项目名称:MayaToolbox,代码行数:8,代码来源:autorig.py


示例3: install

    def install(self):
        cmds.select(d=True)
        # Create Ik joints
        self.rig_info['ikjnts']=utils.createJoint(self.module_info['ikjnts'], self.rig_info['positions'], self.instance)

        # Create Fk joints
        self.rig_info['fkjnts']=utils.createJoint(self.module_info['fkjnts'], self.rig_info['positions'], self.instance)
 
        # Create Rig joints
        self.rig_info['rigjnts']=utils.createJoint(self.module_info['rigjnts'], self.rig_info['positions'], self.instance)
        
    
        # Create Ik Rig
        # Ik handle
        #"ikcontrols": ["ctrl_ik_arm, ikh_arm", "ctrl_pv_arm"
        # Generate a name for the ik handle using self.instance
        ikhname = self.module_info["ikcontrols"][1].replace('_s_', self.instance)
        self.rig_info['ikh']=cmds.ikHandle(n=ikhname, sj=self.rig_info['ikjnts'][0], ee=self.rig_info['ikjnts'][2], sol='ikRPsolver', p=2, w=1 )

        ikctrlname = self.module_info["ikcontrols"][0].replace('_s_', self.instance)
        self.rig_info['ikcontrol']=utils.createControl([[self.rig_info['positions'][2], ikctrlname, 'HandControl.ma']])[0]

        pvpos = utils.calculatePVPosition([self.rig_info['ikjnts'][0], self.rig_info['ikjnts'][1], self.rig_info['ikjnts'][2]])

        self.rig_info['pvcontrol']=utils.createControl([[pvpos, self.module_info["ikcontrols"][2], 'RectangleControl.ma']])[0]

        # Make a control for arm settings
        self.rig_info['setcontrol']=utils.createControl([[self.rig_info['positions'][2], 'ctrl_settings', 'RectangleControl.ma']])[0]
        cmds.addAttr(self.rig_info['setcontrol'][1], ln='IK_FK', at="enum", en="fk:ik:", k=True )

        # Parent ikh to ctrl
        cmds.parent(self.rig_info['ikh'][0], self.rig_info['ikcontrol'][1])

        # PV constraint
        cmds.poleVectorConstraint(self.rig_info['pvcontrol'][1], self.rig_info['ikh'][0])
    
        # orient constrain arm ik_wrist to ctrl_arm
        cmds.orientConstraint(self.rig_info['ikcontrol'][1], self.rig_info['ikjnts'][2], mo=True)

        # Create FK rig   
        self.rig_info['fkcontrols'] = utils.createControl([[self.rig_info['positions'][0], self.module_info["fkcontrols"][0], 'RectangleControl.ma'],
        [self.rig_info['positions'][1], self.module_info["fkcontrols"][1], 'RectangleControl.ma'],
        [self.rig_info['positions'][2], self.module_info["fkcontrols"][2], 'RectangleControl.ma']])

        # Parent fk controls      
        cmds.parent(self.rig_info['fkcontrols'][2][0], self.rig_info['fkcontrols'][1][1])
        cmds.parent(self.rig_info['fkcontrols'][1][0], self.rig_info['fkcontrols'][0][1])

        # Connect Ik and Fk to Rig joints
        switchattr = self.rig_info['setcontrol'][1] + '.IK_FK'
        utils.connectThroughBC(self.rig_info['ikjnts'], self.rig_info['fkjnts'], self.rig_info['rigjnts'], self.instance, switchattr )
  
        # Constrain fk joints to controls.
        [cmds.parentConstraint(self.rig_info['fkcontrols'][i][1], self.rig_info['fkjnts'][i], mo=True) for i in range(len(self.rig_info['fkcontrols']))]

        # SetupIk/Fk match scriptJob
        """
开发者ID:RiggingDojo,项目名称:Python_101_S1_2016,代码行数:57,代码来源:rig_leg.py


示例4: ikControllerConstraints

def ikControllerConstraints(constraint, target, constraint2, target2):
    #3b. select parent of target joint

    # got rid of selection
    #mc.select(constraint, target)
    mc.parentConstraint(constraint, target, mo=1)
    #mc.select(constraint2, target2)
    snapToPos([constraint2, target2])
    #mc.select(constraint2,target)
    mc.poleVectorConstraint(constraint2, target)
开发者ID:imclab,项目名称:MayaToolbox,代码行数:10,代码来源:autorig.py


示例5: ikSolver

def ikSolver(rootJoint, endJoint, type, pvControl, handControl, parent):
    ikHandle = mc.ikHandle(n=rootJoint.replace(nameLib.prefixNames.ikSuffix, "") + "_ikHandle", sj=rootJoint, ee=endJoint , sol="ikRPsolver")[0]

    # hide solver
    mc.setAttr(ikHandle + ".v", 0)

    # add pc control to ikHandle
    mc.poleVectorConstraint(pvControl, ikHandle)

    # parent under hand control
    mc.parent(ikHandle, handControl)
开发者ID:robertvari,项目名称:rvRigTools,代码行数:11,代码来源:ikArms.py


示例6: createIk

def createIk(ikJnts):
	ikInfo = []
	ikhName = ikJnts[2].replace('ikj', 'ikh')
	ikh = cmds.ikHandle(n=ikhName, sj=ikJnts[0], ee=ikJnts[2], sol='ikRPsolver', p=2, w=.5 )
	# Make a poleVector
	pvCon = cmds.spaceLocator(n=ikhName+'_pv')
	tmpCon = cmds.parentConstraint(ikJnts[1], pvCon, mo=False)
	cmds.delete(tmpCon) 
	cmds.move(-1, pvCon, r=True, z=True )
	cmds.makeIdentity(pvCon, apply=True )
	# Creat a pv constraint
	cmds.poleVectorConstraint( pvCon, ikh[0] )
	return ikh
开发者ID:griffinanimator,项目名称:Python101,代码行数:13,代码来源:rig_utils.py


示例7: move_locator

def move_locator(locatorName, addPosition, effectorName):
    sel = cmds.ls(locatorName)

    # ピボットポイントをオブジェクトのバウンディングボックスの中心に設定
    cmds.xform(locatorName, cp=True)
    locator = cmds.spaceLocator(n="Dummy_Locator")
    cmds.move(addPosition[0], addPosition[1], addPosition[2], ws=True)
    cmds.delete("Dummy_Locator")

    # 極ベクトル
    cmds.poleVectorConstraint(locatorName, effectorName)

    cmds.select(locatorName, deselect=True)
开发者ID:akkey,项目名称:maya,代码行数:13,代码来源:LightSkeleton.py


示例8: twoJointPV

def twoJointPV(name, ik, distance=1, constrain=True, size=1):
    sj = cmds.ikHandle(ik, q=True, sj=True)
    Gp = null2(name + '_PvGrp', sj, False)[0]
    Pv = circle(name + '_PV', sj, 'diamond_ctrl', size * 1, 17, 8, 1, (0, 0, 1))[0]
    cmds.parent(Pv, Gp)
    X = cmds.getAttr(ik + '.poleVectorX')
    Y = cmds.getAttr(ik + '.poleVectorY')
    Z = cmds.getAttr(ik + '.poleVectorZ')
    cmds.setAttr(Pv + '.translateX', distance * X)
    cmds.setAttr(Pv + '.translateY', distance * Y)
    cmds.setAttr(Pv + '.translateZ', distance * Z)
    if constrain == True:
        cmds.poleVectorConstraint(Pv, ik)
    return Gp, Pv
开发者ID:boochos,项目名称:work,代码行数:14,代码来源:atom_placement_lib.py


示例9: setupPoleVec

    def setupPoleVec(self):
        middleName = rg.stripMiddle(self.m_joints.m_shoulder, 0, 3)
        desiredName = self.m_name+"PoleVec_LOC"
        self.m_poleVec = cmds.spaceLocator(n = desiredName)[0]
        # Add to controls
        rc.addToControlDict(self.m_allControls, "%s_IKPoleVec" %(self.m_baseName), self.m_poleVec)
        rc.addToLayer(self.m_sceneData, "mainCtrl", self.m_poleVec)
        cmds.addAttr(
            self.m_poleVec, 
            ln=self.m_poleVecPinAttr, 
            min=0, 
            max=1, 
            k=True, 
            dv=0
            )
        cmds.addAttr(
            self.m_poleVec, 
            ln=self.m_maxStretchAttr, 
            at = "float", 
            min=0, 
            dv=10, 
            k=1
            )
        self.m_maxStretch = "%s.%s" %(self.m_poleVec, self.m_maxStretchAttr)
        rc.orientControl(self.m_poleVec, self.m_joints.m_elbow1)
        groups = rg.add3Groups(self.m_poleVec, ["_SDK", "_CONST", "_0"])
        cmds.poleVectorConstraint(self.m_poleVec, self.m_ikHandle)
        cmds.parent(groups[-1], self.m_group, r=1)
        # Lock unused attributes
        rc.lockAttrs(
            self.m_poleVec,
            ["scale", "rotate"],
            True,
            False
            )


        axis , offset = self.getPoleVecAxis(2)
        if axis != "":
            cmds.setAttr("%s.t%s" %(groups[1], axis), offset) 

        #Create line
        midGroup = cmds.group(em=1, n=self.m_name+"PoleVec_GRP")
        cmds.parent(midGroup, self.m_group)
        cmds.pointConstraint(self.m_joints.m_elbow1, midGroup)
        cmds.pointConstraint(self.m_joints.m_elbow2, midGroup)
        lineNodes = rc.createLine([self.m_poleVec, midGroup], self.m_sceneData, "mainCtrl")
        cmds.parent(lineNodes[0], self.m_group)
开发者ID:jaredauty,项目名称:Rigging,代码行数:48,代码来源:IKArm.py


示例10: targetAliasList

def targetAliasList(constraint):
	'''
	Return a list of targets (drivers) attribute aliases for the specified constraint node
	@param constraint: The constraint node whose targets will be returned
	@type constraint: str
	'''
	# Check Constraint
	if not isConstraint(constraint):
		raise Exception('Constraint "'+constraint+'" does not exist!!')
	
	# Get Target List
	targetList = []
	constraintType = mc.objectType(constraint)
	if constraintType == 'aimConstraint': targetList = mc.aimConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'geometryConstraint': targetList = mc.geometryConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'normalConstraint': targetList = mc.normalConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'orientConstraint': targetList = mc.orientConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'parentConstraint': targetList = mc.parentConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'pointConstraint': targetList = mc.pointConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'poleVectorConstraint': targetList = mc.poleVectorConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'scaleConstraint': targetList = mc.scaleConstraint(constraint,q=True,weightAliasList=True)
	elif constraintType == 'tangentConstraint': targetList = mc.tangentConstraint(constraint,q=True,weightAliasList=True)
	
	# Check Target List
	if not targetList: targetList = []
	
	# Return Result
	return targetList
开发者ID:auqeyjf,项目名称:glTools,代码行数:28,代码来源:constraint.py


示例11: setupPV

    def setupPV(self, IKHandle, type, x):
        """type can be "normal" (a control) or "noFlip" with hidden control and twist attribute. add to self.PVList """
        # set values for this chain, side
        thisChain = self.IKChains[x]
        side = self.prefixList[x]

        pv = "%s_%s_PV" % (side, self.limbName)

        if type == "normal":
            if x == 0:
                thisPV = rig.createControl(pv, "sphere", self.jAxis1, "darkBlue")
            if x == 1:
                thisPV = rig.createControl(pv, "sphere", self.jAxis1, "darkRed")
            thisGrp = cmds.group(pv, n="%s_%s" % (pv, self.groupSuffix))

            # get pos of joints 0 and 2 to position pv group
            topPosRaw = cmds.xform(thisChain[0], ws=True, q=True, t=True)
            topPos = om.MVector(topPosRaw[0], topPosRaw[1], topPosRaw[2])
            lowPosRaw = cmds.xform(thisChain[2], ws=True, q=True, t=True)
            lowPos = om.MVector(lowPosRaw[0], lowPosRaw[1], lowPosRaw[2])

            midPos = (topPos + lowPos) / 2

            cmds.xform(thisGrp, ws=True, t=(midPos.x, midPos.y, midPos.z))

            aim = cmds.aimConstraint(thisChain[1], thisGrp, aim=(0, 0, -1))
            cmds.delete(aim)

            cmds.xform(thisGrp, os=True, r=True, t=(0, 0, -10))

            # strip control to translate
            rig.stripToTranslate(thisPV)

            # -----------capture all constraints as list?
            # hook up pv
            cmds.poleVectorConstraint(thisPV, IKHandle)

            # add pv to list
            self.PVList.append(thisPV)

            # return pv
            return thisPV
        cmds.addAttr(thisPV, ln="follow", at="enum", en="world:foot")

        if type == "noFlip":
            pass
        pass
开发者ID:zethwillie,项目名称:python_rigger,代码行数:47,代码来源:legRig.py


示例12: createIkControls

    def createIkControls(self):
        # Create controls and solvers
        wristControl = self.createWristControl()
        poleVector = self.createPoleVector(distanceScale=5)
        ikHandle = self.createIkHandle()[0]

        # Create and constrain arm ik handle
        cmds.pointConstraint(wristControl, ikHandle)
        cmds.poleVectorConstraint(poleVector, ikHandle)

        # Create null groups
        self.utils.createNullGroup(wristControl)
        self.utils.createNullGroup(poleVector)

        # Lock controller attributes
        self.utils.lockAttrs(wristControl, rotate=True, scale=True, visibility=True)
        self.utils.lockAttrs(poleVector, rotate=True, scale=True, visibility=True)
开发者ID:carlkeifer3,项目名称:tbRigKit,代码行数:17,代码来源:arm.py


示例13: bdRigIkArm

def bdRigIkArm(side):
    ikChainStart = bdBuildDrvChain(side,'ik')
    ikChainJoints = cmds.listRelatives(ikChainStart, ad=True,type='joint')
    ikChainJoints.reverse()
    ikBones = ikChainStart + ikChainJoints
    print ikBones
    armIk = cmds.ikHandle(sol= 'ikRPsolver',sticky='sticky', startJoint=ikBones[0],endEffector = ikBones[2],name = side + '_arm_ikHandle')
    handIk = cmds.ikHandle(sol= 'ikSCsolver',sticky='sticky', startJoint=ikBones[2],endEffector = ikBones[3],name = side + '_hand_ikHandle')
    ikHandlesGrp = cmds.group([armIk[0],handIk[0]],n=side + '_arm_ikHandles_grp')
    wristPos = cmds.xform(ikBones[2],q=True,ws=True,t=True)
    cmds.move(wristPos[0], wristPos[1], wristPos[2], [ikHandlesGrp + '.scalePivot',ikHandlesGrp + '.rotatePivot'])
    pvAnim = cmds.ls(side + '_elbow_ik_anim', type='transform')[0]
    if pvAnim:
        cmds.poleVectorConstraint(pvAnim,armIk[0])
    
    ikAnimCtrl = cmds.ls(side + '_hand_ik_anim',type='transform')[0] 
    cmds.parentConstraint(ikAnimCtrl, ikHandlesGrp)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:17,代码来源:bdRigArm.py


示例14: create_ik_setup

 def create_ik_setup(self):
     """Creates the IK setup."""
     ik_leg = cmds.ikHandle(sj=self.ik_jnts[0], ee=self.ik_jnts[2], sol='ikRPsolver')
     cmds.rename(ik_leg[1], '%s_%s_%s' % (self.side, 'leg', self.nc.effector))
     ik_leg = cmds.rename(ik_leg[0], '%s_%s_%s' % (self.side, 'leg', self.nc.ikhandle))
     ik_foot = cmds.ikHandle(sj=self.ik_jnts[2], ee=self.ik_jnts[3])
     cmds.rename(ik_foot[1], '%s_%s_%s' % (self.side, 'foot', self.nc.effector))
     ik_foot = cmds.rename(ik_foot[0], '%s_%s_%s' % (self.side, 'foot', self.nc.ikhandle))
     ik_ball = cmds.ikHandle(sj=self.ik_jnts[3], ee=self.ik_jnts[4])
     cmds.rename(ik_ball[1], '%s_%s_%s' % (self.side, 'ball', self.nc.effector))
     ik_ball = cmds.rename(ik_ball[0], '%s_%s_%s' % (self.side, 'ball', self.nc.ikhandle))
     cmds.parent(ik_leg, ik_foot, self.controls['ik'])
     self.create_ik_stretch()
     cmds.poleVectorConstraint(self.controls['knee'], ik_leg, weight=1)
     self.create_knee_pin()
     self._reverse_foot([ik_leg, ik_foot, ik_ball])
     self._foot_attributes([ik_leg, ik_foot, ik_ball])
开发者ID:jonntd,项目名称:Rigganator,代码行数:17,代码来源:leg.py


示例15: ikArmSetup

 def ikArmSetup(self):
     """
     #- ik arm setup
     """
     
     cmds.select(cl = True)
     for lr in self.lrPrefix:
         cmds.select('%sshoulder_jnt' %lr, r = True)
         cmds.duplicate(rr = True, n = '%sik_shoulder_jnt' %lr)          
         armChild = cmds.listRelatives('%sik_shoulder_jnt' %lr, ad = True, f = True)
         
         cmds.rename(armChild[0], '%sik_wrist_jnt' %lr )
         cmds.rename(armChild[1], '%sik_elbow_jnt' %lr ) 
         
         if lr == self.left:
                 ctlColor = 6
         else:
                 ctlColor = 12
         controller.boxController('%sarm_ik_ctl' %lr, ctlColor, ['sc', 'vi'])
         controller.arrowController('%sarm_polevector_ctl' %lr, ctlColor, ['ro', 'sc', 'vi'])
 
         cmds.select('%sik_wrist_jnt' %lr, r = True)
         cmds.select('%sarm_ik_ctl_grp' %lr, tgl = True)
         cmds.pointConstraint(mo = False, weight = 1)
         cmds.orientConstraint(mo = False, weight = 1)
         cmds.delete('%sarm_ik_ctl_grp_pointConstraint1' %lr)
         cmds.delete('%sarm_ik_ctl_grp_orientConstraint1' %lr)
         
         cmds.select('%sarm_ik_ctl' %lr, r = True)
         cmds.select('%sik_wrist_jnt' %lr, tgl = True)
         cmds.orientConstraint(mo = False, weight = 1)
         
         cmds.select('%sik_shoulder_jnt.rotatePivot' %lr, r = True)
         cmds.select('%sik_wrist_jnt.rotatePivot' %lr, add = True)
         cmds.ikHandle(n = '%sarm_ikHandle' %lr, sol = 'ikRPsolver')             
         
         self.util.parent('%sarm_ikHandle' %lr, '%sarm_ik_ctl' %lr)
         
         polVecPos = poleVector.getPolVectorPos('%sik_shoulder_jnt' %lr, '%sik_elbow_jnt' %lr, '%sik_wrist_jnt' %lr, 1)
         cmds.select('%sarm_polevector_ctl_grp' %lr, r = True)
         cmds.move(polVecPos[0], polVecPos[1], polVecPos[2])
         
         cmds.select('%sarm_polevector_ctl' %lr, r = True)
         cmds.select('%sarm_ikHandle' %lr, tgl = True)
         cmds.poleVectorConstraint(weight = 1)
开发者ID:darkuress,项目名称:arNew,代码行数:45,代码来源:armSetup.py


示例16: createNoFlipKnee

    def createNoFlipKnee(self, iksSolver, hip, footControl, *args):
        """ Create a locator """

        """ Create a locator to use for the PoleVector"""
        lctrName = hip.replace("Jnt_", "LctrPV_")
        lctrPos = cmds.xform(hip, q=True, ws=True, t=True)
        pvPoint = cmds.spaceLocator(n=lctrName, p=lctrPos)
        cmds.xform(cp=True)
        cmds.makeIdentity( apply=True )

        """ Parent the locator to the cog """
        cmds.parent(pvPoint, "rig_root") #Temp

        """ Constran ikHandle to PV """
        cmds.poleVectorConstraint(pvPoint[0], iksSolver[0])

        """ Create a twist attribute on the foot control """
        cmds.select(footControl)
        try:
            cmds.addAttr( shortName='twist', longName='twist', defaultValue=0, k=True)
        except:
            print "twist attr may have not been created"
        cmds.select(d=True)

        """ Create an mdiv and a pma node """
        mdivNamePrefix = hip.replace("Jnt_", "mDiv_PV_") 
        mdivNode = cmds.shadingNode("multiplyDivide", asUtility=True, n=mdivNamePrefix)

        pmaNamePrefix = hip.replace("Jnt_", "Pma_PV__") 
        pmaNode = cmds.shadingNode("plusMinusAverage", asUtility=True, n=pmaNamePrefix)

        cmds.connectAttr(footControl[0]+".twist", mdivNode+".input1X")
        cmds.connectAttr(footControl[0]+".ry", mdivNode+".input1Y")
        # Will need to change this with cog
        cmds.connectAttr("jnt_c1_spine1.ry", mdivNode+".input1Z")

        cmds.setAttr(mdivNode+".input2X", -1)
        cmds.setAttr(mdivNode+".input2Y", -1)
        cmds.setAttr(mdivNode+".input2Z", -1)

        cmds.connectAttr(mdivNode+".input1X", pmaNode+".input1D[0]")
        cmds.connectAttr(mdivNode+".input1Y", pmaNode+".input1D[1]")
        cmds.connectAttr(pmaNode+".output1D", iksSolver[0]+".twist")
        #142.4
        cmds.setAttr(footControl[0]+".twist", 90)
开发者ID:griffinanimator,项目名称:GTOOLS,代码行数:45,代码来源:QuadLeg.py


示例17: ikSolver

def ikSolver(rootJoint, endJoint, type, controller, parent, pvControl=False):
    solver = "ikRPsolver"
    if type == "sc":
        solver = "ikSCsolver"

    ikHandle = mc.ikHandle(n=rootJoint.replace(nameLib.prefixNames.ikSuffix, "") + "_ikHandle", sj=rootJoint, ee=endJoint , sol=solver)[0]

    # hide solver
    mc.setAttr(ikHandle + ".v", 0)

    # add pc control to ikHandle
    if pvControl:
        mc.poleVectorConstraint(pvControl, ikHandle)

    # parent under hand control
    mc.parent(ikHandle, controller)

    return ikHandle
开发者ID:robertvari,项目名称:rvRigTools,代码行数:18,代码来源:ikLegs.py


示例18: buildPoleVect

def buildPoleVect(definition, ikSolver, hip, knee, ankle, toeTIP, crvName):
    from maya.OpenMaya import MVector
    name = definition['component'].data['name']
    side = definition['component'].data['side']
    color = definition['color']
    if cmds.objExists(crvName):
        return crvName

    ####################### POLE
    ## query the pole vector attributes before parenting the ik handle BEFORE parenting...
    poleVecArmValue = cmds.getAttr("{}.poleVector".format(ikSolver))
    hip = cmds.xform(hip, q = True, a = True, ws = True, t = True)
    hipVec = MVector(hip[0], hip[1], hip[2])
    knee = cmds.xform(knee, q = True, a = True, ws = True, t = True)
    kneeVec = MVector(knee[0], knee[1], knee[2])
    ankle = cmds.xform(ankle, q = True, a = True, ws = True, t = True)
    ankleVec = MVector(ankle[0], ankle[1], ankle[2])
    toeTIP = cmds.xform(toeTIP, q = True, a = True, ws = True, t = True)
    toeTIPVec = MVector(toeTIP[0], toeTIP[1], toeTIP[2])
    ## Calculated vectors
    vecHipToKneeDifference = (hipVec - kneeVec)
    hipLength = (vecHipToKneeDifference.length() * 0.5)
    vecKneeToAnkleDifference = (kneeVec- ankleVec)
    kneeLength = vecKneeToAnkleDifference.length()
    vecAnkleToToeDifference = (ankleVec - toeTIPVec)
    toeTIPLength = vecAnkleToToeDifference.length()
    ## Make the Pole Vector Handle
    poleCrv = crvB.buildControlCurve(curveName = crvName, curveType = 'sphere', snap = False, snapTo = '', orientation = 'Y', grouped = True, scaleFactor = .2, color = color, suffix = False)
    ## Group the pole vector transform with an orient group
    poleVectorArmGrp = poleCrv[0]
    ## Determine the position of the pole vector control
    pvPlacement = []
    pos0 = (knee[0] + (poleVecArmValue[0][0] * (kneeLength * 0.25)));
    pos1 = (knee[1] + (poleVecArmValue[0][1] * (kneeLength * 0.25)));
    pos2 = (knee[2] + (poleVecArmValue[0][2] * (kneeLength * 0.25)));
    pvPlacement.append(pos0)
    pvPlacement.append(pos1)
    pvPlacement.append(pos2)
    ## Move it into position
    cmds.xform(poleVectorArmGrp, a = True, ws = True, t = pvPlacement)
    ## Apply the pv constraint
    polecst = cmds.poleVectorConstraint(poleCrv[1], ikSolver, weight = 1)
    newPoleCstName = polecst[0][:-1]
    cmds.rename(polecst[0], newPoleCstName)
    createDefaultMetaData(newPoleCstName, name, side, 'poleVectorConstraint')
    ## Add metaData
    ctrls = [poleCrv]
    for eachCtrl in ctrls:
        createDefaultMetaData(eachCtrl[0], name, side, 'ctrlBuffer')
        createDefaultMetaData(eachCtrl[1], name, side, 'ctrl')
        addMessageAttr(eachCtrl[1], 'parent')
        connMessageAttr(eachCtrl[1], 'parent', eachCtrl[0])

        parentTo(eachCtrl[0], definition['component'].data['control'])

    return poleCrv
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:56,代码来源:rigBuildLib.py


示例19: create_ik_setup

    def create_ik_setup(self):
        """@todo: insert doc for create_ik_setup"""
        # ik arm, hand
        ik_leg = cmds.ikHandle(sj=self.ik_jnts[0], ee=self.ik_jnts[2], sol='ikRPsolver')
        cmds.rename(ik_leg[1], '%s_%s_%s' % (self.side, 'leg', self.nc['effector']))
        ik_leg = cmds.rename(ik_leg[0], '%s_%s_%s' % (self.side, 'leg', self.nc['ikhandle']))

        ik_foot = cmds.ikHandle(sj=self.ik_jnts[2], ee=self.ik_jnts[3])
        cmds.rename(ik_foot[1], '%s_%s_%s' % (self.side, 'foot', self.nc['effector']))
        ik_foot = cmds.rename(ik_foot[0], '%s_%s_%s' % (self.side, 'foot', self.nc['ikhandle']))

        # ik_ball = cmds.ikHandle(sj=self.ik_jnts[2], ee=self.ik_jnts[3])
        # cmds.rename(ik_ball[1], '%s_%s_%s' % (self.side, 'ball', self.nc['effector']))
        # ik_ball = cmds.rename(ik_ball[0], '%s_%s_%s' % (self.side, 'ball', self.nc['ikhandle']))

        cmds.parent(ik_leg, ik_foot, self.controls['ik'])
        self.create_ik_stretch()
        cmds.poleVectorConstraint(self.controls['knee'], ik_leg, weight=1)
        self.create_knee_pin()
开发者ID:jonntd,项目名称:Rigganator,代码行数:19,代码来源:dragonleg.py


示例20: createPoleVec

def createPoleVec(joints, ikHandle, position):
    """
        Creates pole vector for handle for three joints
    """
    if len(joints) != 3:
        cmds.error("Incorrect number of joints supplied to IkHandle.")
    
    # Create locator to act as pole vector
    locName = (String.removeSuffix(ikHandle) + "Pole_LOC")
    poleGrpName = (String.removeSuffix(ikHandle) + "Pole_GRP")
    poleVecName = (String.removeSuffix(ikHandle) + "Pole_PVC")
    
    loc = Lib.getFirst(cmds.spaceLocator(n = locName, p= (0,0,0) ))
    cmds.xform(loc, ws= True, t= (position[0], position[1], position[2]) )
    locGrp = cmds.group(loc, n= poleGrpName)
    cmds.poleVectorConstraint( loc , ikHandle, n= poleVecName, w=.1 )
    cmds.setAttr((loc + ".v"), 0)
    
    return locGrp
开发者ID:jwnwilson,项目名称:nw_rig,代码行数:19,代码来源:Control.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.polyCube函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.pointPosition函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap