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


Python core.scaleConstraint函数代码示例

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


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

示例1: bdConnectArms

def bdConnectArms(namespace):
	print 'adasdasdasda'
	sides = {'Left':'L', 'Right':'R'}
	tsmArmChain = ['Arm_joint1','Arm_joint2','Arm_joint3','Arm_joint5','Arm_influence7_intermediate_constrain','Arm_joint6','Arm_joint7','Arm_joint8','Arm_joint7']
	capcomArmChain = ['Shoulder','ArmDir','Arm1','Arm2','Elbow','ARoll3','ARoll4','handRot','handXR'] 

	i=0

	for jnt in tsmArmChain:
		try:
			target = pm.ls(namespace + sides['Left'] + capcomArmChain[i])[0]
		except:
			print ' cant find', capcomArmChain[i]
			
		source = pm.ls(sides.keys()[1] + jnt )[0]
		i+=1

		pm.parentConstraint(source,target,mo=True)
		pm.scaleConstraint(source,target,mo=True)

	i=0

	for jnt in tsmArmChain:
		target = pm.ls(namespace + sides['Right'] + capcomArmChain[i])[0]
		source = pm.ls(sides.keys()[0] + jnt )[0]
		i+=1

		pm.parentConstraint(source,target,mo=True)        
		pm.scaleConstraint(source,target,mo=True)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:29,代码来源:bdHookSFChar.py

示例2: connectChains

	def connectChains(self, *args, **kwargs):
		## pass in the roots to connect
		## arguments to args are expected to be lists or tuples

		chains = []
		for arg in args:
			if isinstance(arg, list) or isinstance(arg, tuple):
				chains.append(utils.makeList(arg))
				root = chains[-1][0].getParent()
				if not root.type() == 'transform' or not root.endswith('_rigRoot'):
					raise ModuleBaseException('connectChains: Passed in chain has no rig root.')
			else:
				raise ModuleBaseException('connectChains: Only lists of joints may be passed in.')

		if len(chains) < 2:
			raise ModuleBaseException('connectChains: need at least two chain roots.')

		targetChain = chains.pop(-1)

		if len(chains) == 1:
			## direct connection
			for source, target in zip(chains[0], targetChain ):
				for attr in 'translate','rotate','scale':
					for axis in 'XYZ':
						source.attr(attr+axis) >> target.attr(attr+axis)

			## because we checked earlier the rigRoots should be present at this point
			sourceRoot = chains[0][0].getParent()
			targetRoot = targetChain[0].getParent()

			pm.parentConstraint(sourceRoot, targetRoot, mo=True)
			pm.scaleConstraint(sourceRoot, targetRoot, mo=True)

		else:
			raise NotImplementedError("Multiple chains aren't finished yet, sorry.")
开发者ID:AtonLerin,项目名称:littlewitch,代码行数:35,代码来源:module_base.py

示例3: FTV_generateFluidTransformSpaceGrp

def FTV_generateFluidTransformSpaceGrp( name, fluidSourceData):
	''' return a group that is fully constrained by fluidSourceData'''
	fluidSpaceTransform = pm.group( em=True, n=name )
	pm.parentConstraint(fluidSourceData[0], fluidSpaceTransform)
	pm.scaleConstraint(fluidSourceData[0], fluidSpaceTransform)
	FTV_lockAndHide(fluidSpaceTransform, ['v'])
	return fluidSpaceTransform
开发者ID:mathieuSauvage,项目名称:MayaFluidTextureViewer,代码行数:7,代码来源:fluidTextureViewer.py

示例4: ExtraControlForJnt

def ExtraControlForJnt( jnts=None ) :

	if not jnts:
		jnts = pm.ls( sl=True )
	else:
		jnts = pm.ls( jnts )
	
	
	for jnt in jnts:
		
		# duplicate joint
		pm.select( clear=True )
		newJnt = pm.joint( p = [0,0,0], name= '%s_extra'%jnt.name() )
		pm.delete( pm.pointConstraint( jnt, newJnt ) )
		pm.delete( pm.orientConstraint( jnt, newJnt ) )
		pm.parent( newJnt, jnt )
		newJnt.jointOrient.set( jnt.jointOrient.get() )
		
		# create control curve for joint
		ctrl = CubeCrv( name = '%s_ctrl'%jnt.name() )
		pm.delete( pm.pointConstraint( jnt, ctrl ) )
		pm.delete( pm.orientConstraint( jnt, ctrl ) )
		zeroAndOfs = ZeroGrp( ctrl )
		ctrl.translate >> newJnt.translate
		ctrl.rotate >> newJnt.rotate
		ctrl.scale >> newJnt.scale
        
		# make controls to move with base joints
		pm.parentConstraint( jnt, zeroAndOfs[0] )
		pm.scaleConstraint( jnt, zeroAndOfs[0] )
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:30,代码来源:extraControlForJnt.py

