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

Python cmds.pointConstraint函数代码示例

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

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



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

示例1: setSpring

 def setSpring(self,*args):
     
     self.springName="spring"
 
     #create a set to put all of the spring elements inside
     self.springSetName="spring_SET"
     if mc.objExists(self.springSetName):
         print (self.springSetName + " exists.")
     else:
         mc.sets(name=self.springSetName)
     
     #create guides
     self.set_connector(self.springName)
         
     #create radius circle
     self.radCntrl=mc.circle(name="radius_CTRL",c=(0,0,0), nr=(0,1,0), 
                             sw=360, r=3, d=3, ut=0, tol=0.01, s=8, ch=1)
     #create springRadius attribute
     mc.addAttr(self.radCntrl, sn="sr", ln="springRadius", k=1, defaultValue=3.0, min=0.1, max=15)
     
     #connect the springRadius attribute to the circle
     mc.connectAttr("radius_CTRL.springRadius", "{0}.radius".format(self.radCntrl[1]))
     
     #position radCntrl between locators and aim
     
     mc.pointConstraint(self.baseLoc, self.topLoc,self.radCntrl[0])
     mc.aimConstraint(self.topLoc,self.radCntrl[0],aimVector=(0,1,0))
     
     self.lockHide(self.radCntrl[0])
     
     #create tmp group for easy deletion
     mc.select(self.baseLoc,self.topLoc,self.conCurve,self.radCntrl)
     self.selSpringObjs=mc.ls(sl=True,type="transform")
     
     self.createTmp(self.selSpringObjs)
开发者ID:eyalMDM,项目名称:MDMthesis,代码行数:35,代码来源:tgpMechanix.py


示例2: RMRedistributeConstraint

    def RMRedistributeConstraint(self,ListOfDrivers, ListOfConstrained, MaxInfluences, KeepBorders = True, ConstraintType = "parent"):

        DeltaMaxInfluence =  1/(float (len(ListOfDrivers))-1)
        CentersControlDic = {}
        for i in range (0,len( ListOfDrivers)):
            CentersControlDic[ListOfDrivers[i]] = ( DeltaMaxInfluence*i)

        pprint.pprint (CentersControlDic)
        DeltaPositionConstrained = float(1/(float(len(ListOfConstrained))-1))
        PositionConstDic = {}

        for i in range(0,len( ListOfConstrained)):
            PositionConstDic[ListOfConstrained[i]] = (DeltaPositionConstrained*i)

        pprint.pprint (PositionConstDic)

        reach = MaxInfluences * DeltaMaxInfluence

        for eachConstrained in ListOfConstrained:
            for eachDriver in ListOfDrivers:
                weight = self.RMGaussCosine( PositionConstDic [ eachConstrained ], CentersControlDic [ eachDriver ], reach )
                if weight > 0:
                    if ConstraintType == "parent":
                        cmds.parentConstraint(eachDriver, eachConstrained , weight = weight,mo = True)
                    elif ConstraintType == "point":
                        cmds.pointConstraint(eachDriver, eachConstrained  , weight = weight,mo = True)
                    elif ConstraintType == "orient":
                        cmds.orientConstraint(eachDriver, eachConstrained , weight = weight,mo = True)
                    else:
                        print "not valid costraintType requested, valid types are point, parent, or orient"
开发者ID:rendermotion,项目名称:RMMel,代码行数:30,代码来源:RMSpine.py


