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

Python cmds.ikHandle函数代码示例

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

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



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

示例1: switchToIK

def switchToIK( control, ikHandle=None, poleControl=None, onCmd=None, offCmd=None ):
	'''
	this proc will align the IK controller to its fk chain
	flags used:
	-control   this is the actual control being used to move the ikHandle - it is assumed to be the same object as the ikHandle, but if its different (ie if the ikHandle is constrained to a controller) use this flag
	-pole      tells the script the name of the pole controller - if there is no pole vector control, leave this flag out
	-ikHandle  this flag specifies the name of the ikHandle to work on
	-onCmd     this flag tells the script what command to run to turn the ik handle on - it is often left blank because its assumed we're already in ik mode
	-offCmd    this flag holds the command to turn the ik handle off, and switch to fk mode
	NOTE: if the offCmd isn't specified, it defaults to:  if( `getAttr -se ^.ikb` ) setAttr ^.ikb 1;

	symbols to use in cmd strings:
	 ^  refers to the ikHandle
	 #  refers to the control object

	example:
	zooAlignIK "-control somObj -ikHandle ikHandle1 -offCmd setAttr #.fkMode 0";
	'''
	if ikHandle is None:
		ikHandle = control

	if callable( onCmd ):
		onCmd( control, ikHandle, poleControl )

	joints = cmd.ikHandle( ikHandle, q=True, jl=True )
	effector = cmd.ikHandle( ikHandle, q=True, ee=True )
	effectorCtrl = listConnections( '%s.tx' % effector, d=False )[ 0 ]

	mel.zooAlign( "-src %s -tgt %s" % (effectorCtrl, control) )
	if poleControl is not None and objExists( poleControl ):
		pos = mel.zooFindPolePosition( "-start %s -mid %s -end %s" % (joints[ 0 ], joints[ 1 ], effectorCtrl) )
		move( pos[0], pos[1], pos[2], poleControl, a=True, ws=True, rpr=True )

	if callable( offCmd ):
		offCmd( control, ikHandle, poleControl )
开发者ID:BGCX261,项目名称:zootoolbox-git,代码行数:35,代码来源:rigUtils.py


示例2: uiCmd_createSplineJointEachSpans

def uiCmd_createSplineJointEachSpans( *args ):
    
    selections = cmds.ls( sl=1 )
    curve = selections[0]
    curveShape = cmds.listRelatives( curve, s=1 )[0]
    
    minValue = cmds.getAttr( curveShape+'.minValue' )
    maxValue = cmds.getAttr( curveShape+'.maxValue' )
    
    spans    = cmds.getAttr( curveShape+'.spans' )
    
    paramRange = maxValue - minValue
    eachParamRate = paramRange / spans
    
    infos = []
    
    for i in range( 0, spans+1 ):
        info = cmds.createNode( 'pointOnCurveInfo' )
        cmds.connectAttr( curveShape+'.local', info+'.inputCurve' )
        cmds.setAttr( info+'.parameter', eachParamRate*i )
        infos.append( info )
    
    cmds.select( d=1 )
    jnts = [ cmds.joint() ]
    for i in range( spans ):
        cmds.select( jnts[-1] )
        jnt = cmds.joint()
        jnts.append( jnt )
        
        distNode = cmds.createNode( 'distanceBetween' )
        cmds.connectAttr( infos[i]+'.position', distNode+'.point1' )
        cmds.connectAttr( infos[i+1]+'.position', distNode+'.point2' )
        cmds.connectAttr( distNode+'.distance', jnt+'.tx' )

    cmds.ikHandle( sj=jnts[0], ee=jnts[-1], sol='ikSplineSolver', ccv=False, pcv=False, curve=curveShape )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:35,代码来源:cmdModel.py