示例5: rig_transformer_piece

def rig_transformer_piece(transform):
    """
	Usage:
		rig_transformer_piece( pm.ls(sl=True)[0] )
	"""
    if get_parentConstraintPairs(transform):
        # create a control and store its groups/parts
        ctrl_GRP = create_boundingBoxCtrl(transform)
        ctrl = [ctrl for ctrl in ctrl_GRP.listRelatives(c=True, type="transform") if "CTRL" in ctrl.name()][0]
        ctrlCon_GRP = [
            con_grp for con_grp in ctrl.listRelatives(c=True, type="transform") if "Con_GRP" in con_grp.name()
        ][0]
        # get the parent constraint information and then remove it
        target_weight_pairs = get_parentConstraintPairs(transform)
        pm.delete(target_weight_pairs[1])
        # setup the new space switching based on the old parent constraint
        parents = [target_weight_pairs[0][0][0], "spineJA_JNT", "spineJF_JNT", "globalB_CTRL", "worldSpace_GRP"]
        parent_names = ["normal", "hips", "chest", "global", "world"]
        ctrl_setupSpaceSwitch(ctrl, ctrl_GRP, parents, parent_names)
        # control the object with the new space-switch controller
        pm.parentConstraint(ctrlCon_GRP, transform, mo=True)
        pm.scaleConstraint(ctrlCon_GRP, transform, mo=True)
    else:
        # if it didn't have a parentConstraint do nothing
        return None
开发者ID:AndresMWeber,项目名称:jobScripts,代码行数:25,代码来源:rig_transformer.py

示例6: create_bind_joint

def create_bind_joint(jnt):
    name= jnt.name().replace('joint', "bindJoint")
    bind_joint = pm.duplicate(jnt, name=name, po=True)[0]
    pm.parentConstraint(jnt, bind_joint, mo=False)
    pm.scaleConstraint(jnt, bind_joint, mo=False)
    
    pm.parent(bind_joint, 'bind_joint')
开发者ID:adamfok,项目名称:afok_toolset,代码行数:7,代码来源:utils_skinning.py

示例7: wrap_createScalableWrap

def wrap_createScalableWrap(driver, tgts, scale_obj, parent=None):
	'''Only used on skinned driver meshes, creates a wrap that scales
	Args:
		driver (pm.nt.Transform): wrap driver
		tgts ([pm.nt.Transform]): list of objects to wrap
		scale_obj (pm.nt.Transform): The object that it gets its scaling from
		parent (pm.nt.Transform): If not set, uses scaleParent as parent, otherwise
								  That's the new parent
	Returns ([pm.nt.wrap]): list of wrap deformers that were created
	Usage: 
		wrap_createScalableWrap(pm.ls(sl=True)[0],[pm.ls(sl=True)[1]], pm.PyNode('global_CTRL'))
	'''
	wrap = createWrap(driver, tgts, 0, 50, 2, True, True, 0)
	#Create the wrap scale group
	scaleGrp = 'wrapScale_GRP'
	if pm.objExists(scaleGrp):
		scaleGrp = pm.PyNode(scaleGrp)
	else:
		scaleGrp = pm.group(em=True, n=scaleGrp)
	#Create a scale joint for the base object
	scaleJnt = pm.joint(n=driver+'_WRAPSCALE_JNT')
	scaleJnt.setParent(scaleGrp)
	#skin it
	pm.skinCluster(scaleJnt, wrap['driver'][1], tsb=True, n=driver.name()+'wrap_SKINCLSTR')
	#parent the joint under the scale parent
	if parent:
		scaleGrp.setParent( parent )
	else:
		scaleGrp.setParent( scale_obj )
	#scale the transform of the targets
	for tgt in tgts:
		pm.scaleConstraint(scale_obj, tgt, mo=True)
	return wrap
开发者ID:creuter23,项目名称:tools,代码行数:33,代码来源:lib_deformer.py

