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


Python cmds.scaleConstraint函数代码示例

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


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

示例1: setCST

 def setCST(self, constrainttype = 'parent', source = '', weight = 1, mo = True, remove = False, skip = "none"):
     """This can be used instead of the constraint class to constrain the current superObject to something quickly.
     @param type: the type of constraint,valid options are point, parent, aim, scale, orient.
     @param source: what you want to constrain to. single source only
     @param weight: the weight of the constraint
     @param mo: maintain offset
     @param remove: remove from constraint
     @type type: string
     @type target: string
     @type weight: int
     @type mo: boolean
     @type remove: boolean
     """
     self.cstName = self.name + constrainttype + '_Constraint'
     self.cstType = constrainttype
     self.source = source
     cstTypes = ['point', 'orient', 'aim', 'parent', 'scale']
     if self.cstType not in cstTypes:
         print 'Invalid constraint type called for superObject %s, try again' % self.name
     elif self.cstType == 'point':
         cmds.pointConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName, skip = skip)
     elif self.cstType == 'parent':
         cmds.parentConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
     elif self.cstType == 'aim':
         cmds.aimConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
     elif self.cstType == 'scale':
         cmds.scaleConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
     elif self.cstType == 'orient':
         cmds.orientConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:29,代码来源:sceneObject.py

示例2: attachGeoToBlueprint_parenting

	def attachGeoToBlueprint_parenting(self,blueprintJoint,geometry):
		jointName = utils.stripAllNamespaces(blueprintJoint)[1]
		parentGroup = cmds.group(empty=True,n=jointName + '_geoAttach_parentGrp#')
		
		if len(geometry) == 1:
			geoParent = cmds.listRelatives(geometry,parent=True)
			if geoParent != None:
				cmds.parent(parentGroup, geoParent)
				
		cmds.parentConstraint(blueprintJoint,parentGroup, maintainOffset=False,n=parentGroup+'_parentConstraint')
		cmds.scaleConstraint(blueprintJoint,parentGroup, maintainOffset=False,n=parentGroup+'_scaleConstraint')
		
		geoParent = parentGroup
		
		children = cmds.listRelatives(blueprintJoint, children=True)
		children = cmds.ls(children,type='joint')
		
		if len(children) != 0:
			childJoint = children[0]
			
			scaleGroup = cmds.group(empty=True, n=jointName+'_geoAttach_scaleGrp#')
			cmds.parent(scaleGroup,parentGroup,relative=True)
			
			geoParent = scaleGroup
			
			originalTxValue = cmds.getAttr(childJoint + '.translateX')
			scaleFactor = cmds.shadingNode('multiplyDivide', asUtility=True, n=scaleGroup+'_scaleFactor')
			cmds.setAttr(scaleFactor+'.operation',2)#divide
			cmds.connectAttr(childJoint+'.translateX',scaleFactor+'.input1X')
			cmds.setAttr(scaleFactor+'.input2X', originalTxValue)
			
			cmds.connectAttr(scaleFactor+'.outputX',scaleGroup+'.scaleX')
			
		for geo in geometry:
			cmds.parent(geo,geoParent,absolute=True)
开发者ID:pouyaz123,项目名称:Python-character-pipeline,代码行数:35,代码来源:attachGeoToBlueprint.py

示例3: rigFace

def rigFace() : 
    jntGrp = 'facialJnt_grp'

    if not mc.objExists(jntGrp) : 
        mc.group(em = True, n = jntGrp)

    facePolyMap = {'L_brow_ply': 'L_brow_ctrl',
                     'L_baseEye_ply': 'L_baseEye_ctrl', 
                     'L_eye_ply': 'L_eye_ctrl',
                     'R_brow_ply': 'R_brow_ctrl', 
                     'R_baseEye_ply': 'R_baseEye_ctrl', 
                     'R_eye_ply': 'R_eye_ctrl', 
                     'nose_ply': 'noseface_ctrl', 
                     'mouth_ply': 'mount_ctrl'
                     }

    for each in facePolyMap : 
        poly = each
        ctrl = facePolyMap[poly]

        if mc.objExists(poly) : 

            movePivot(ctrl, poly)

            joint = mc.createNode('joint', n = poly.replace('_ply', '_jnt'))
            mc.delete(mc.pointConstraint(poly, joint))
            mc.skinCluster(poly, joint, tsb = True)
            mc.parentConstraint(ctrl, joint)
            mc.scaleConstraint(ctrl, joint)

            mc.parent(joint, jntGrp)