示例3: __init__

 def __init__(self, curve_sel, vertex_list):
     self.curve_sel = curve_sel
     self.verts = vertex_list
     self.find_length = Find_Out()
             
     self.link_length = self.find_length.edge_length(self.verts)
     self.chain_length = self.find_length.curve_length(self.curve_sel)
     self.link_total = int(self.chain_length/self.link_length)
     
     cmds.duplicate(self.curve_sel, n = 'buildCurve')
     cmds.rebuildCurve('buildCurve', ch = 1, rpo = 1, rt = 0, end = 1, kr = 2, kep = 1, kt = 0, kcp = 0, s = self.link_total/2, d = 3, tol = 0.01 )
     
     self.num_cv = int(cmds.getAttr ('buildCurve.degree'))+ (cmds.getAttr ('buildCurve.spans'))
     
     for dummy_cv in range(self.num_cv):
         dummy_cv_pos = (cmds.getAttr ('buildCurve.cv['+ str(dummy_cv) +']'))
         
         if dummy_cv == 0:
             cmds.joint(n=self.curve_sel+'_jointRoot',p = dummy_cv_pos[0])
         elif dummy_cv == self.num_cv - 1:
             cmds.joint(n=self.curve_sel+'_jointEnd', p = dummy_cv_pos[0])
         else:
             cmds.joint(n=self.curve_sel+'_joint_'+(str(dummy_cv)),p = dummy_cv_pos[0])    
     
     cmds.delete('buildCurve')        
     cmds.ikHandle( sj = (self.curve_sel+'_jointRoot'), ee = (self.curve_sel+'_jointEnd'), c = self.curve_sel,
             sol = 'ikSplineSolver', scv = 0, pcv = 0, ccv = 0, ns = 4)       
开发者ID:XJZeng,项目名称:ChainMaker,代码行数:27,代码来源:chain_maker.py


示例4: ik_stretch

def ik_stretch(ikhnd):
    '''

    '''
    jts = cmds.ikHandle(ikhnd, q=True, jl=True)
    cu_s = cmds.ikHandle(ikhnd, q=True, c=True)
    cu = cmds.listRelatives(cu_s, p=1)[0]
    cmds.addAttr(ikhnd, longName='ik_stretch', k=1, defaultValue=1.0, minValue=0.0, maxValue=1.)

    dcu = cmds.duplicate(cu, n=cu + '_base_scale')[0]
    dcu_s = cmds.listRelatives(dcu, c=1)[0]

    cf = cmds.createNode('curveInfo')
    dcf = cmds.createNode('curveInfo')
    bl = cmds.createNode('blendTwoAttr')
    md = cmds.createNode('multiplyDivide')

    cmds.connectAttr(cu_s + '.worldSpace', cf + '.inputCurve')
    cmds.connectAttr(dcu_s + '.worldSpace', dcf + '.inputCurve')
    cmds.connectAttr(dcf + '.arcLength', bl + '.input[0]')
    cmds.connectAttr(cf + '.arcLength', bl + '.input[1]')
    cmds.connectAttr(ikhnd + '.ik_stretch', bl + '.attributesBlender')
    cmds.connectAttr(bl + '.output', md + '.input1X')

    cmds.setAttr(md + '.input2X', cmds.getAttr(cf + '.arcLength'), l=1)
    cmds.setAttr(md + '.operation', 2)
    cmds.setAttr(dcu + '.v', 0)

    for j in jts:
        cmds.connectAttr(md + '.outputX', j + '.sx')

    return dcu
开发者ID:Italic-,项目名称:maya-prefs,代码行数:32,代码来源:variableKinematics.py


示例5: RMIdentifyIKJoints

 def RMIdentifyIKJoints(self,ikHandle):
     endEffector = cmds.ikHandle(ikHandle, q = True, endEffector = True)
     EndJoint = RMRigTools.RMCustomPickWalk (endEffector, 'joint', 1, Direction = "up")
     EndJoint = RMRigTools.RMCustomPickWalk (EndJoint[len(EndJoint)-1], 'joint', 1)
     EndJoint = EndJoint[1]
     StartJoint = cmds.ikHandle(ikHandle, q = True, startJoint = True)
     return RMRigTools.FindInHieararchy (StartJoint, EndJoint)
开发者ID:rendermotion,项目名称:RMMel,代码行数:7,代码来源:RMLimbIKFK.py


示例6: _create_reverse_setup

    def _create_reverse_setup(self):
        
        # Create Ik handles
        ball_ik, ball_effector = cmds.ikHandle(sj=self.joint_detail['ankle'], ee=self.joint_detail['ball'], sol="ikSCsolver")
        tip_ik, tip_effector = cmds.ikHandle(sj=self.joint_detail['ball'], ee=self.joint_detail['tip'], sol="ikSCsolver")

        self.ik_detail['ball'] = ball_ik
        self.ik_detail['tip'] = tip_ik