示例8: _parent_avar

 def _parent_avar(self, avar, parent):
     try:
         avar_grp_parent = avar._grp_parent
         pymel.parentConstraint(parent, avar_grp_parent, maintainOffset=True)
         pymel.scaleConstraint(parent, avar_grp_parent, maintainOffset=True)
     except Exception, e:
         print(str(e))
开发者ID:renaudll,项目名称:omtk,代码行数:7,代码来源:rigFaceAvarGrps.py

示例9: parent_to

 def parent_to(self, parent):
     """
     Parent the system to a specific object.
     # TODO: Implement!
     """
     if self.grp_anm:
         pymel.parentConstraint(parent, self.grp_anm, maintainOffset=True)
         pymel.scaleConstraint(parent, self.grp_anm, maintainOffset=True)
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:8,代码来源:classModule.py

示例10: createJointGeo

def createJointGeo( joints=[], constraint=False, parent=True, color=True ):
    if not joints:
        joints = pm.selected(type='joint')

    GEOs = []
    for jnt in joints:
        jnt   = pm.PyNode(jnt)
        child = jnt.getChildren( type='joint' )

        if not child: continue # 자식 조인트가 없으면 넘어감

        # 지오메트리 생성
        geo = pm.polyCube(ch=False)[0]

        #
        geo.setParent(jnt)

        geo.t.set( child[0].t.get() * 0.5 )
        geo.r.set( 0,0,0 )

        # 스케일 조정
        tr   = child[0].t.get()
        abtr = [ abs(val) for val in tr ]

        radius = jnt.radius.get() * 2
        sx = abtr[0] if abtr[0] > 0.001 else radius
        sy = abtr[1] if abtr[1] > 0.001 else radius
        sz = abtr[2] if abtr[2] > 0.001 else radius
        geo.s.set( sx,sy,sz )

        # 이름 변경
        geo.rename( jnt.name()+'_geo' )

        # 지오메트리 pivot 옮김
        copyPivot( jnt, geo )

        # transform 초기화
        pm.makeIdentity(geo, t=True, r=True, s=True, apply=True)

        if color:
            assignColorAxisShader( geo.f[4], 'x' )
            assignColorAxisShader( geo.f[1], 'y' )
            assignColorAxisShader( geo.f[0], 'z' )

        if not parent:
            geo.setParent(w=True)

        # 구속
        if constraint:
            geo.setParent(w=True)
            pm.parentConstraint(jnt,geo)
            pm.scaleConstraint(jnt,geo)

        GEOs.append(geo)

    return GEOs
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:56,代码来源:joint.py