示例3: _create_constraints

    def _create_constraints(self, joints, side):
        """Creates the constraints between the hydraulics pieces.
        @param joints: the joints
        @param side: the side
        @type joints: list
        @type side: String

        """
        name = joints[0].split('_start_%s' % self.nc.joint)[0]
        world_up_object = cmds.spaceLocator(n='%s_%s' % (name, self.nc.locator))[0]
        cmds.setAttr('%s.v' % world_up_object, 0)
        self.c.snap_a_to_b(world_up_object, joints[0])
        ac1 = cmds.aimConstraint(joints[0], joints[-1], mo=False, weight=1,
                                 aimVector=(1, 0, 0), upVector=(0, 1, 0),
                                 worldUpType='object', worldUpObject=world_up_object)[0]
        ac2 = cmds.aimConstraint(joints[-1], joints[0], mo=False, weight=1,
                                 aimVector=(1, 0, 0), upVector=(0, 1, 0),
                                 worldUpType='object', worldUpObject=world_up_object)[0]
        cmds.delete(ac1, ac2)
        self._place_world_up_object(world_up_object, joints[0], joints[-1], side)
        ac1 = cmds.aimConstraint(joints[0], joints[-1], mo=False, weight=1,
                                 aimVector=(1, 0, 0), upVector=(0, 1, 0),
                                 worldUpType='object', worldUpObject=world_up_object)[0]
        ac2 = cmds.aimConstraint(joints[-1], joints[0], mo=False, weight=1,
                                 aimVector=(1, 0, 0), upVector=(0, 1, 0),
                                 worldUpType='object', worldUpObject=world_up_object)[0]
        if len(joints) == 3:
            cmds.aimConstraint(joints[-1], joints[1], mo=False, weight=1)
            cmds.pointConstraint(joints[0], joints[-1], joints[1], mo=False, weight=1)
        # END if
        return world_up_object
开发者ID:jonntd,项目名称:Rigganator,代码行数:31,代码来源:hydraulics.py


示例4: primeControl

def primeControl(driver, driven):	
	'''
	# Priming a control
	
	Return driver, grp, driven
	'''
	
	# Group needs to be created
	# Name group after control icon that is going to be created.
	grpNamePieces = driven.split("_")
	if( len(grpNamePieces) > 1 ): 
	    grpNamePieces = grpNamePieces[0:-1]
	grpNamePieces.append("grp")
	grpName = "_".join(grpNamePieces)
	grp = cmds.group( name=grpName, em=True, world=True )
	pc = cmds.pointConstraint( driver, grp )
	oc = cmds.orientConstraint( driver, grp )
	cmds.delete(pc, oc)
	# Option to snap control to position.
	pc = cmds.pointConstraint( driver, driven )
	
	cmds.delete( pc )
	cmds.parent( driven, grp )
	cmds.makeIdentity( apply=True, t=1, r=1, s=1, n=0 )
	
	# Position option to constrain driver to driven
	# Options: Point, Orient, Parent, and None

	return [driver, grp, driven]
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:29,代码来源:rigTools.py


示例5: getParentConstraintDic

 def getParentConstraintDic (self, parentConstraint) :
     returnedDic = {'alias':{}, "object":None }
     aliasDic={}
     if cmds.objectType(parentConstraint)=="parentConstraint":
         WA = cmds.parentConstraint (parentConstraint, q = True, weightAliasList = True)
         TL = cmds.parentConstraint (parentConstraint, q = True, targetList = True)
     
     elif cmds.objectType(parentConstraint)=="orientConstraint":
         WA = cmds.orientConstraint (parentConstraint, q = True, weightAliasList = True)
         TL = cmds.orientConstraint (parentConstraint, q = True, targetList = True)
     
     elif cmds.objectType(parentConstraint)=="pointConstraint":
         WA = cmds.pointConstraint (parentConstraint, q = True, weightAliasList = True)
         TL = cmds.pointConstraint (parentConstraint, q = True, targetList = True)
     
     else:
         "error No constraint Type identified"
     
     if len(WA) == len(TL):
         for eachWAIndex in range(0,len(WA)):
             aliasDic[WA[eachWAIndex]] = TL[eachWAIndex]
     
     returnedDic["object"] = cmds.listConnections(parentConstraint + ".constraintRotateX")[0]
     returnedDic["alias"] = aliasDic
     return returnedDic
开发者ID:rendermotion,项目名称:RMMel,代码行数:25,代码来源:RMSpaceSwitch.py


示例6: joint