开发者ID:eddiehoyle,项目名称:link,代码行数:8,代码来源:limb.py


示例7: build

def build(startJoint,endJoint,solver='ikSCsolver',curve='',ikSplineOffset=0.0,prefix=''):
	'''
	INPUTS:
	@input startJoint: Start joint for the IK handle
	@inputType startJoint: str
	@input endJoint: End joint for the IK handle
	@inputType endJoint: str
	@input solver: IK Solver to use
	@inputType solver: str
	@input curve: Input curve for splineIK
	@inputType curve: str
	@input ikSplineOffset: Offset value for ikSplineSolver
	@inputType ikSplineOffset: float
	@input prefix: Name prefix for all builder created nodes
	@inputType prefix: str
	'''
	# Check joints
	if not mc.objExists(startJoint): raise Exception('Joint '+startJoint+' does not exist!!')
	if not mc.objExists(endJoint): raise Exception('Joint '+endJoint+' does not exist!!')
	
	# Check solver type
	ikType = ['ikSplineSolver','ikSCsolver','ikRPsolver','ik2Bsolver']
	if not ikType.count(solver):
		raise Exception('Invalid ikSlover type specified ("'+solver+ '")!!')
	
	# Check curve
	createCurve = False
	if solver == ikType[0]: # solver = ikSplineSolver
		if not mc.objExists(curve):
			createCurve = True
	
	# Extract name prefix from joint name
	if not prefix: prefix = glTools.utils.stringUtils.stripSuffix(startJoint)
	
	mc.select(cl=True)
	
	#-----------------
	# Create ikHandle
	ik = []
	if solver == ikType[0]:
		# Spline IK solver
		ik = mc.ikHandle(sj=startJoint,ee=endJoint,sol=solver,curve=curve,ccv=createCurve,pcv=False)
	else:
		# Chain IK solver
		ik = mc.ikHandle(sj=startJoint,ee=endJoint,sol=solver)
	
	# Clear selection (to avoid printed warning message)
	mc.select(cl=True)
	
	# Rename ikHandle and endEffector
	ikHandle = str(mc.rename(ik[0],prefix+'_ikHandle'))
	ikEffector = str(mc.rename(ik[1],prefix+'_ikEffector'))
	
	# Set ikHandle offset value
	mc.setAttr(ikHandle+'.offset',ikSplineOffset)
	
	# Return result
	return ikHandle
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:58,代码来源:ikHandle.py


示例8: createListRig

	def createListRig(self, list,nameElement,ikHandleBase=None):
		for index in range(len(list)):
			tuplePoint = list[index]
			cmds.joint(p=tuplePoint,name=nameElement + str(index))
			cmds.ikHandle( sj=ikHandleBase ,ee=nameElement + "0")
			cmds.select(nameElement + str(index))
		for index in range(len(list)-1) :
			cmds.select(nameElement + str(index+1))
			cmds.ikHandle(sj=nameElement + str(index))
开发者ID:LecomteEmerick,项目名称:MayaProject,代码行数:9,代码来源:autoriggin_ui.py


示例9: ikSplineSolver

    def ikSplineSolver(self, 
                         startJoint = None, 
                         endEffector = None, 
                         curve = None, 
                         side = None, 
                         name = None, 
                         suffix = None,
                         parent = None,
                         hide = False):
        #--- do the proper naming checks
        self.__check_ik_name(startJoint = startJoint, endEffector = endEffector, 
                           side = side, name = name, suffix = suffix)

        #--- create the ik_handle
        if curve == None:
            ik = cmds.ikHandle(startJoint = startJoint, 
                                endEffector = endEffector, 
                                createCurve = True, 
                                name = self.ik_name, solver = 'ikSplineSolver')
        else:
            if cmds.objExists(curve):
                ik = cmds.ikHandle(startJoint = startJoint, 
                                    endEffector = endEffector, 
                                    curve = curve, createCurve = False, 
                                    name = self.ik_name, solver = 'ikSplineSolver')
            else:
                raise Exception('There is no specified curve: ' + curve )

        #--- rename the effector
        eff = cmds.rename(ik[1], ik[0] + 'EFF')

        #--- store the ik_handle and effector in a list to return
        ik_handle = []
        if curve == None:
            #--- rename the automated curve
            crv = cmds.rename(ik[-1], ik[0] + 'CRV')
            ik_handle = [ik[0], eff, crv]
        else:
            ik_handle = [ik[0], eff, curve]

        #--- parent the ik_handle under the specified parent
        if parent:
            cmds.parent(ik_handle[0], parent)

        #--- hide the ikHandle
        if hide:
            cmds.setAttr(ik_handle[0] + '.v', 0)

        cmds.select(clear = 1)
        return ik_handle
    #end def ikSplineSolver()