示例11: add_squash_n_stretch

    def add_squash_n_stretch(self, follicles):
        """ 
        Args:
            None
        Returns (None)
        Usage:
        """
        base_name = '%s_flexiPlane' % self.flexiPlaneNameField.getText()
        wire_name =  '%s_wire_CRV' % base_name
        main_crv_name =  '%s_main_CTRL' % base_name
        
        wire = pm.PyNode(wire_name)
        
        arc_len = pm.arclen(wire, ch = True)
        pm.rename( arc_len, wire_name + 'info' )
        arc_len_val = pm.getAttr( wire_name + 'info.arcLength')
        
        multDiv_length = pm.shadingNode( 'multiplyDivide', asUtility = True )
        pm.rename( multDiv_length, base_name  + '_div_squashStretch_length' )
        pm.setAttr( base_name  + '_div_squashStretch_length.operation', 2 )
        
        pm.connectAttr( wire_name + 'info.arcLength', base_name  + '_div_squashStretch_length.input1X' )
        pm.setAttr( base_name  + '_div_squashStretch_length.input2X', arc_len_val )
        
        multDiv_volume = pm.shadingNode( 'multiplyDivide', asUtility = True )
        pm.rename( multDiv_volume, base_name  + '_div_volume' )
        pm.setAttr( base_name  + '_div_volume.operation', 2 )
        pm.setAttr( base_name  + '_div_volume.input1X', 1 )
        
        pm.connectAttr( base_name  + '_div_squashStretch_length.outputX', base_name  + '_div_volume.input2X', f = True )
        
        conditional_volume = pm.shadingNode( 'condition', asUtility = True )
        pm.rename( conditional_volume, base_name  + '_cond_volume' )
        pm.setAttr( base_name  + '_cond_volume.secondTerm', 1 )
        pm.connectAttr( main_crv_name + '.squashN_stretch', base_name  + '_cond_volume.firstTerm' )

        multDiv_globelScale = pm.shadingNode( 'multiplyDivide', asUtility = True )
        pm.rename( multDiv_globelScale, base_name  + '_mult_globalScale' )
        pm.connectAttr( base_name  + '_div_volume.outputX', base_name  + '_mult_globalScale.input1X' )
        pm.connectAttr( main_crv_name  + '.scaleX', base_name  + '_mult_globalScale.input2X' )
        pm.connectAttr( base_name  + '_mult_globalScale.outputX', base_name  + '_cond_volume.colorIfTrueR' )

        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_crv_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_tweak%03d' % (index+1),
                                                 SUFFIX = 'CTRL')
            
            pm.scaleConstraint( tweek_crv_name + 'Con_GRP', jnt_offset_name )
            pm.connectAttr( base_name  + '_cond_volume.outColorR', jnt_name + '.scaleX')
            pm.connectAttr( base_name  + '_cond_volume.outColorR', jnt_name + '.scaleZ')
            
            pm.select( clear = True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:56,代码来源:flexi_plane.py

示例12: rig_crankshaft

def rig_crankshaft():
	#cmds.file("/jobs/pennzoilPennzoilNaturalGas_5402237/build/piston/release/work/mayaScene/pistonBuild/vLatest/mayaScene_pistonBuild_vLatest.ma",
	#          i=True, type="mayaAscii", ignoreVersion=True,rpr="mayaScene_pistonBuild_vLatest",options="v=0",pr=True,loadReferenceDepth="all")
	#setup variables for existing nodes
	global_ctrl=pm.PyNode('global_CTRL')
	global_loc=pm.PyNode('global_LOC')
	crankshaft_ctrl = pm.PyNode('crankshaft_CTRL')
	crankshaft_loc = pm.PyNode('crankshaft_LOC')
	display_ctrl = mpc.rig_makeCtrlLabel('display')
	
	#create piston controls
	for piston in range(0,global_loc.numPistons.get()):
		ctrl_offset = mpc.rig_ctrlDuplicate(crankshaft_ctrl, 'piston'+string.uppercase[piston]+'_mover')
		weight_loc = pm.PyNode('weight%s_LOC'%string.uppercase[piston])
		rod_loc = pm.PyNode('rod%s_LOC'%string.uppercase[piston])
		head_loc = pm.PyNode('head%s_LOC'%string.uppercase[piston])
		piston_loc = pm.PyNode('piston%s_LOC'%string.uppercase[piston])
		if ctrl_offset[0]:
			pm.delete( pm.parentConstraint(weight_loc, ctrl_offset[0] ) )
			ctrl_offset[0].rx.set(90)
			pm.parentConstraint(ctrl_offset[2], piston_loc, mo=True)
		else:
			pm.delete( pm.parentConstraint(weight_loc, ctrl_offset[1] ) )
			pm.parentConstraint(ctrl_offset[2], piston_loc, mo=True)
		mpc.rig_ctrlLock([ctrl_offset[1]], ['tx','ty','tz','rz','ry','sx','sy','sz','v'], setKeyable=False, lock=True)
		mpc.rig_ctrlColor(ctrl_offset[1], 15)
		
	#setup connections
	pm.delete( pm.parentConstraint(  crankshaft_ctrl.getParent(), crankshaft_loc ) )
	pm.parentConstraint( crankshaft_ctrl, crankshaft_loc,  mo=True )
	
	#parent + create groups + lock down ctrls
	grp_csr = pm.group(em=True,n='crankshaftRig_GRP')
	grp_model = pm.group(em=True,n='model_GRP')
	grp_nodes = pm.group(em=True,n='nodes_GRP')
	grp_model.setParent(grp_csr)
	grp_nodes.setParent(grp_csr)
	global_ctrl.getParent().setParent(grp_csr)
	global_loc.setParent(grp_nodes)
	global_loc.visibility.set(0)
	display_ctrl.getParent().setParent(global_ctrl)
	display_ctrl.getParent().ty.set(pm.xform('headA_LOC', q=True , t=True, ws=True)[1])
	mpc.rig_ctrlLock([crankshaft_ctrl], ['tx','ty','tz','rz','ry','sx','sy','sz','v'], setKeyable=False, lock=True)
	pm.scaleConstraint( global_ctrl, grp_nodes, mo=True )
	display_ctrl.addAttr('displayLocators', at='long', min=0,max=1, k=True)
	display_ctrl.displayLocators.connect(global_loc.v, f=True)
	
	if pm.objExists('pistons_lodA_GRP'):
		pm.PyNode('pistons_lodA_GRP').setParent(grp_model)
	
	#Create Sets
	rp_set = mpc.rig_setsCreateHubSet([grp_csr], 'crankshaft', 'rigPuppet')
	ac_set = mpc.rig_setsCreateHubSet(pm.ls('*CTRL'), 'crankshaft','animCurves')
	gc_set = mpc.rig_setsCreateHubSet(pm.ls('*GEO'), 'crankshaft','geometryCache')
	pm.delete('hubMayaScenePistonBuildSet')
	pm.sets(rp_set, add=(ac_set, gc_set))
开发者ID:AndresMWeber,项目名称:jobScripts,代码行数:56,代码来源:rig_crankShaft.py

示例13: rig_makeBlockGeo

def rig_makeBlockGeo(geometry, mpcStyle=False):
	'''Uses the MPC block geo script to create automaded block geo out of one selected object which is properly constrained.
	Args:
		geometry (pm.PyNode): poly mesh to be broken apart
		mpcStyle (boolean): replaces the suffix based on JNT and GEO
	Returns (list[pm.PyNode]): List of proxies that were generated
	Example Usage:
		rig_makeBlockGeo()
	'''
	#convert the list to a mel list as a string to pass
	command = 'rig_makeBlockGeo ({{"{MESHES}"}},"");'.format(MESHES=geometry)
	print command
	proxies = mel.eval(command)
	
	if len(proxies):
		#Time to sort them and order them + constrain them
		if not pm.objExists('proxy_GRP'):
			prx_grp = pm.group(em=True, n='proxy_GRP')
		else:
			prx_grp = pm.PyNode('proxy_GRP')
		
	if pm.objExists('model_GRP'):
		prx_grp.setParent('model_GRP')
		if pm.objExists('globalCon_GRP'):
			pm.scaleConstraint('globalCon_GRP', prx_grp, mo=True)
	final={}
	
	proxy_grp = geometry.replace('GEO','PROXY_GRP')
	if not pm.objExists(proxy_grp):
		proxy_grp=pm.group(em=True,n=proxy_grp)
	else:
		proxy_grp=pm.PyNode(proxy_grp)
	proxy_grp.setParent(prx_grp)
	
	for proxy in proxies:
		if mpcStyle:
			proxy=pm.PyNode(proxy)
			pm.polySoftEdge(proxy, a=0, ch=0)
			jnt = proxy.name().replace('_GEO','')
			print proxy.name().replace('_GEO','')
			print proxy.name().replace('GEO','JNT')
			if pm.objExists(proxy.replace('GEO','JNT')):
				jnt = proxy.replace('GEO','JNT')
			pm.parentConstraint(jnt, proxy, mo=True)
			proxy.setParent(proxy_grp)
			proxy.rename(geometry+'_'+proxy.replace('GEO','PROXY'))
			print 'adding joint'
			final[proxy]=jnt
		else:
			proxy=pm.PyNode(proxy)
			pm.polySoftEdge(proxy, a=0, ch=0)
			proxy.rename(proxy.replace('GEO','PROXY'))
			final[proxy]=proxy.replace('_PROXY', '')
	return final
开发者ID:AndresMWeber,项目名称:aw,代码行数:54,代码来源:lib_mpc.py

示例14: create_control

def create_control(node, name='', shape="", axis="", size=1, point=True, orient=True, scale=False, help=False):
    node = pm.PyNode(node)
    
    if not shape:
        shape = "circle"
        
    if not name:
        name = "%s_ctrl" %node.name()

    shapeMELs = {
    "circle"     :  "circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 0.5 -d 3 -ut 0  -s 8 -ch 0",
    "diamond"    :  "circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 0.5 -d 1 -ut 0  -s 4 -ch 0",
    "square"     :  "curve -d 1 -p -0.5 0 0.5 -p -0.5 0 -0.5 -p 0.5 0 -0.5 -p 0.5 0 0.5 -p -0.5 0 0.5 -k 0 -k 1 -k 2 -k 3 -k 4",
    "global"     :  "curve -d 3 -p 0 0 0.75 -p 0.25 0 0.5 -p 0.25 0 0.5 -p 0.25 0 0.5 -p 0.375 0 0.5 -p 0.5 0 0.5 -p 0.5 0 0.375 -p 0.5 0 -0.375 -p 0.5 0 -0.5 -p 0.375 0 -0.5 -p -0.375 0 -0.5 -p -0.5 0 -0.5 -p -0.5 0 -0.375 -p -0.5 0 0.375 -p -0.5 0 0.5 -p -0.375 0 0.5 -p -0.25 0 0.5 -p -0.25 0 0.5 -p -0.25 0 0.5 -p 0 0 0.75 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 17 -k 17",
    "local"      :  "curve -d 3 -p 0 0 0.5 -p 0.125 0 0.375 -p 0.125 0 0.375 -p 0.125 0 0.375 -p 0.25 0 0.375 -p 0.375 0 0.375 -p 0.375 0 0.25 -p 0.375 0 -0.25 -p 0.375 0 -0.375 -p 0.25 0 -0.375 -p -0.25 0 -0.375 -p -0.375 0 -0.375 -p -0.375 0 -0.25 -p -0.375 0 0.25 -p -0.375 0 0.375 -p -0.25 0 0.375 -p -0.125 0 0.375 -p -0.125 0 0.375 -p -0.125 0 0.375 -p 0 0 0.5 -k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 17 -k 17",
    "root"       :  "curve -d 1 -p 0 0 0.325 -p -0.0634045 0 0.318755 -p -0.124372 0 0.300261 -p -0.180561 0 0.270228 -p -0.22981 0 0.22981 -p -0.270228 0 0.180561 -p -0.300261 0 0.124372 -p -0.318755 0 0.0634045 -p -0.325 0 0 -p -0.318755 0 -0.0634045 -p -0.300261 0 -0.124372 -p -0.270228 0 -0.180561 -p -0.22981 0 -0.22981 -p -0.180561 0 -0.270228 -p -0.124372 0 -0.300261 -p -0.0634045 0 -0.318755 -p 0 0 -0.325 -p 0.0634045 0 -0.318755 -p 0.124372 0 -0.300261 -p 0.180561 0 -0.270228 -p 0.22981 0 -0.22981 -p 0.270228 0 -0.180561 -p 0.300261 0 -0.124372 -p 0.318755 0 -0.0634045 -p 0.325 0 0 -p 0.318755 0 0.0634045 -p 0.300261 0 0.124372 -p 0.270228 0 0.180561 -p 0.22981 0 0.22981 -p 0.180561 0 0.270228 -p 0.124372 0 0.300261 -p 0.0634045 0 0.318755 -p 0 0 0.325 -p 0 0 -0.325 -p 0 0 -0.25 -p -0.0487726 0 -0.245197 -p -0.095671 0 -0.23097 -p -0.138893 0 -0.207868 -p -0.176777 0 -0.176777 -p -0.207868 0 -0.138893 -p -0.23097 0 -0.095671 -p -0.245197 0 -0.0487726 -p -0.25 0 0 -p -0.325 0 0 -p 0.325 0 0 -p -0.25 0 0 -p -0.245197 0 0.0487726 -p -0.23097 0 0.095671 -p -0.207868 0 0.138893 -p -0.176777 0 0.176777 -p -0.138893 0 0.207868 -p -0.095671 0 0.23097 -p -0.0487726 0 0.245197 -p 0 0 0.25 -p 0.0487726 0 0.245197 -p 0.095671 0 0.23097 -p 0.138893 0 0.207868 -p 0.176777 0 0.176777 -p 0.207868 0 0.138893 -p 0.23097 0 0.095671 -p 0.245197 0 0.0487726 -p 0.25 0 0 -p 0.245197 0 -0.0487726 -p 0.23097 0 -0.095671 -p 0.207868 0 -0.138893 -p 0.176777 0 -0.176777 -p 0.138893 0 -0.207868 -p 0.095671 0 -0.23097 -p 0.0487726 0 -0.245197 -p 0 0 -0.25 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47 -k 48 -k 49 -k 50 -k 51 -k 52 -k 53 -k 54 -k 55 -k 56 -k 57 -k 58 -k 59 -k 60 -k 61 -k 62 -k 63 -k 64 -k 65 -k 66 -k 67 -k 68 -k 69",
    }
    
    if help:
        print "################################"
        print "- Available Control Shape List -"
        for key in shapeMELs:
            print key
        print "################################"            
        return 
    
    shapeMEL = "%s -n %s" % (shapeMELs[shape], name)
    
    rotations = {'x'  : [90, 0 , 0],
                 '-x' : [-90, 0 , 0],
                 'y'  : [0, 90, 0],
                 '-y' : [0, -90, 0],
                 'z'  : [0, 0, 90],
                 '-z'  : [0, 0, -90],
                 }
                        
    try:
        pm.mel.eval(shapeMEL)        
        ctrl = pm.PyNode(name)
        ctrl.scale.set(size, size, size)
        if axis: ctrl.rotate.set(rotations[axis])
        pm.makeIdentity(ctrl, apply=True, t=True, r=True, s=True)

        pm.delete(pm.parentConstraint(node, ctrl, mo=False))
                
        if point : pm.pointConstraint(ctrl, node, mo=True, name="%s_tConst"%node.name())
        if orient : pm.orientConstraint(ctrl, node, mo=True, name="%s_rConst"%node.name())
        if scale : pm.scaleConstraint(ctrl, node, mo=True, name="%s_sConst"%node.name())
        
        return ctrl
    
    except Exception as e:
        pm.warning("error while creating control %s" %e)
        
开发者ID:adamfok,项目名称:afok_toolset,代码行数:53,代码来源:utils_autoRig.py

示例15: build_tweek_ctrls

    def build_tweek_ctrls(self, follicles):
        """ 
        Args:
            None
        Returns (None)
        """
        base_name = '%s_flexiPlane' % self.flexiPlaneNameField.getText()
        follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
        mainCTRLGRP = self.flexiPlaneNameField.getText() + '_flexiPlane_main_CTRLCon_GRP'
        main_crv_name =  '%s_main_CTRL' % base_name
        tweekCTRLGRP = pm.group( em = True, name = self.flexiPlaneNameField.getText() + '_flexiPlane_tweakCTRL_GRP' )
        tweekCTRLGRP.setAttr( 'inheritsTransform', 0 )
        pm.parent( tweekCTRLGRP, mainCTRLGRP )
        

        for index,follicle in enumerate(follicles):
            tweek_crv_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_tweak%03d' % (index+1),
                                                 SUFFIX = 'CTRL')
            pm.circle( c = (0, 0, 0 ), nr = ( 0, 1, 0 ), sw = 360, r = 1, d = 3, ut = 0, tol = 0.000129167, s = 8, n = tweek_crv_name, ch = 0 )
            pm.setAttr( tweek_crv_name + '.scaleX', .5 )
            pm.setAttr( tweek_crv_name + '.scaleY', .5 )
            pm.setAttr( tweek_crv_name + '.scaleZ', .5 )
            pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
            pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
            pm.makeIdentity( tweek_crv_name, apply=True, translate=True, rotate=True, scale=True )
            pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
            pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
            
            pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'A' )
            pm.setAttr( tweek_crv_name + 'A.rotateZ', -90 )
            pm.makeIdentity( tweek_crv_name + 'A', apply=True, translate=True, rotate=True, scale=True )
            
            pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'B' )
            pm.setAttr( tweek_crv_name + 'B.rotateZ', -90 )
            pm.setAttr( tweek_crv_name + 'B.rotateX', -90 )
            pm.makeIdentity( tweek_crv_name + 'B', apply=True, translate=True, rotate=True, scale=True )
            
            pm.parent( tweek_crv_name + 'AShape', tweek_crv_name + 'BShape', tweek_crv_name, add = True, shape = True )
            pm.delete( tweek_crv_name + 'A', tweek_crv_name + 'B')
            
            pm.select(tweek_crv_name, r=True)
            offSetGRP.add_offset_grps()
            conGRP.add_con_grps()
            pm.select(clear = True)
            
            pm.connectAttr( follicle + '.translate', tweek_crv_name + 'Offset_GRP.translate' )
            pm.connectAttr( follicle + '.rotate', tweek_crv_name + 'Offset_GRP.rotate' )
            pm.parent( tweek_crv_name + 'Offset_GRP', tweekCTRLGRP )
            pm.scaleConstraint( main_crv_name, tweek_crv_name + 'Offset_GRP' )
 
            pm.select( clear = True)
开发者ID:michaelanieves,项目名称:Rigging,代码行数:52,代码来源:flexi_plane.py


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