def joint(side, lowerJoint, upperJoint, useSphere=0, sharedUpper=0, sharedLower=0, show=1, heightScale=1):
    name = lowerJoint + "_" + upperJoint

    upperName = "SKEL_"
    if sharedUpper == 0:
        upperName += side + "_"
    upperName += upperJoint

    lowerName = "SKEL_"
    if sharedLower == 0:
        lowerName += side + "_"
    lowerName += lowerJoint

    print name
    cmds.spaceLocator(name="%s_%s" % (side, name))
    cmds.pointConstraint(lowerName, "%s_%s" % (side, name))
    cmds.pointConstraint(upperName, "%s_%s" % (side, name))
    cmds.aimConstraint(upperName, "%s_%s" % (side, name))
    if useSphere:
        cmds.sphere(name="%s_%s_C" % (side, name), radius=1)
    else:
        cmds.cylinder(name="%s_%s_C" % (side, name), radius=0.5, heightRatio=6 * heightScale)

    cmds.setAttr("%s_%s_C.doubleSided" % (side, name), 0)
    if show == 0:
        cmds.setAttr("%s_%s_C.primaryVisibility" % (side, name), 0)

        # cmds.rotate( 0, 0, 90, '%s_FOREARM_C' % (side) )
        # cmds.makeIdentity( '%s_FOREARM_C' % (side), apply = 1, rotate = 1 )
    cmds.select("%s_%s" % (side, name), "%s_%s_C" % (side, name))
    cmds.parentConstraint()
    return
开发者ID:torbensko,项目名称:Kinect-to-Maya-motion-capture,代码行数:32,代码来源:mayaKinectAutoRig.py


示例7: displayConnect_arrow

def displayConnect_arrow( _obj ):
	# 타겟 오브젝트
    _pointA = _obj[0]
    _pointB = _obj[1]

	# 라인생성
    _createNode = cmds.createNode('annotationShape')
    _listRelatives = cmds.listRelatives( _createNode, parent=True )
    _annotation = [_listRelatives[0], _createNode]
    print _annotation

    _loc = cmds.spaceLocator()
    _listRelatives = cmds.listRelatives( _loc[0], s=True )
    _locator = [ _loc[0], _listRelatives[0] ]

    cmds.connectAttr( _locator[1]+'.worldMatrix[0]', _annotation[1]+'.dagObjectMatrix[0]')

	# pointCurveConstraint로 생성된 로케이터를 타겟 오브젝트에 붙임
    cmds.pointConstraint( _pointA, _annotation[0])
    cmds.pointConstraint( _pointB, _locator[0])

	# 로케이터 가림
    cmds.setAttr (_locator[1]+'.visibility', 0)

	# return
    return [_annotation[0], _locator[0]]
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:26,代码来源:Gun_Tools.py


示例8: _create_wrist

    def _create_wrist(self):
        """Creates the special wrist setup for the 3 different rotation axes of
        Dave's wrist.
        @todo: change the constraining to the PLY GRP to something save

        """

        hand = '%s_hand_result_%s' % (self.side, self.nc.joint)
        hand_end = '%s_handEnd_result_%s' % (self.side, self.nc.joint)
        fore_arm = '%s_foreArm_result_%s' % (self.side, self.nc.joint)

        # joints
        cmds.select(cl=True)
        root_jnt = cmds.joint(n='%s_wristRoot_%s' % (self.side, self.nc.joint))
        end_jnt = cmds.joint(n='%s_wristEnd_%s' % (self.side, self.nc.joint))
        tmp_end_jnt = cmds.joint(n='%s_wristTmpEnd_%s' % (self.side, self.nc.joint))
        self.c.snap_a_to_b(root_jnt, hand)
        self.c.snap_a_to_b(end_jnt, hand_end)
        self.c.snap_a_to_b(tmp_end_jnt, hand_end)

        # orient joints properly
        self.orient_joint(root_jnt)
        cmds.delete(tmp_end_jnt)
        cmds.parent(end_jnt, w=True)

        # constrain joints
        cmds.parentConstraint(hand, root_jnt, mo=True)
        cmds.pointConstraint(root_jnt, end_jnt, mo=True)
        cmds.orientConstraint(root_jnt, end_jnt, mo=True)

        # constrain hand const group
        cmds.parentConstraint('%s_wristRotZ_PLY_%s' % (self.side, self.nc.group),
                              '%s_hand_const_%s' % (self.side, self.nc.group), mo=True)

        cmds.parent(root_jnt, end_jnt, '%s_hand_%s' % (self.side, self.nc.group))