#end class IkHandle()
开发者ID:jonntd,项目名称:Public,代码行数:52,代码来源:ikhandle.py


示例10: make_joint

def make_joint():
    """
    Create a few joints
    """

    cmds.select(d=True)
    cmds.joint(p=(0, 0, 0), name="joint1")
    cmds.joint(p=(0, 4, 0), name="joint2")
    cmds.joint("joint1", e=True, zso=True, oj="xyz")
    cmds.joint(p=(0, 8, -1), name="joint3")
    cmds.joint("joint2", e=True, zso=True, oj="xyz")
    cmds.joint(p=(2, 9, 3), name="joint4")
    cmds.joint("joint3", e=True, zso=True, oj="xyz")

    cmds.ikHandle(n="tendon", sj="joint1", ee="joint4", p=2, w=0.5)
开发者ID:chirs,项目名称:studio5,代码行数:15,代码来源:leg.py


示例11: create_ik_setup

 def create_ik_setup(self):
     """@todo: insert doc for create_ik_setup"""
     # ik arm, hand
     ik_arm = cmds.ikHandle(sj=self.ik_jnts[0], ee=self.ik_jnts[2], sol='ikRPsolver')
     cmds.rename(ik_arm[1], '%s_%s_%s' % (self.side, 'arm', self.nc.effector))
     ik_arm = cmds.rename(ik_arm[0], '%s_%s_%s' % (self.side, 'arm', self.nc.ikhandle))
     ik_hand = cmds.ikHandle(sj=self.ik_jnts[2], ee=self.ik_jnts[3])
     cmds.rename(ik_hand[1], '%s_%s_%s' % (self.side, 'arm', self.nc.effector))
     ik_hand = cmds.rename(ik_hand[0], '%s_%s_%s' % (self.side, 'hand', self.nc.ikhandle))
     cmds.parent(ik_arm, ik_hand, self.controls['handik'])
     self.create_ik_arm_stretch()
     pv = cmds.poleVectorConstraint(self.controls['elbow'], ik_arm, weight=1)
     self.create_elbow_pin()
     # twist switch
     cmds.connectAttr('%s.twist' % self.controls['hand'], '%s_%s_%s.dTwistControlEnable' % (self.side, 'upperArm', self.nc.ikhandle), f=True)
     cmds.connectAttr('%s.twist' % self.controls['hand'], '%s_%s_%s.dTwistControlEnable' % (self.side, 'foreArm', self.nc.ikhandle), f=True)
开发者ID:jonntd,项目名称:Rigganator,代码行数:16,代码来源:dragonarm.py


示例12: createToeIk

    def createToeIk(self, ball, toe, iksSolver, footCtrl, *args):
        """ Create an Ik Solver """
        solverName = toe.replace("ikPJnt_", "toeSolver_")
        iktSolver = cmds.ikHandle(n=solverName, sj=ball, ee=toe, sol="ikRPsolver")

        """ Create attributes on the foot control """
        attributes = ("toe_roll", "toe_twist", "toe_bank")
        cmds.select(footCtrl)
        for attr in attributes:  
            cmds.addAttr(shortName=attr, longName=attr, defaultValue=0, k=True)
        cmds.select(d=True)

        """ Create a group at the toe """
        groupName = toe.replace("ikPJnt_", "grp_ik_")
        grpPos = cmds.xform(toe, q=True, t=True, ws=True)
        toeGrp = cmds.group(name=groupName, em=True, p=footCtrl[0])

        cmds.select(toeGrp)
        cmds.xform(toeGrp, t=grpPos, ws=True) 
        cmds.select(d=True)
        #cmds.parent(toeGrp, footCtrl)
        #cmds.parent(iktSolver, footCtrl)
        #cmds.parent(iksSolver, toeGrp)
        #cmds.parent(iktSolver, toeGrp)
        cmds.connectAttr(footCtrl[0]+".toe_roll", toeGrp+".rotateX")
        cmds.connectAttr(footCtrl[0]+".toe_twist", toeGrp+".rotateY")
        cmds.connectAttr(footCtrl[0]+".toe_bank", toeGrp+".rotateZ")