开发者ID:myCodeTD,项目名称:rigTools,代码行数:31,代码来源:gen2DRig+(tanimator's+conflicted+copy+2014-11-28).py

示例4: claw

def claw(ref):
    # duplicate geo
    selection = cmds.ls(sl=True)
    for locator in selection:
        split = locator.split("section_")
        name = "%sclaw_%s" % (split[0], split[1].replace("locator", "C"))
        bind = "bind_%s" % name

        old_name = "old_%s" % name
        old_bind = "old_%s" % bind

        cmds.rename(name, old_name)
        cmds.rename(bind, old_bind)

        cmds.duplicate(ref, rr=True, un=True, name=bind)
        cmds.duplicate(bind, name=name)

        shape = cmds.listRelatives(bind, s=True)[0]
        claw_bs = cmds.listConnections(shape, type="blendShape", s=True)[0]
        cmds.connectAttr(locator + ".parameter", claw_bs + ".tentacle_claw")

        cmds.scaleConstraint(locator, bind, maintainOffset=False)
        cmds.parentConstraint(locator, bind, maintainOffset=False)

        bs = cmds.blendShape(bind, name, origin="world")
        cmds.setAttr(bs[0] + ".w[0]", 1)

        cmds.parent(name, cmds.listRelatives(old_name, p=True)[0])
        cmds.parent(bind, cmds.listRelatives(old_bind, p=True)[0])

        cmds.delete(old_name, old_bind)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:31,代码来源:venom_claw_replace.py

示例5: friendsBeachRig

def friendsBeachRig() :
	
	for each in mc.ls( sl=True ) :
    
		currName = each.split( '_' )[0]
		
		ctrl = pc.Control( 'circle' )
		ctrl.name = '%s_ctrl' % currName
		ctrl.color = 'red'
		ctrl.attr( 'v' ).lock = True
		ctrl.attr( 'v' ).hide = True
		ctrl.scaleShape( 7 )
		grp = pc.group( ctrl )
		grp.snap( each )
		grp.name = '%sCtrlZro_grp' % currName
		
		geoZro = mc.listRelatives( each , p=True )[0]
		geoGrp = mc.listRelatives( geoZro , p=True )[0]
		rigGrp = geoGrp.replace( 'Geo_' , 'Rig_' )
		
		if not mc.objExists( rigGrp ) :
			mc.group( em=True , n=rigGrp )
		
		mc.parentConstraint( ctrl , geoZro , mo=True)
		mc.scaleConstraint( ctrl , geoZro , mo=True )
		mc.parent( grp , rigGrp )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:26,代码来源:pkTools.py

示例6: createControl

def createControl( si, shape = 'circleX', childsAlso = True, par = None, lastAlso = False, constraint = True, connect = False, offsetGroup = True ):
	if not lastAlso and not si.children:
		return
	if shape == 'joint':
		mc.select( cl = True )
		curv = mn.Node( mc.joint( n = si.name + "_jnt" ) )
	elif shape == 'locator':
		curv = mn.Node( mc.spaceLocator( n = si.name + '_loc' )[0] )
	else:
		curv = crv.Curve( si.name + "_ctl" )
		curv = curv.create( shape )
	if offsetGroup:
		grp = mn.createNode( "transform", ss = True )
		grp.name = si.name + "_grp"
		trf.snap( si, grp )
		curv.parent = grp
		curv.a.t.v  = [0]*3
		curv.a.r.v  = [0]*3
		if par:
			grp.parent = par
	else:
		trf.snap( si, curv )
		curv.freeze()
	if constraint:
		mc.parentConstraint( curv, si, mo = True )
		mc.scaleConstraint( curv, si, mo = True )
	if connect:
		curv.a.t >> si.a.t
		curv.a.r >> si.a.r
		curv.a.s >> si.a.s
	if childsAlso and si.children:
		for c in si.children:
			c = mn.Node( c.name.split( '|' )[-1] )
			createControl( c, shape, True, curv, lastAlso, constraint, connect, offsetGroup )
开发者ID:skarone,项目名称:PipeL,代码行数:34,代码来源:createControls.py

示例7: createGuide

 def createGuide(self, *args):
     Base.StartClass.createGuide(self)
     # Custom GUIDE:
     cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".flip", 0)
     
     cmds.addAttr(self.moduleGrp, longName="indirectSkin", attributeType='bool')
     cmds.setAttr(self.moduleGrp+".indirectSkin", 0)
     
     cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
     
     self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
     self.connectShapeSize(shapeSizeCH)
     self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
     cmds.setAttr(self.jGuide1+".template", 1)
     cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
     
     self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.1)
     self.connectShapeSize(shapeSizeCH)
     cmds.parent(self.cvEndJoint, self.cvJointLoc)
     cmds.setAttr(self.cvEndJoint+".tz", 1.3)
     self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
     cmds.setAttr(self.jGuideEnd+".template", 1)
     cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
     ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
     
     cmds.parent(self.cvJointLoc, self.moduleGrp)
     cmds.parent(self.jGuideEnd, self.jGuide1)
     cmds.parentConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ParentConstraint")
     cmds.parentConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ParentConstraint")
     cmds.scaleConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ScaleConstraint")
     cmds.scaleConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ScaleConstraint")
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:32,代码来源:dpSingle.py

