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

Python core.joint函数代码示例

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

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



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

示例1: createJntChain

 def createJntChain(self):
     print 'creating joint chain'
     jntList = []
     crv = pm.ls(self.crv)[0]
     crv = pm.rebuildCurve(crv,rpo=1,rt=0,end=1, kr=0,kcp=0,kep=1,kt=0, s=0,d=3,tol=0)[0]
     numCvs = crv.getShape().numCVs()
     
     #jnt pos is calculated by sampling a closest point on crv in order to same length segments no matter the cv num and position
     pociNode = pm.shadingNode('pointOnCurveInfo',asUtility = 1)
     pociNode.turnOnPercentage.set(1)
     crv.getShape().worldSpace[0] >> pociNode.inputCurve
     tempLoc = pm.spaceLocator()
     pociNode.position >> tempLoc.translate
     segmentLength = 1.0 /( self.numJnt - 1)
     pm.select(cl=1)
     for i in range(self.numJnt):
         pociNode.parameter.set(i*segmentLength)
         jntPos = tempLoc.getTranslation(space='world')
         
         jnt = pm.joint(p=jntPos,name = self.name + '_vfk_jnt_' + (str(i)).zfill(2) )
         jntList.append(jnt)
 
     pm.joint(jntList[0],e=True, oj='xyz',secondaryAxisOrient='yup',ch= True,zso=True)
     jntList[-1].jointOrient.set([0,0,0])
 
     pm.delete([tempLoc,pociNode])
     
     self.jntList = jntList
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:28,代码来源:bdVarFk_Class.py


示例2: create_jnts_on_points

 def create_jnts_on_points(self, points, prefix, chain=True):
     """ Create joints over a series of points
     Args:
         points (tuple): tuple of size 3, 3d position
         prefix (str): joint name prefix
         chain (bool): whether or not to create a joint chain or free floating
     Returns [pm.nt.Joint]: list of joints created
     """
     print 'create_jnts_on_points'
     self.joints = []
     
     for index, point in enumerate(points):
         jnt_name = self.format_string.format(PREFIX = prefix,
                                              INDEX = '%03d' % (index+1),
                                              SUFFIX = 'JNT')
         jnt = pm.joint(p=point, n=jnt_name)
         self.joints.append(jnt)
         
         if len(self.joints) > 1 and chain:
             jnt.setParent(self.joints[index-1])
             pm.select(self.joints[0], r=True)
             pm.joint(e = True, ch = True, oj = 'yxz', secondaryAxisOrient = 'zup', zso = True)
             pm.select(clear = True)
         if not chain:
             jnt.setParent("")
开发者ID:michaelanieves,项目名称:Rigging,代码行数:25,代码来源:jnts_onCrv.py


示例3: wiggleJointChain