开发者ID:griffinanimator,项目名称:GTOOLS,代码行数:27,代码来源:QuadLeg.py


示例13: setup

    def setup(self):

        #duplicate given joints
        cmds.duplicate( self.oldJoint1, n=self.dupJoint1, po=True )
        cmds.duplicate( self.oldJoint2, n=self.dupJoint2, po=True )
        cmds.parent( self.dupJoint2, self.dupJoint1 )
        cmds.parent(self.dupJoint1, w=True)

        #create rp ik
        ik = cmds.ikHandle(
            sol='ikRPsolver',
            sj=self.dupJoint1,
            ee=self.dupJoint2,
            n=self.ik
        )[0]

        #zero pole vectors
        cmds.setAttr("{0}.poleVectorX".format(self.ik), 0)
        cmds.setAttr("{0}.poleVectorY".format(self.ik), 0)
        cmds.setAttr("{0}.poleVectorZ".format(self.ik), 0)

        #parent to bindJoint
        cmds.select( self.oldJoint1)
        clav = cmds.pickWalk(d='Up')
        cmds.parent( self.ik, self.oldJoint1)
        cmds.parent( self.dupJoint1, clav )

        #hide ik
        cmds.setAttr( '{0}.v'.format(ik), 0 )

        # hide them they ugly
        cmds.setAttr( "{0}.v".format(self.dupJoint1), 0)
        cmds.setAttr( "{0}.v".format(self.dupJoint2), 0)
开发者ID:jdynamite,项目名称:autorigger,代码行数:33,代码来源:noRoll.py


示例14: _setup

    def _setup(self):
        sj = self.joints[0]
        ej = self.joints[-1]

        self.spineCurve = 'curve_bindSpine'
        # setup IK
        ikSpine = cmd.ikHandle(sj=sj, ee=ej, name='ikHandle_bindSpine', sol='ikSplineSolver', createCurve=True,
                               ns=2)
        cmd.rename(ikSpine[2], self.spineCurve)

        # clusters
        clusterReturn = general.clusterCurve(self.spineCurve, 'cluster_spineIK')
        clusters = clusterReturn[0]
        clusterGrp = clusterReturn[1]

        # ==================controllers setup=============================
        if self.upperCtrl == None:
            self.upperCtrl = self._drawCtrl('ctrl_upperTorso', self.joints[-2])
        if self.lowerCtrl == None:
            self.lowerCtrl = self._drawCtrl('ctrl_lowerTorso', self.joints[1])

        for i in [0, 1]:
            cmd.parentConstraint(self.lowerCtrl, clusters[i], mo=True)
        for i in [2, 3, 4]:
            cmd.parentConstraint(self.upperCtrl, clusters[i], mo=True)
开发者ID:waixwong,项目名称:ModularRigging,代码行数:25,代码来源:ikSpine.py


示例15: create_ik_setup

 def create_ik_setup(self):
     """Creates the IK setup."""
     ik = cmds.ikHandle(sj=self.result_jnts[0], ee=self.result_jnts[1])
     cmds.rename(ik[1], '%s_%s_%s' % (self.side, 'shoulder', self.nc.effector))
     ik = cmds.rename(ik[0], '%s_%s_%s' % (self.side, 'shoulder', self.nc.ikhandle))
     cmds.parent(ik, self.controls['ik'])
     self.create_ik_stretch()
开发者ID:jonntd,项目名称:Rigganator,代码行数:7,代码来源:shoulder.py