开发者ID:jonntd,项目名称:Rigganator,代码行数:35,代码来源:robothand.py


示例9: 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


示例10: nullMeasurementRig

 def nullMeasurementRig(self,name):
 
     #finds starting position and orientation
     startPos = MeasuringTool.getPointLocation(self.objectStart)
     startOrient = cmds.xform(self.objectStart,q = True, ws = True, rotation = True)
     
     #create parent group
     parentGroup = cmds.group(empty = True, name = '%s_Stretch_Group'%name)
      
     #create main null
     mainNull = cmds.group(empty = True, parent  = parentGroup,name = '%s_Main_Null'%name)
     
     #creates starting null
     startNull = cmds.group(empty = True,parent = parentGroup, name = '%s_Start_Null'%(name))
     
     #creates end null
     endNull = cmds.group(empty = True, parent = startNull, name = '%s_End_Null'%(name))
     
     cmds.move(startPos[0], startPos[1], startPos[2],parentGroup)
     cmds.rotate(startOrient[0],startOrient[1],startOrient[2],parentGroup)
     
     #finds end location
     pointDistance = self.getPointDistanceBetween()
     length = MeasuringTool.getVectorLength(pointDistance)   
     cmds.move(length,0,0,endNull, a = True, os = True)
     cmds.move(length,0,0,mainNull, a = True, os = True)
     
     #create constraints
     cmds.aimConstraint(mainNull,startNull,aim = (1,0,0))
     cmds.pointConstraint(mainNull,endNull)
     
     return [startNull,endNull,mainNull,parentGroup]
开发者ID:Owacle,项目名称:maya-toolbelt,代码行数:32,代码来源:MeasuringLib.py


示例11: aimRig

    def aimRig(self,name):
    
        #query start location and orient
        startPosition = MeasuringTool.getPointLocation(self.objectStart)
        startOrient = MeasuringTool.getWorldEulerRotation(self.objectStart)
        
        
        #create locators
        aimLoc = cmds.spaceLocator(n = '%s_Aim_AimVector_Loc'%(name))
        upLoc = cmds.spaceLocator(n = '%s_Aim_UpVector_Loc'%(name))
        tgt = cmds.spaceLocator(n = '%s_Aim_Target_Loc'%(name))

        #create hierarchy
        posNull = cmds.group(aimLoc[0],upLoc[0],tgt[0],n = '%s_Aim_Pos_Null'%(name))

        cmds.move(startPosition[0],startPosition[1],startPosition[2],posNull)
        cmds.rotate(startOrient[0],startOrient[1],startOrient[2],posNull)
        
        #find vector length
        distance = self.getPointDistanceBetween()
        length = MeasuringTool.getVectorLength([distance[0],distance[1],distance[2]])
    
        #move and apply constraints to target
        cmds.move(length,0,0,tgt, a = True, os = True)
        cmds.move(0,0,10,upLoc[0],os = True)
        cmds.parentConstraint(self.objectStart,posNull)
        cmds.pointConstraint(self.objectEnd,tgt[0])
        cmds.aimConstraint(tgt,aimLoc, aimVector = (1,0,0), upVector = (0,0,1), worldUpType = "object", worldUpObject = upLoc[0])
开发者ID:Owacle,项目名称:maya-toolbelt,代码行数:28,代码来源:MeasuringLib.py