def wiggleJointChain(strPnt, endPnt, side='FL', chainPos='Upper'):
    '''
    create joint chain between two points (strPnt & endPnt). require name string of strPnt & endPnt
    '''
    strPos = pm.xform( strPnt, q=True, ws=True, translation=True )
    endPos = pm.xform( endPnt, q=True, ws=True, translation=True )
    
    if side.endswith('L'):
        sideLabel = 1
    elif side.endswith('R'):
        sideLabel = 2
        
    ikSpCrv = pm.curve( degree=2, editPoint=( strPos, endPos) )
    ikSpCrv.rename( 'wiggle_%s_%s_CRV'%(side, chainPos) )
    ikSpCrvShp = ikSpCrv.listRelatives(shapes=True)[0]
    pm.select(clear=True)
    
    jnt2pos = pm.pointOnCurve( ikSpCrv, pr=0.3333, turnOnPercentage=True)
    jnt3pos = pm.pointOnCurve( ikSpCrv, pr=0.6667, turnOnPercentage=True )
    
    jntPos = ( strPos, jnt2pos, jnt3pos, endPos )
    jntList = []
    for pnt in jntPos:
        jName = 'Wiggle_%s_%s_%02d'%(side, chainPos, jntPos.index(pnt)+1)
        newJoint = pm.joint(name=jName, p=pnt)
        newJoint.side.set(sideLabel)
        newJoint.__getattr__('type').set(18)
        newJoint.otherType.set(jName)
        jntList.append(newJoint)
        
    pm.joint( jntList[0], edit=True, orientJoint='xyz', secondaryAxisOrient='xup', children=True, zeroScaleOrient=True )
    
    ikHandle = pm.ikHandle( name='Wiggle_%s_%s_ikHandle'%(side, chainPos),
                            solver='ikSplineSolver', 
                            createCurve=False, 
                            curve=ikSpCrvShp, 
                            startJoint=jntList[0].name(), 
                            endEffector=jntList[-1].name(), 
                            rootOnCurve=False, 
                            createRootAxis=True, 
                            parentCurve=False )
    
    jntGrp = jntList[0].listRelatives(parent=True)[0]
    jntGrp.rename('Wiggle_%s_%s'%(side, chainPos))
    crvInfo = pm.createNode('curveInfo', name='crvInf_wiggle_%s_%s'%(side, chainPos))
    multDiv1 = pm.createNode('multiplyDivide', name='md_wiggle_%s_%s_01'%(side, chainPos))
    multDiv2 = pm.createNode('multiplyDivide', name='md_wiggle_%s_%s_02'%(side, chainPos))
    ikSpCrvShp.worldSpace >> crvInfo.inputCurve
    arcLgt = crvInfo.arcLength.get()
    multDiv1.input2X.set(arcLgt)
    multDiv1.operation.set(2)
    spacing = jntList[1].tx.get()
    multDiv2.input2X.set(spacing)
    multDiv1.outputX >> multDiv2.input1X
    crvInfo.arcLength >> multDiv1.input1X
    
    for jnt in jntList[1:]:
        multDiv2.outputX >> jnt.tx
    
    return ikSpCrvShp, ikSpCrv, ikHandle[0], jntGrp
开发者ID:anang-prabowo,项目名称:work,代码行数:60,代码来源:addFeatures.py


示例4: createIKSpline

def createIKSpline( jntList ):
    pymelLogger.debug('Starting: createIKSpline()...') 
    # Make IK Spline
    ikHandleTorso = pm.ikHandle( startJoint=jntList[0], endEffector=jntList[-1], solver = 'ikSplineSolver', numSpans = 4, name = jntList[-1]+'_'+Names.suffixes['ikhandle'])
    # we should probably rename the object created to know names ......    
    # CAREFULL // inherits Transform OFF, to avoid double transformation when grouped later on
    pm.setAttr(ikHandleTorso[2] + '.inheritsTransform', 0)
    
    # Duplicate last and first joint to use as Drivers of the spine Ik curve
    print jntList
    drvStart = pm.duplicate(jntList[0], parentOnly=True, name = Names.prefixes['driver']+'_'+ jntList[0] +'_'+Names.suffixes['start'])
    drvEnd = pm.duplicate(jntList[-1], parentOnly=True, name = Names.prefixes['driver']+'_'+ jntList[-1] +'_'+Names.suffixes['end'])
    pm.parent(drvEnd, w=1)
    
    # Make radius bigger
    pm.joint(drvStart, edit = True, radius = 1)
    pm.joint(drvEnd, edit = True, radius = 1)
    
    # Skin hip/shldr jnt's to back curve
    pm.skinCluster(drvStart,drvEnd,ikHandleTorso[2],dr=4)
    
    # return nedded elements
    rList = [ikHandleTorso, drvStart, drvEnd ]
    
    pymelLogger.debug('End: createIKSpline()...') 
    return rList
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:26,代码来源:Torso.py


示例5: test_create_heirarchy

    def test_create_heirarchy(self):
        # Test on object with parent
        jnts = []
        jnts.append(pm.joint(p=(1, 1, 1)))
        jnts.append(pm.joint(p=(2, 2, 2)))
        crv = pm.circle()[0]
        pm.delete(pm.parentConstraint(jnts[-1], crv, mo=0))
        pm.parent(crv, jnts[-1])

        grps = control.create_heirarchy('temp', crv, 5)

        count = 0
        for g in grps:
            self.assertTrue(
                transforms.assertLocationsMatch(g, crv))
            self.assertTrue(
                transforms.assertDefaultScale(g))
            if count > 0:
                self.assertTrue(
                    transforms.assertAllZero(g))
                self.assertTrue(
                    transforms.assertParentIs(g, grps[count-1]))
            count += 1

        self.assertEqual(grps[0].name(), 'temp_top_node')
        self.assertEqual(grps[-1].name(), 'temp_btm_node')
        self.assertTrue(transforms.assertParentIs(crv,
                                                  grps[-1]))
        self.assertTrue(transforms.assertParentIs(grps[0],
                                                  jnts[-1]))
        self.assertTrue(transforms.assertAllZero(crv))
        self.assertTrue(transforms.assertDefaultScale(crv))