示例16: get_polar_position

    def get_polar_position(self, handle):
        """Get pole position."""
        joints = cmds.ikHandle(handle, jl=True, q=True)
        joints.append(cmds.listRelatives(joints[-1], c=1)[0])

        j1 = cmds.xform(joints[0], q=1, ws=1, t=1)
        j2 = cmds.xform(joints[1], q=1, ws=1, t=1)
        j3 = cmds.xform(joints[2], q=1, ws=1, t=1)

        vec1 = om.MVector(j1)
        vec2 = om.MVector(j2)
        vec3 = om.MVector(j3)

        first_last = vec3 - vec1
        first_second = vec2 - vec1

        dot = first_second * first_last
        cast = float(dot) / float(first_last.length())
        first_last_normal = first_last.normal()
        cast_vec = first_last_normal * cast

        point = (first_second - cast_vec) * 3
        pole_pos = point + vec2
        pole_offset = om.MVector(cmds.xform(self.polar, q=1, rp=1))
        return(pole_pos - pole_offset)
开发者ID:Italic-,项目名称:maya-scripts,代码行数:25,代码来源:JT_ikfk_switch.py


示例17: create_ik

    def create_ik(self):
        """Ik spline"""

        # Create curve
        tmp_curve = curve.create_from_nodes(self.joints, name=name.set_suffix(self.name, 'ikCrv'), degree=3)
        self.curve = curve.rebuild_curve(tmp_curve, 3)[0]

        start_joint, end_joint = self.ik_joints[0], self.ik_joints[-1]
        logger.info("Creating Ik using nodes: %s" % self.joints)
        self.ik, self.effector = cmds.ikHandle(name=name.set_suffix(self.name, 'ikh'), sj=start_joint, ee=end_joint, curve=self.curve, createCurve=False, sol="ikSplineSolver", ns=3)

        # Add to setups
        self.setups.extend([self.ik, self.curve])

        # Set attrs
        cmds.setAttr("%s.dTwistControlEnable" % self.ik, 1)
        cmds.setAttr("%s.dWorldUpAxis" % self.ik, 1)
        cmds.setAttr("%s.dWorldUpType" % self.ik, 4)
        cmds.setAttr("%s.dWorldUpVector" % self.ik, 1.0, 0.0, 0.0, type="float3")
        cmds.setAttr("%s.dWorldUpVectorEnd" % self.ik, 1.0, 0.0, 0.0, type="float3")

        # Turn on cvs
        cmds.select(self.curve, r=True)
        cmds.toggle(cv=True)

        # Create clusters
        clusters = OrderedDict()
        clusters['bot'] = cmds.cluster(["%s.cv[0]" % self.curve, "%s.cv[1]" % self.curve])[1]
        clusters['mid'] = cmds.cluster(["%s.cv[2]" % self.curve, "%s.cv[3]" % self.curve])[1]
        clusters['top'] = cmds.cluster(["%s.cv[4]" % self.curve, "%s.cv[5]" % self.curve])[1]
        
        xform.match_pivot(start_joint, clusters['bot'])
        xform.match_pivot(end_joint, clusters['top'])

        self.clusters = clusters
开发者ID:eddiehoyle,项目名称:link,代码行数:35,代码来源:spline.py


示例18: setupIK

 def setupIK(self):
     #Create shoulder 
     self.m_shoulderCtrl = cmds.spaceLocator(
         n=self.m_joints.m_shoulder.replace("_JNT", "_LOC")
         )[0]
     # Add to controls
     rc.addToControlDict(self.m_allControls, "%s_IKShoulder" %(self.m_baseName), self.m_shoulderCtrl)
     rc.addToLayer(self.m_sceneData, "hidden", self.m_shoulderCtrl)
     rc.orientControl(self.m_shoulderCtrl, self.m_joints.m_shoulder)
     rg.add3Groups(self.m_shoulderCtrl, ["_SDK", "_CONST", "_0"])
     cmds.parent(self.m_shoulderCtrl+"_0", self.m_group, r=1)
     cmds.pointConstraint(
         self.m_shoulderCtrl, 
         self.m_joints.m_shoulder, 
         mo=1
         )
     desiredName = self.m_wristCtrl.replace("_CTRL", "_IK")
     self.m_ikHandle = cmds.ikHandle(
         n = desiredName, 
         sj = self.m_joints.m_shoulder, 
         ee = self.m_joints.m_wrist, 
         sol = "ikRPsolver", 
         see = True
         )[0]
     # deselect so we don't get errors
     cmds.select(d=1)
     rc.addToLayer(self.m_sceneData, "hidden", [self.m_ikHandle])
     cmds.parent(self.m_ikHandle, self.m_wristCtrl)
     self.setupPoleVec()