示例12: create_controls

    def create_controls(self):
        """Create controls"""

        # Make duplicate joint chain
        self._duplicate_joints()

        # Create ikHandle
        self.create_ik()
        
        # Create control
        ik_ctl = Control(self.position, self.description, 0)
        ik_ctl.create()

        # Style and lock attrs
        ik_ctl.set_style("cube")
        ik_ctl.lock_scales()

        # Append control
        self.controls[ik_ctl.name] = ik_ctl
        self.ik_ctl = ik_ctl

        # Create base null
        self.base_null = cmds.createNode("transform", name=name.set_suffix(ik_ctl.name, "baseNull"))
        xform.match_translates(self.base_null, self.ik_joints[0])
        cmds.pointConstraint(self.base_null, self.ik_joints[0], mo=True)
        self.setups.append(self.base_null)


        return self.controls
开发者ID:eddiehoyle,项目名称:link,代码行数:29,代码来源:ik.py


示例13: connect_ikfk

    def connect_ikfk(self):
        for fk_key, fk_ctl in self.fk.controls.items():

            con = fk_ctl.constraint
            rev = cmds.createNode("reverse")
            cmds.connectAttr("%s.fkik" % self.settings_node, "%s.inputX" % rev)

            aliases = cmds.parentConstraint(con, wal=True, q=True)
            
            cmds.connectAttr("%s.fkik" % self.settings_node, "%s.%s" % (con, aliases[0]))
            cmds.connectAttr("%s.outputX" % rev, "%s.%s" % (con, aliases[1]))

            # Control visibility
            cmds.setAttr("%s.visibility" % fk_ctl.ctl, l=False)
            cmds.connectAttr("%s.outputX" % rev, "%s.visibility" % fk_ctl.ctl)

        for ik_key, ik_ctl in self.ik.controls.items():
            cmds.setAttr("%s.visibility" % ik_ctl.ctl, l=False)
            cmds.connectAttr("%s.fkik" % self.settings_node, "%s.visibility" % ik_ctl.ctl)

        cmds.connectAttr("%s.fkik" % self.settings_node, "%s.visibility" % self.ik.anno)


        # Connect base Fk control
        cmds.pointConstraint(self.ik.base_null, self.fk.fk_joints[0], mo=True)
        cmds.connectAttr("%s.fkik" % self.settings_node, "%s.ikBlend" % self.ik.ik)
开发者ID:eddiehoyle,项目名称:link,代码行数:26,代码来源:ikfk.py


示例14: makeSpring

    def makeSpring(self,*args):
        
        
        self.springRadius=mc.getAttr("{0}.springRadius".format(self.radCntrl[0]))
        
        #get diameter (width)
        self.upWidth=self.springRadius*2
        
        #create base spring mesh using polyHelix
        self.springBase=mc.polyHelix(c=20,h=4,w=self.upWidth, r=0.2,sa=24,sco=24,
                                     sc=0,ax=(0,1,0),rcp=0,cuv=3,ch=1,
                                     name="springGeo")
        
        mc.pointConstraint(self.baseLoc,self.topLoc,self.springBase[0])
        mc.aimConstraint(self.topLoc,self.springBase[0],aimVector=(0,1,0))
        
        #connect height attribute of helix to distance node
        mc.connectAttr("{0}.distance".format(self.dNode),"{0}.height".format(self.springBase[1]),  force=True)
        
        mc.delete(self.radCntrl)
       
        mc.select(self.baseLoc,self.topLoc,self.conCurve,self.springBase)
        #select all spring parts        
        self.selection=mc.ls(sl=True)

        #loop through the parts and rename them accordingly    
        for x in self.selection:
            mc.rename(x,(x+"_#"))
    
        #create a group for the springs
        self.springGrp=mc.group(name="spring_GRP_#")
        #delete tmp group
        mc.delete(self.tmpGrp)
        #add GRP elements to set
        mc.sets(self.springGrp, add=self.springSetName)