开发者ID:Mauricio3000,项目名称:fk_ik_sine_rig,代码行数:32,代码来源:test_control.py


示例6: autoPoleVector

def autoPoleVector( baseJnt=None, endJnt=None, side='L' ):

	baseJntPos = pm.xform( baseJnt, q=True, t=True, ws=True )
	endJntPos = pm.xform( endJnt, q=True, t=True, ws=True )

	pm.select(clear=True)
	poleVectorJnt_one = pm.joint( p=baseJntPos )
	poleVectorJnt_two = pm.joint( p=endJntPos )
	poleVectorIKstuff = pm.ikHandle(  sj = poleVectorJnt_one, ee = poleVectorJnt_two, solver = "ikSCsolver"  )

	pv = pm.spaceLocator()
	pv.setParent( poleVectorJnt_two )
	pv.translate.set( 0,0,0 )
	pvZeros = ZeroGrp( pv )

	pm.pointConstraint( poleVectorIKstuff[0], pvZeros[0] )

	if side=='L':
		pv.translateX.set( 1 )
	elif side=='R':
		pv.translateX.set( -1 )


	pvZeros[0].setParent( poleVectorJnt_two )

	return ( pv, poleVectorIKstuff, (poleVectorJnt_one, poleVectorJnt_two) ) 
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:26,代码来源:rigIK.py


示例7: install_subMetaRig_proxy

 def install_subMetaRig_proxy(self):
     logger.debug("Function Called ( %s )"%inspect.stack()[0][3])
     
     #retrieve components   
     prefix = self.prefix.get()
     if self.side.get():
         prefix = "%s_%s"%(self.prefix.get(), self.side.get())
     
     #build components
     proxy_gr = pm.group(empty=True, name='%s_proxy_gr' %prefix)
     proxy_1 = pm.spaceLocator(name='%s_proxy_1' %prefix)
     proxy_2 = pm.spaceLocator(name='%s_proxy_2' %prefix)
     
     joint_1 = pm.joint(name='%s_joint_1' %prefix)
     joint_2 = pm.joint(name='%s_joint_2' %prefix)
     
     pm.parent( proxy_1, proxy_2, joint_1, joint_2, proxy_gr)
     
     #store components
     joint_1.message >> self.joint_1
     joint_2.message >> self.joint_2
     proxy_1.message >> self.proxy_1
     proxy_2.message >> self.proxy_2
     proxy_gr.message >> self.proxy_gr
     
     pass
开发者ID:adamfok,项目名称:afok_toolset,代码行数:26,代码来源:Single_Joint_MetaRig.py