示例8: rigExtrudePlane

def rigExtrudePlane() : 
	mc.select(cl = True)
	lf_leg = ['lf_upLeg_nrJnt', 'L_leg_profileCrv']
	rt_leg = ['rt_upLeg_nrJnt', 'R_leg_profileCrv']
	lf_arm = ['lf_upArm_nrJnt', 'L_arm_profileCrv']
	rt_arm = ['rt_upArm_nrJnt', 'R_arm_profileCrv']
	set1 = [lf_leg, rt_leg, lf_arm, rt_arm]

	for each in set1 : 
		# constraint nonRoll to profile curve
		mc.orientConstraint(each[0], each[1], mo = True)
		print each[0], each[1]

	mc.select(cl = True)

	naming1 = ['L_arm_pathCrv', 'L_arm_profileCrv', 'R_arm_pathCrv', 'R_arm_profileCrv']
	naming2 = ['L_leg_pathCrv', 'L_leg_profileCrv', 'R_leg_pathCrv', 'R_leg_profileCrv']
	mc.select(naming1, naming2)
	mm.eval('tazGrp;')
	mc.select(cl = True)

	grp = ['L_armProfileCrv_zGrp', 'R_armProfileCrv_zGrp', 'L_legProfileCrv_zGrp', 'R_legProfileCrv_zGrp']

	for each in grp : 
		mc.scaleConstraint('placement_ctrl', each)

	# mc.select(cl = True)
	# # bind skin
	# mc.skinCluster('lf_upArm_jnt', 'lf_loArm_jnt', 'lf_wrist_jnt', 'L_arm_pathCrv', tsb = True)
	# mc.skinCluster('lf_upArm_jnt', 'lf_loArm_jnt', 'lf_wrist_jnt', 'L_arm_pathCrv', tsb = True)
	# mc.skinCluster('rt_upLeg_jnt', 'rt_loLeg_jnt', 'rt_ankle_jnt', 'R_leg_pathCrv', tsb = True)
	# mc.skinCluster('rt_upArm_jnt', 'rt_loArm_jnt', 'rt_wrist_jnt', 'Larm_pathCrv', tsb = True)

			
	# print 'Done'
开发者ID:myCodeTD,项目名称:rigTools,代码行数:35,代码来源:nonRoll.py

示例9: create_spine_rig