开发者ID:eyalMDM,项目名称:MDMthesis,代码行数:35,代码来源:tgpMechanix.py


示例15: rigArm

    def rigArm(self, *args):
        basicFilter = "*.json"
        fileName = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, fm=1, okc='Load')

        # Read the Json file
        # Call on the json_utils readJson method.
        data = json_utils.readJson(fileName)
        info = json.loads( data )

        self.Rig_Info['fkJoints'] = rig_utils.createJointChain(info, 'fkj')
        self.Rig_Info['ikJoints'] = rig_utils.createJointChain(info, 'ikj')
        self.Rig_Info['rigJoints'] = rig_utils.createJointChain(info, 'rigj')

        # Setup the ik rig
        ctrlFile = 'C:/Users/Griffy/Documents/GitHub/Python101/rigging/controls/HandControl.ma'
        rig_utils.importControlObject(ctrlFile)
        self.Rig_Info['ikInfo'] = rig_utils.createIk(self.Rig_Info['ikJoints'])

        # Align the control to the last ik joint
        tmpConstraint = cmds.parentConstraint(self.Rig_Info['ikJoints'][2], 'grp_control', mo=False)
        cmds.delete(tmpConstraint)
        # Rename the control
        cmds.rename('grp_control', 'grp_ikArmCtrl')
        cmds.rename('control', 'ikArmCtrl')
        # Constrain the ikHandle to the control
        cmds.pointConstraint('ikArmCtrl', self.Rig_Info['ikInfo'][0])

        # Make the fk controls

        # Connect the fk, ik, and rig ikJoints
        for i in range(len(self.Rig_Info['rigJoints'])):
        	switchPCon = cmds.parentConstraint(self.Rig_Info['ikJoints'][i], self.Rig_Info['rigJoints'][i], mo=True)
        	cmds.parentConstraint(self.Rig_Info['fkJoints'][i], self.Rig_Info['rigJoints'][i], mo=True)
        	print switchPCon
开发者ID:RiggingDojo,项目名称:Python101_2014,代码行数:34,代码来源:rig_arm.py


示例16: Neck_Control

	def Neck_Control(*args, **kwargs):
		NeckJt = "Neck_Jt"
		NeckCtrl = [mc.curve(name="Neck_Ctrl",degree=3,point=[(-0.801407, 0, 0.00716748),(-0.802768, 0.023587, -0.220859), (-0.805489, 0.0707609, -0.676912),
						   (0.761595, -0.283043, -0.667253), (1.045492, -0.194522, -0.0218101), (1.046678, -0.194804, 0.0403576),(0.758039, -0.282198, 0.63974),
						   (-0.806291, 0.0676615, 0.650803),(-0.803035, 0.0225538, 0.221713),(-0.801407, 0, 0.00716748)]),
						   mc.setAttr("Neck_Ctrl.overrideColor",18),mc.setAttr("Neck_Ctrl.overrideEnabled",1)]
		mc.scale(2.1,3.16,2.8)
		mc.makeIdentity( 'Neck_Ctrl', apply=True, translate=True,scale=True)
		lockScaling = mc.setAttr("Neck_Ctrl.scale",lock=True)
		
		# xform translation
		valNeck = mc.xform(NeckJt,ws=True,query=True,translation=True)
		mc.xform(NeckCtrl,ws=1,t = (valNeck[0],valNeck[1],valNeck[2]))
		
		mc.orientConstraint("Neck_Ctrl", NeckJt)
		mc.pointConstraint("Neck_Ctrl", NeckJt)
		grpNeck = mc.group("Neck_Ctrl", name="GRP_Neck")
		
		mc.parent("GRP_Neck","Front_Spine_Ctrl")
		
		#Lock translation for curve
		lockTranslation = mc.setAttr("Neck_Ctrl.translate",lock=True)
		

		return NeckCtrl,NeckJt
开发者ID:PaulElmo,项目名称:Quad_Rig_Tool,代码行数:25,代码来源:Q_RigWindow.py