开发者ID:jaredauty,项目名称:Rigging,代码行数:29,代码来源:IKArm.py


示例19: MakeJntAndIKs

def  MakeJntAndIKs(side):
    """
    选择两圈眼球上的线,生成骨骼和ik,side的值例如:R_In or R_Out
    ps: 选择骨骼链的子物体,打组,centerPivot,在原点生成一个骨点,用组约束骨点,正确命名,然后将IK组分别放到对应骨点下边。
    """    
    lx_start=mc.xform('loc_eyeCenter01',q=1,ws=1,t=1)
    lx_mouthPnt= mc.filterExpand(sm=31)
    mc.select (cl=1)
    lx_Jnts=[]
    lx_IKs = []
    for i in lx_mouthPnt :
        lx_end=mc.xform(i,q=1,ws=1,t=1)
        lx_stJnt=mc.joint (n=("Jnt_"+side+"_st"),p=(lx_start[0],lx_start[1],lx_start[2]),radius=0.1)
        lx_edJnt=mc.joint (n=("Jnt_"+side+"_ed"),p=(lx_end[0],lx_end[1],lx_end[2]),radius=0.1)        
        lx_scik =mc.ikHandle (n=("scik_"+side+str(01)),sj=lx_stJnt,ee=lx_edJnt,sol="ikSCsolver")
        #mc.setAttr((str(lx_scik[0]) +".visibility") ,0)
        mc.select(cl=1)
        lx_Jnts.append(lx_stJnt)
        lx_IKs .append(lx_scik[0])
    mc.select(lx_Jnts,r=1)
    mc.group(n=("grp_Jnts"+side))
    
    mc.select(lx_IKs,r=1)
    mc.group(n=("grp_iks"+side))
    mc.setAttr((str("grp_iks"+side) +".visibility") ,0)
    
#3.选择眼皮曲线,执行脚本,生成
    def  MakeEyeLidJnts(cuvs):
        
        
开发者ID:auqeyjf,项目名称:pubTool,代码行数:28,代码来源:j_MakeFacial.py


示例20: j_BodyFix

def j_BodyFix():
    # Get The Goal Joint position 
    position = dict()
    dupJnt = ['ShoulderPart2_L','Elbow_L','ElbowPart1_L','HipPart2_L','Knee_L','KneePart1_L']
    for jnt in dupJnt:
        position[jnt] =mc.xform(jnt,ws=1,t=1,q=1)
        
    # Create  Joint  And Ikhandle From position
    newJnt = []
    na =1;
    for j in dupJnt: 
        if mc.objExists(('Fix'+j)):
            mc.select(('Fix'+j),r=1)
            break;
        newJnt.append(mc.joint(n=('Fix'+j),p=position[j],radius=1.75))
        if na%3==0:        
        # Create IKHandle With ikRPsolver , Then Mirror With IkHandle
            mc.joint(newJnt[0],e=1,zso=1,oj='xyz',sao='yup')
            mc.joint(newJnt[1],e=1,zso=1,oj='xyz',sao='yup')
            mc.setAttr('%s.jointOrient'%newJnt[2],0,0,0)
            ikhand = mc.ikHandle(name=('rpik_'+newJnt[1]+'01'),sj=newJnt[0],ee=newJnt[2],sol = 'ikSCsolver')
            mc.setAttr('%s.v'%ikhand[0],0)
            # mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_L" "_R";
            mc.mirrorJoint(newJnt[0],mirrorYZ =1,mirrorBehavior =1,searchReplace=('_L','_R'))
            mc.parent(ikhand[0],j)
            mc.parent((re.sub('_L',"_R",ikhand[0])),(re.sub('_L','_R',j)))
            mc.parent(newJnt[0],dupJnt[na-3])
            mc.parent((re.sub("_L","_R",newJnt[0])),(re.sub('_L','_R',dupJnt[na-3])))
            newJnt = []       
            mc.select(clear=1)
        na=na+1; 
开发者ID:auqeyjf,项目名称:pubTool,代码行数:31,代码来源:j_FixBody.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cmds.image函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.iconTextButton函数代码示例发布时间: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