def create_spine_rig(base_curve, rig_region_name, pelvis, cog, spine_1, spine_2, spine_3, spine_4, neck):

    # create group to contain all rigging nodes
    cmds.select(cl=True)
    spine_group = cmds.group(em=True, n=rig_region_name + '_group')
    cmds.select(spine_group, base_curve, r=True)
    cmds.parent()

    # add the arm group node to the base curve rig nodes attr
    add_node_to_rig_nodes(base_curve, rig_region_name, spine_group)

    cog_curve, cog_curve_group = jt_ctl_curve.create(cog, 'star_5', lock_unused=False)
    cmds.setAttr(cog_curve + '.scale', 3,3,3)
    cmds.select(cog_curve, r=True)
    cmds.makeIdentity(apply=True, t=0, r=0, s=1, n=0)

    cmds.select(cog_curve, cog, r=True)
    cmds.parentConstraint(mo=True, weight=1)
    cmds.scaleConstraint(mo=True, weight=1)

    cmds.select(cog_curve_group, base_curve, r=True)
    cmds.parent()

    pelvis_curve, pelvis_curve_group = jt_ctl_curve.create(pelvis, 'waist', True, True, True, True)
    spine_1_curve, spine_1_curve_group = jt_ctl_curve.create(spine_1, 'circle', True, True, True, True)
    spine_2_curve, spine_2_curve_group = jt_ctl_curve.create(spine_2, 'circle', True, True, True, True)
    spine_3_curve, spine_3_curve_group = jt_ctl_curve.create(spine_3, 'circle', True, True, True, True)
    spine_4_curve, spine_4_curve_group = jt_ctl_curve.create(spine_4, 'circle', True, True, True, True)
    neck_curve, neck_curve_group = jt_ctl_curve.create(neck, 'circle', True, True, True, True)

    # parent fk controlls to spine group
    cmds.select(cog_curve_group, pelvis_curve_group, spine_1_curve_group, spine_2_curve_group, spine_3_curve_group, spine_4_curve_group, neck_curve_group, spine_group, r=True)
    cmds.parent()
开发者ID:MaxIsJames,项目名称:jt_tools,代码行数:33,代码来源:jt_autorig.py

示例10: __init__

 def __init__(self, _sceneData, _parent1, _parent2, _name, _baseName, _numCtrls, _numJoints = 5):
     self.m_sceneData = _sceneData
     self.m_parent1 = _parent1
     self.m_parent2 = _parent2
     self.m_name = _name
     self.m_baseName = _baseName
     self.m_group = cmds.group(em=1, n=_name+"_GRP")
     self.m_numCtrls = _numCtrls
     self.m_numJoints = _numJoints
     self.m_isParentBend = True
     self.m_blendControl = False
     self.m_blendAttrName = "autoBend"
     self.m_squetchAttrName = "squetchiness"
     self.m_squetchBoolAttrName = "squetchOnOff"
     self.m_attrHeading = "Heading"
     self.m_isMirrored = False
     self.m_twistAxis = "y"
     self.m_userJoints = False
     self.m_isAutoBend = True
     self.m_isParentTwist = True
     self.m_allControls = {}
     
     #create null for scale fixing
     self.m_scaleNull = cmds.group(em=1, n=_name+"_NULL", w=True)
     cmds.setAttr(self.m_scaleNull+".inheritsTransform", 0)
     cmds.parent(self.m_scaleNull, self.m_group)
     cmds.scaleConstraint(self.m_group, self.m_scaleNull) 
开发者ID:jaredauty,项目名称:Rigging,代码行数:27,代码来源:StretchChain.py

示例11: makeGlobalControl

def makeGlobalControl():
    utils.debbug.DebbugMessage(message="Creating global control")

    parent = nameLib.groupNames.modulesGroup["name"]
    constraintTo = [nameLib.groupNames.jointsGroup["name"]]

    globalControlData = {"name":nameLib.prefixNames.globalControl,
                         "style":"circle",
                         "size":(30,30,30),
                         "orient":(0,1,0),
                         "color":16,
                         "attributes":False}


    globalControl = utils.makeControl.MakeControl(name=globalControlData["name"],
                                                  style=globalControlData["style"],
                                                  orient=globalControlData["orient"],
                                                  size=globalControlData["size"],
                                                  color=globalControlData["color"],
                                                  parentUnder=parent,
                                                  lockChannels = ["v"])

    # constraint to joints group
    mc.parentConstraint(globalControl.controller, constraintTo[0], name="globalParent_constraint")
    mc.scaleConstraint(globalControl.controller, constraintTo[0], name="globalScale_constraint")

    # add to character set
    utils.characterSet.characterSet(globalControl.controller, channelsToRemove = [".v"])
开发者ID:robertvari,项目名称:rvRigTools,代码行数:28,代码来源:global_ctrl.py

示例12: rigScale

def rigScale():
    placementControl = nameLib.prefixNames.globalControl + nameLib.prefixNames.controlSuffix

    groups = [nameLib.groupNames.leftLegRigGroup["name"],
              nameLib.groupNames.rightLegRigGroup["name"],
              nameLib.groupNames.leftArmRigGroup["name"],
              nameLib.groupNames.rightArmRigGroup["name"],]

    for i in groups:
        mc.scaleConstraint(placementControl, i)