示例8: build_flexi_jnts

    def build_flexi_jnts(self, follicles):
        """ 
        Args:
            None
        Returns (None)
        """
        follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
        jntGRP_name = self.flexiPlaneNameField.getText() + '_flexiPlane_JNT_GRP'
        
        pm.group( em = True, name = jntGRP_name )
        
        for index,follicle in enumerate(follicles):
            jnt_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_jnt%03d' % (index+1),
                                                 SUFFIX = 'JNT')
            jnt_offset_name = jnt_name.replace('_JNT','Offset_GRP')
            tweek_ctrlCon_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_tweak%03d' % (index+1),
                                                 SUFFIX = 'CTRLCon_GRP')

            pm.joint( p = ( follicle.translateX.get(), 0, 0 ), n = jnt_name )
            pm.select(jnt_name, r=True)
            offSetGRP.add_offset_grps()
            
            pm.parent( jnt_offset_name, jntGRP_name )
            pm.select( clear = True )
            
            tweak_ctrl_con = pm.PyNode(tweek_ctrlCon_name)
            joint_offset = pm.PyNode(jnt_offset_name)
            
            pm.parentConstraint( tweek_ctrlCon_name, jnt_offset_name )
            
            pm.setAttr(jnt_name + '.rotateZ', -90)
            pm.makeIdentity( jnt_name, apply=True, translate=True, rotate=True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:34,代码来源:flexi_plane.py


示例9: GuideCrv

def GuideCrv ( startGuider=None , endGuider=None ):

	if startGuider==None or endGuider==None:
		startGuider,endGuider = pm.ls(sl=True)
	
	pm.select(clear=True)
	
	startJnt = pm.joint ( n = startGuider.name()+"_guideCrvJnt")
	pm.parent (startJnt , startGuider)
	startJnt.translate.set (0,0,0)
	startJnt.visibility.set (0)
	pm.setAttr ( startJnt.visibility , lock=True  )
	
	
	endJnt = pm.joint (  n = endGuider.name()+"_guideCrvJnt" )
	pm.parent (endJnt , endGuider)
	endJnt.translate.set (0,0,0)
	endJnt.visibility.set (0)
	pm.setAttr ( endJnt.visibility , lock=True  )
	
	startJntPos = pm.xform ( startJnt , q=True , ws=True , t=True)
	endJntPos = pm.xform ( endJnt , q=True , ws=True , t=True)
	
	guideCrv = pm.curve ( degree=1 , p = (startJntPos ,endJntPos) , k=(1,2)  )
	
	pm.rename ( guideCrv , startGuider.name()+"_guideCrv")
	
	pm.skinCluster ( guideCrv , startJnt , endJnt  )
	
	guideCrv.inheritsTransform.set(0)
	guideCrv.template.set(1)
	
	pm.select(clear=True)
	
	return guideCrv
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:35,代码来源:guideCrv.py


示例10: createBoundJointChain

	def createBoundJointChain(self):
		pm.select(cl = True)
		
		
		#Iterate highResCurveCoordList and append to boundJointsList joint at each position
		self.boundJointsList = []
		
		for index in range(0, len(self.highResCurveCoordList)):
			#create Joint
			
			#decide jointNames
			jointName = self.prefix + '_bound_j_' + str(index + 1)
			if( index == 0 ): jointName = self.prefix + '_bound_j_' + 'base'
			if( index + 1 == len(self.highResCurveCoordList) ): jointName = self.prefix + '_bound_j_' + 'tip'
			
			joint = pm.joint(a = True, p= self.highResCurveCoordList[index] , co = True, n = jointName)
			self.boundJointsList.append(joint)
			
			
		pm.select(cl = True)
		
		
		#Orient boundJoints
		pm.joint(self.boundJointsList[0], e = True, sao = 'yup', oj='xyz', zso = True, ch = True)
		pm.select(cl = True)
		
		
		#Create boundJointsGrp and parent first bound joint
		self.boundJointsGrp = pm.group(n = self.prefix + '_bound_joints_grp')
		pm.select(cl = True)
		pm.parent(self.boundJointsList[0] , self.boundJointsGrp)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:32,代码来源:rbDynamicChainFromCurves.py


示例11: buildChains

    def buildChains(self, *args):
        """
        Build joint chains based on locator positions.
        """
        self.jointChain = []
        self.ikChain = []
        self.fkChain = []

        loc1Pos = pm.xform(self.loc1, q=True, ws=True, t=True)
        loc2Pos = pm.xform(self.loc2, q=True, ws=True, t=True)
        loc3Pos = pm.xform(self.loc3, q=True, ws=True, t=True)

        jnt1='%s_shldrJnt'%self.prefix
        jnt2='%s_elbow1Jnt'%self.prefix
        jnt3='%s_wristJnt'%self.prefix

        self.jointChain.append(pm.PyNode(pm.joint(p=loc1Pos, n=jnt1))) 
        self.jointChain.append(pm.PyNode(pm.joint(p=loc2Pos, n=jnt2)))
        self.jointChain.append(pm.PyNode(pm.joint(p=loc3Pos, n=jnt3)))

        #--- Orient the chain
        self.orientChain()

        #--- Creating duplicate ik/fk joint chains
        for each in pm.duplicate(self.jointChain, rc=True):
            # Slice off number maya adds during duplication
            each.rename('%s_ik' % each[:-1])
            self.ikChain.append(pm.PyNode(each))

        for each in pm.duplicate(self.jointChain, rc=True):
            each.rename('%s_fk' % each[:-1])
            self.fkChain.append(pm.PyNode(each))
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:ms_armRig.py


示例12: fromList

 def fromList(self,posList = [],orientList = [],autoOrient = 1):
     
     for i in range(len(posList)):
         
         tempName = nameUtils.getUniqueName(self.side,self.baseName,self.type)
         if i == len(posList) - 1:
             tempName = nameUtils.getUniqueName(self.side,self.baseName,self.type)
             
         pm.select(cl = 1)
         
         if autoOrient == 1:
             
             tempJnt = pm.joint(n = tempName,position = posList[i])
             
         else :
             tempJnt = pm.joint(n = tempName,position = posList[i],orientation = orientList[i])
         
         self.chain.append(tempJnt)
     self.__parentJoints()
      
     if autoOrient == 1:
         #pm.joint(self.chain[0].name(),e = 1,oj = 'yzx',secondaryAxisOrient = 'zup',ch = 1)
          
         pm.joint(self.chain[0].name(),e = 1,oj = 'xyz',secondaryAxisOrient = 'zdown',ch = 1)
         #xzy -secondaryAxisOrient ydown -ch -zso;
          
     self.__zeroOrientJoint(self.chain[-1])
开发者ID:RyugasakiHu,项目名称:AT_Rigging,代码行数:27,代码来源:boneChain.py


示例13: createCurveBoundJoints

	def createCurveBoundJoints(self):
		
		pm.select(cl = True)
		
		
		#curve_bound_j_base
		pm.select(cl = True)
		self.curve_bound_j_base = pm.joint(a = True, p= (0,0,0),  co = True, n = self.prefix +'_curve_bound_j_base')
		pm.select(cl = True)
		
		#group
		self.curve_bound_j_base_grp = pm.group(self.curve_bound_j_base, n = self.prefix + '_curve_bound_j_base_grp')
		pm.select(cl = True)
		
		#translate
		self.curve_bound_j_base_grp.translate.set(self.leg_locator_tip_worldCoords)
		pm.select(cl = True)
		
		
		
		#curve_bound_j_tip
		pm.select(cl = True)
		self.curve_bound_j_tip = pm.joint(a = True, p= (0,0,0),  co = True, n = self.prefix +'_curve_bound_j_tip')
		pm.select(cl = True)
		
		#group
		self.curve_bound_j_tip_grp = pm.group(self.curve_bound_j_tip, n = self.prefix + '_curve_bound_j_tip_grp')
		pm.select(cl = True)
		
		#translate
		self.curve_bound_j_tip_grp.translate.set(self.foot_locator_worldCoords)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:32,代码来源:rbFootRigB.py


示例14: jointChainOrient

def jointChainOrient( objs=[] ): # wip
    '''
    update : 2015-04-29
    '''
    if objs:
        pm.selec(objs)
    objs = pm.ls(sl=True, o=True)
    if not objs:
        raise

    joints = pm.ls(sl=True, type='joint')
    if not joints:
        raise

    upMeshs = []
    if pm.filterExpand(sm=12):    
        upMeshs = [pm.PyNode(c) for c in pm.filterExpand(sm=12) ] # 업축으로 사용할 메쉬

    # 조인트 오리엔트 조정: 메쉬의 가장 가까운 점의 노말을 조인트의 up으로 설정
    if upMeshs:
        for jnt in joints:
            parentJnt = jnt.getParent()
            if parentJnt:
                # point에서 가장 가까운 Vertex의 Normal을 up으로 설정
                pos   = parentJnt.getTranslation( ws=True)
                vtx   = getClosestVertexOnMesh( upMeshs[0], pos )
                pos   = vtx.getPosition()
                norm  = vtx.getNormal()
                upPos = pos + norm * 1000000 # 노말 위치가 가까우면 방향이 틀어져 버림.. 그래서 큰 수를 곱함.

                upLoc = pm.spaceLocator(n='parentJnt_upLoc#')
                upLoc.t.set( upPos )

                jntOrient( [parentJnt, jnt, upLoc] )
                #pm.joint( parentJnt, edit=True, zso=True, oj='xyz', sao='yup' )
                pm.delete( upLoc )

    else:
        for jnt in joints:
            parentJnt = jnt.getParent()
            if parentJnt and parentJnt.type()=='joint':
                print jnt
                up = pm.spaceLocator()

                grandParent = parentJnt.getParent()
                if grandParent and grandParent.type()=='joint':
                    pm.delete( pm.parentConstraint( grandParent, up ) )                    
                else:
                    pm.delete( pm.parentConstraint( parentJnt, up ) )

                jntOrient( [parentJnt, jnt, up], worldUpType='objectrotation' )
                pm.refresh()
                pm.select(jnt)
                pm.delete(up)

    # 끝 조인트 오리엔트 조정
    if len(joints)>1:    
        pm.joint( joints[-1], edit=True, oj='none' )
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:58,代码来源:joint.py


示例15: splineIK_controls

    def splineIK_controls(self, *args):
        """ Build splineIK Controls
        Args:
            None
        Returns (None)
        """
        jnt_prefix = self.jntNameFeild.getText()
        midJnt = self.model.numCVs / 2
        
        #Create and place joints
        baseJoint = pm.joint( p = self.model.crvCVs[0].getPosition(), n = self.jntNameFeild.getText() + '_base_JNT')
        pm.select(clear = True)
        midJoint = pm.joint( p = self.model.crvCVs[midJnt].getPosition(), n = self.jntNameFeild.getText() + '_mid_JNT')
        pm.select(clear = True)
        endJoint = pm.joint( p = self.model.crvCVs[-1].getPosition(), n = self.jntNameFeild.getText() + '_end_JNT')
        pm.select(clear = True)                                              

        #Create CTRL curves
        pm.circle(c = (0, 0, 0), nr = (0, 1, 0), sw = 360, r = 1, d = 3, ut = False, tol = 3.80125e-10, s = 8, ch = False, n = self.jntNameFeild.getText() + '_base_CTRL')
        pm.select(self.jntNameFeild.getText() + '_base_CTRL', r=True)
        pm.select(self.jntNameFeild.getText() + '_base_JNT', add=True)
        nPos.set_newPosition()
        pm.select(self.jntNameFeild.getText() + '_base_CTRL', r=True)
        offSetGRP.add_offset_grps()
        conGRP.add_con_grps()
        pm.select(clear = True)
        
        pm.circle(c = (0, 0, 0), nr = (0, 1, 0), sw = 360, r = 1, d = 3, ut = False, tol = 3.80125e-10, s = 8, ch = False, n = self.jntNameFeild.getText() + '_mid_CTRL')
        pm.select(self.jntNameFeild.getText() + '_mid_CTRL', r=True)
        pm.select(self.jntNameFeild.getText() + '_mid_JNT', add=True)
        nPos.set_newPosition()
        pm.select(self.jntNameFeild.getText() + '_mid_CTRL', r=True)
        offSetGRP.add_offset_grps()
        conGRP.add_con_grps()
        pm.select(clear = True)
        
        pm.circle(c = (0, 0, 0), nr = (0, 1, 0), sw = 360, r = 1, d = 3, ut = False, tol = 3.80125e-10, s = 8, ch = False, n = self.jntNameFeild.getText() + '_end_CTRL')
        pm.select(self.jntNameFeild.getText() + '_end_CTRL', r=True)
        pm.select(self.jntNameFeild.getText() + '_end_JNT', add=True)
        nPos.set_newPosition()
        pm.select(self.jntNameFeild.getText() + '_end_CTRL', r=True)
        offSetGRP.add_offset_grps()
        conGRP.add_con_grps()
        pm.select(clear = True)
        
        #Skin jnt's to crv
        pm.select(self.jntNameFeild.getText() + '_base_JNT', r=True)
        pm.select(self.jntNameFeild.getText() + '_mid_JNT', add=True) 
        pm.select(self.jntNameFeild.getText() + '_end_JNT', add=True)       
        pm.select(self.jntNameFeild.getText() + '_CRV', add=True) 
        pm.skinCluster(n=self.jntNameFeild.getText() + '_smoothSkin', mi=3, sm=0, nw=2)

        #Constrain joints to ctrl grps
        pm.parentConstraint( self.jntNameFeild.getText() + '_base_CTRLCon_GRP', self.jntNameFeild.getText() + '_base_JNT')
        pm.parentConstraint( self.jntNameFeild.getText() + '_mid_CTRLCon_GRP', self.jntNameFeild.getText() + '_mid_JNT')
        pm.parentConstraint( self.jntNameFeild.getText() + '_end_CTRLCon_GRP', self.jntNameFeild.getText() + '_end_JNT')
        pm.select(clear = True)
开发者ID:michaelanieves,项目名称:Rigging,代码行数:57,代码来源:jnts_onCrv.py


示例16: create_jointChain

def create_jointChain( IdName = 'joint', inputCurve = pm.selected(), orientation = 'xyz' ):
    
    # get number of CVs on InputCurve
    numberOfCvs = pm.getAttr( inputCurve[0] + '.cp',s=1 )
    
    # create joints on world space cv locations
    Jnts = []
    for i in range(0, numberOfCvs):
        pm.select( clear = True )
        currentCvPos = pm.pointPosition( inputCurve[0].cv[i], w=1 )
        Jnt = pm.joint( name = '_'.join( ['bn', IdName, str( i+1 )] ) )
        pm.xform( Jnt, t = currentCvPos )
        Jnts.append( Jnt )
        
    # create end joint
    pm.select( clear = True )
    endJntPos = 0.1 * ( pm.getAttr( Jnts[len(Jnts)-1].translate ) - pm.getAttr( Jnts[len(Jnts)-2].translate ) ) + pm.getAttr( Jnts[len(Jnts)-1].translate )
    endJnt = pm.joint( name = 'be_' + IdName, position = endJntPos, a = True )
    Jnts.append( endJnt )
    
    # set aim and orientation vectors, always yup
    aimDict = {}
    aimDict[orientation[0]] = 1
    aimDict[orientation[1]] = 0
    aimDict[orientation[2]] = 0
    aimVec = ( aimDict['x'], aimDict['y'], aimDict['z'] )

    orientDict = {}
    orientDict[orientation[0]] = 0
    orientDict[orientation[1]] = 0
    orientDict[orientation[2]] = 1
    orientVec = ( orientDict['x'], orientDict['y'], orientDict['z'] )
    
    # orient first joint
    JntAimConstrain = pm.aimConstraint( Jnts[1], Jnts[0], aimVector = aimVec, upVector = (0,1,0), worldUpType = "scene" )
    pm.delete( JntAimConstrain )
    Jnts[0].jointOrient.set( Jnts[0].rotate.get() )
    Jnts[0].rotate.set( 0,0,0 )
    
    # orient middle joints
    for i in range( 1, len( Jnts ) - 1 ):
        JntAimConstrain = pm.aimConstraint( Jnts[i+1], Jnts[i], aimVector = aimVec, upVector = orientVec, worldUpType = "objectrotation", worldUpVector = orientVec, worldUpObject = Jnts[i-1] )
        pm.delete( JntAimConstrain )
        Jnts[i].jointOrient.set( Jnts[i].rotate.get() )
        Jnts[i].rotate.set( 0,0,0 )
    
    # orient last joint
    Jnts[len( Jnts ) -1 ].jointOrient.set( Jnts[len( Jnts ) -2 ].jointOrient.get() )
    
    # parent joints
    for i in range( 1, len( Jnts ) ):
        pm.parent( Jnts[i], Jnts[i-1], absolute = True)

    pm.select( Jnts[0] )
    print('Successfully created and oriented joint-chain. Continuing...')
    return Jnts
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:56,代码来源:jo_varFk.py


示例17: testPreserveSelection

 def testPreserveSelection(self):
     j1 = pmc.joint()
     j2 = pmc.joint()
     @preserve_selection
     def spam():
         pmc.select(j2)
         self.assertEqual(pmc.selected(), [j2])
     pmc.select(j1)
     spam()
     self.assertEqual(pmc.selected(), [j1])
开发者ID:AdricEpic,项目名称:practicalmayapython,代码行数:10,代码来源:mayautils.py


示例18: create_joints

 def create_joints(self, key):
     py.select(cl=True)
     if 'mouth_center' in key:
         self.joint[key] = [py.joint(n='cn_'+key+'_jnt', position=(py.xform('cn_'+key+'_L', q=True, t=True, a=True, ws=True)))]
     elif 'head' in key:
         self.joint[key] = [py.joint(n='cn_'+key+'_jnt', position=(py.xform('cn_'+key+'_L', q=True, t=True, a=True, ws=True)))]
     else:
         self.joint[key] = [py.joint(n='rt_'+key+'_jnt', position=(py.xform('rt_'+key+'_L', q=True, t=True, a=True, ws=True))),
                       py.joint(n='lf_'+key+'_jnt', position=(py.xform('lf_'+key+'_L', q=True, t=True, a=True, ws=True)))]
     py.select(cl=True)
开发者ID:coxevan,项目名称:tech_art_tools,代码行数:10,代码来源:classes.py


示例19: build

    def build(self, *args):
        """
        Builds the joints on the curve.
        """
        # naming convention
        asset = self.asset
        side = self.side
        part = self.part
        joints = self.joints
        security = joints + 1

        if self.gui:
            asset = self.asset_name.text()
            side = self.side.currentText()
            part = self.part_name.text()
            joints = self.joints_box.value()
            print joints
            security = joints + 1
        try:
            self.curve = pm.ls(sl=True)[0]
            curve_name = NameUtils.get_unique_name(asset, side, part, "crv")
            pm.rename(self.curve, curve_name)
        except IndexError:
            pm.warning("Please select a curve")
            return

        length_of_curve = pm.arclen(self.curve)
        equal_spacing = length_of_curve / float(joints)

        # clear the selection
        pm.select(cl=True)

        # # create the joints
        for x in xrange(int(joints) + 1):
            name = NameUtils.get_unique_name(asset, side, part, "jnt", security)
            pm.joint(n=name)

            joint_position = (x * equal_spacing)
            pm.move(0, joint_position, 0)

        root_joint = pm.selected()[0].root()
        end_joint = pm.ls(sl=True)[0]
        solver = 'ikSplineSolver'

        # attach joints to curve
        ik_name = NameUtils.get_unique_name(asset, side, part, "ikHandle")
        self.ikHandle = pm.ikHandle(sj=root_joint, ee=end_joint, sol=solver,
                        c=self.curve, pcv=True, roc=True, ccv=False, n=ik_name)
        joint_chain = pm.ls(root_joint, dag=True)

        # delete history
        pm.makeIdentity(root_joint, apply=True)

        # cleanup
        self.cleanup()
开发者ID:heiths,项目名称:telims_pipe,代码行数:55,代码来源:curve_joint_generator.py


示例20: create

    def create( self ):

        #
        # Create Kinect2 Joints
        #
        aimer = []
        for kjot in self.k2map:
            tag = self.k2map[kjot][0]
            aimid = self.k2map[kjot][2]
            aim = None if aimid is None else self.k2map[aimid][0]
            aimv = (1,0,0)

            t = pm.xform( tag, q=True, ws=True, t=True )
            pm.select( cl=True )
            pm.joint( p=t, n=kjot )

            if not aim is None:
                aimv = (-1,0,0) if pm.getAttr(aim+'.tx') < 0 else aimv
                aimer.append(pm.aimConstraint( aim, kjot, aim=aimv, wut='objectrotation', u=(0,1,0), wu=(0,1,0), wuo=tag ))
        pm.delete( aimer )

        #
        # Make Joints Hierarchy
        #
        for kjot in self.k2map:
            parent = self.k2map[kjot][1]
            aimid = self.k2map[kjot][2]
            if not parent is None:
                pm.parent( kjot, self.k2map[kjot][1] )
                if aimid is None:
                    pm.setAttr( kjot+'.jointOrient', (0,0,0) )

            # Freeze Transformations
            pm.makeIdentity( kjot, a=True, jo=False, t=False, r=True, s=False, n=0, pn=True )

        #
        # Make Constraint
        #
        for kjot in self.k2map:
            tag = self.k2map[kjot][0]
            aimid = self.k2map[kjot][2]
            aim = None if aimid is None else self.k2map[aimid][0]
            aimv = (1,0,0)

            # Aim Constraint
            pm.pointConstraint( tag, kjot )

            # Aim Constraint
            if not aim is None:
                aimv = (-1,0,0) if pm.getAttr(aim+'.tx') < 0 else aimv
                pm.aimConstraint( aim, kjot, aim=aimv, wut='objectrotation', u=(0,1,0), wu=(0,1,0), wuo=tag )

        return
开发者ID:crystalsu2008,项目名称:MayaMiscTools,代码行数:53,代码来源:temp.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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