示例17: crvTendon

def crvTendon(curve,geo,precision=4,prefix='tendon'):
	'''
	'''
	# rebuildCurve degree 1
	baseCurve = mc.rebuildCurve(curve,ch=0,s=1,d=1,rpo=1,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
	
	# create cv locators
	baseLocs = glTools.utils.curve.locatorCurve(baseCurve,prefix=prefix+'_baseCrv')
	
	# generate geo constraint curve
	geoCurve = mc.rebuildCurve(baseCurve,ch=1,s=precsion,d=1,rpo=0,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
	geoCurveLocs = glTools.utils.curve.locatorCurve(geoCurve,prefix=prefix+'_geoCrv')
	
	# generate reference curve
	refCurve = mc.rebuildCurve(baseCurve,ch=1,s=precsion,d=1,rpo=0,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
	refCurveInfo = mc.createNode('curveInfo',n=prefix+'_ref_curveInfo')
	mc.connectAttr(refCurve+'.worldSpace[0]',refCurveInfo+'.inputCurve',f=True)
	refCurveLocs = []
	for i in range(precsion+1):
		refNull = mc.group(em=True,n=prefix+'_ref'+str(i)+'_null')
		mc.connectAttr(refCurveInfo+'.controlPoints['+str(i)+']',refNull+'.t')
		refCurveLocs.append(refNull)
	
	# Locator Constraints
	for i in range(precsion+1):
		mc.pointConstraint(refCurveLocs[i],geoCurveLocs[i])
		mc.geometryConstraint(geo,geoCurveLocs[i])
		
	# fitBspline
	bSpline = mc.fitBspline(geoCurve,ch=1)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:30,代码来源:tendon.py


示例18: Jaw_Control

	def Jaw_Control(*args,**kwargs):
	    prefix = "_"
	    JawJt = "Lower_Jaw_Jt"
	    JawCtrl = [mc.curve(name="Jaw"+prefix+"Ctrl",d=1,
            p=[(-0.484806, -0.465148, -0.560784 ),(-0.484806, -0.465148, 0.595512),
            (-0.275612, 0.538987, 0.636341),(1.356108, 0.120597, 0.636341 ),
            (2.161106, 0.0592024, 0.01008 ),(1.356108, 0.120597, -0.610974),
            (-0.275612, 0.538987, -0.610974),(-0.484806, -0.465148, -0.560784),
            (1.146913, -0.67078, -0.560784 ),(1.951911, -0.670601, 0.01008),
            (1.146913, -0.67078, 0.595512),(1.356108, 0.120597, 0.636341),
            (2.161106, 0.0592024, 0.01008),(1.356108, 0.120597, -0.610974),
            (1.146913, -0.67078, -0.560784),(1.146913, -0.67078, 0.595512),
            (-0.484806, -0.465148, 0.595512),(1.146913, -0.67078, 0.595512),
            (1.951911, -0.670601, 0.01008),(2.161106, 0.0592024, 0.01008)]),
            mc.setAttr("Jaw"+prefix+"Ctrl.overrideColor",18), 
	        mc.setAttr("Jaw"+prefix+"Ctrl.overrideEnabled",1),mc.scale(0.5,1,1.15)]
	    
	    #xform translation
	    valPos = mc.xform(JawJt,query=True,ws=True,translation=True)     
	    mc.xform(JawCtrl[0],ws=1,t=(valPos[0],valPos[1],valPos[2]))
	    #xform rotation
	    valRot = mc.xform(JawJt,query=True,ws=True,rotation=True)
	    mc.xform(JawCtrl[0],ws=1,ro=(valRot[0],valRot[1],valRot[2]))
	    mc.setAttr("Jaw"+prefix+"Ctrl.rotateZ",-22)
	    mc.makeIdentity(JawCtrl[0],a=True,r=True,t=True,s=True)
	    mc.orientConstraint(JawCtrl[0], JawJt, mo=True)
	    mc.pointConstraint(JawCtrl[0], JawJt, mo=True)
	    mc.parent(JawCtrl[0],"Head_Ctrl")
	    
	    #Lock attributes for Jaw rig
	    for lock in JawJt:
	        mc.setAttr("Jaw"+prefix+"Ctrl.scale",lock=True),
	        mc.setAttr("Jaw"+prefix+"Ctrl.translate",lock=True)
开发者ID:PaulElmo,项目名称:Quad_Rig_Tool,代码行数:33,代码来源:Q_RigWindow.py


示例19: __init__

    def __init__(self, joints, parentGroup, groupToConstraint):
        # joints[0] = snapTo joint
        # joints[1] = local parent
        # parentGroup = where to parent spaceSwitch groups
        # what group will be driven

        rootGroup = makeGroup.MakeGroup(name=joints[0] + "_spaceSwitch_GRP")

        worldGroup = makeGroup.MakeGroup(name=joints[0] + "_world", snapTo=joints[0])
        localGroup = makeGroup.MakeGroup(name=joints[0] + "_local", snapTo=joints[0])

        mc.parent(worldGroup.groupName, rootGroup.groupName)
        mc.parent(localGroup.groupName, rootGroup.groupName)
        mc.parent(rootGroup.groupName, parentGroup)

        # constraint setup for groups
        mc.parentConstraint(joints[1], localGroup.groupName, maintainOffset=True)
        mc.pointConstraint(localGroup.groupName, worldGroup.groupName)
        mc.orientConstraint(nameLib.prefixNames.globalControl + nameLib.prefixNames.controlSuffix, worldGroup.groupName, maintainOffset=True)

        # sonctraint for groupToConstraint
        for i in [worldGroup.groupName, localGroup.groupName]:
            swConstraint = mc.parentConstraint(i, groupToConstraint)[0]

        driver = joints[0] + ".parent"

        reverseNode = mc.shadingNode("reverse", name = joints[0] + "_swReverse", asUtility=True)

        # connect channels
        mc.connectAttr(driver, reverseNode + ".input.inputX")

        mc.connectAttr(driver, swConstraint + "." + joints[0] + "_worldW0")
        mc.connectAttr(reverseNode + ".output.outputX", swConstraint + "." + joints[0] + "_localW1")
开发者ID:robertvari,项目名称:rvRigTools,代码行数:33,代码来源:spaceSwitch.py


示例20: fkFingerSetup

 def fkFingerSetup(self):
     """
     #- fk finger setup
     """
     
     cmds.select(cl = True)
     for fingerElement in self.allfingers:
         for lr in self.lrPrefix:
             for elem in fingerElement[0:-1]:
                 if lr == self.left:
                         ctlColor = 6
                 else:
                         ctlColor = 12
                 ctl = controller.circleController('%s%s_ctl' %(lr, elem), 'yz', 0.5, ctlColor, ['tr', 'sc', 'vi'], doublePadding = True)
                 cmds.select('%s%s_jnt' %(lr, elem), r = True)
                 cmds.select('%s_grp' %ctl, tgl = True)
                 cmds.pointConstraint(mo = False, weight = 1)
                 cmds.orientConstraint(mo = False, weight = 1)
                 cmds.delete('%s_grp_pointConstraint1' %ctl)
                 cmds.delete('%s_grp_orientConstraint1' %ctl)            
         
                 #- constrain joints
                 cmds.select(ctl, r = True)
                 cmds.select('%s%s_jnt' %(lr, elem), tgl = True)
                 cmds.orientConstraint(mo = False, weight = 1)
             
             fingerElementTmp = fingerElement[:-1]
             fingerElementTmp.reverse()
             for i in range(len(fingerElementTmp)-1):
                 self.util.parent('%s%s_ctl_grp' %(lr, fingerElementTmp[i]), '%s%s_ctl' %(lr, fingerElementTmp[i+1]))
开发者ID:darkuress,项目名称:arNew,代码行数:30,代码来源:handSetup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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