开发者ID:robertvari,项目名称:rvRigTools,代码行数:10,代码来源:rigScale.py

示例13: scale

	def scale(self):
		"""make a scale constraint between lists"""
		fromItems, toItems = self._getItemsInLists()
		maintainOffset = self.maintainOffset_chb.isChecked()
		if len( fromItems ) == 1:
			for toNode in toItems:
				mc.scaleConstraint( fromItems[0].name, toNode.name, mo = maintainOffset )
		else:
			for fromNode,toNode in zip( fromItems, toItems ):
				mc.scaleConstraint( fromNode.name, toNode.name, mo = maintainOffset )
开发者ID:skarone,项目名称:PipeL,代码行数:10,代码来源:multiAttributeUi.py

示例14: scaleConstraintCmd

def scaleConstraintCmd(maintainOffset):
    # Get selection Objects
    selection = cmds.ls (sl = True)

    # Error Checking
    if len(selection) != 2:
        raise Warning ("Please Select 2 Objects")
        return
        
    cmds.scaleConstraint(selection[0], selection[1], maintainOffset=maintainOffset)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:10,代码来源:hotkeys.py

示例15: create

def create(geo,prefix=''):
	'''
	'''
	# Check prefix
	if not prefix: prefix = geo
	
	# Create Deformer
	sMod = mc.softMod(geo,n=prefix+'_softMod')
	sModHandle = sMod[1]
	sMod = sMod[0]
	sModBase = mc.duplicate(sModHandle,po=True,n=prefix+'_softModBase')[0]
	
	# Get Handle pivot
	piv = mc.xform(sModHandle,q=True,ws=True,rp=True)
	
	# Initiate Control Builder
	ctrlBuilder = glTools.tools.controlBuilder.ControlBuilder()
	
	# Create Base control
	base_grp = mc.createNode('transform',n=prefix+'_softModBase_grp')
	base_ctrl = mc.createNode('transform',n=prefix+'_softModBase_ctrl',p=base_grp)
	base_ctrlShape = ctrlBuilder.controlShape(base_ctrl,'box',scale=2)
	
	# Create Offset control
	offset_grp = mc.createNode('transform',n=prefix+'_softModOffset_grp',p=base_ctrl)
	offset_ctrl = mc.createNode('transform',n=prefix+'_softModOffset_ctrl',p=offset_grp)
	offset_ctrlShape = ctrlBuilder.controlShape(offset_ctrl,'sphere',scale=0.25)
	
	# Create Falloff control
	falloff_grp = mc.createNode('transform',n=prefix+'_softModFalloff_grp',p=base_ctrl)
	falloff_ctrl = mc.createNode('transform',n=prefix+'_softModFalloff_ctrl',p=falloff_grp)
	falloff_ctrlShape = ctrlBuilder.controlShape(falloff_ctrl,'circle',scale=1)
	falloff_loc = mc.spaceLocator(n=prefix+'_softModFalloff_loc')[0]
	mc.parent(falloff_loc,falloff_ctrl)
	mc.addAttr(falloff_ctrl,ln='radius',min=0.001,dv=1,k=True)
	mc.setAttr(falloff_loc+'.v',0)
	
	# Move hierarchy into place
	mc.move(piv[0],piv[1],piv[2],base_grp,a=True)
	
	# Connect to deformer
	mc.connectAttr(falloff_loc+'.worldPosition[0]',sMod+'.falloffCenter',f=True)
	mc.connectAttr(falloff_ctrl+'.radius',sMod+'.falloffRadius',f=True)
	mc.connectAttr(sModBase+'.worldInverseMatrix[0]',sMod+'.bindPreMatrix',f=True)
	
	# Parent and constrain softMod elements
	mc.parentConstraint(offset_ctrl,sModHandle,mo=True)
	mc.scaleConstraint(offset_ctrl,sModHandle,mo=True)
	mc.parentConstraint(base_ctrl,sModBase,mo=True)
	mc.scaleConstraint(base_ctrl,sModBase,mo=True)
	mc.parent(sModHandle,sModBase)
	mc.parent(sModBase,base_grp)
	
	# Return result
	return sMod
开发者ID:auqeyjf,项目名称:glTools,代码行数:55,代码来源:softModTool.py


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