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

Python core.error函数代码示例

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

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



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

示例1: locInst_locSel

 def locInst_locSel(self):
     '''
     Function: Takes a locator and instances it's target (set as an extra attr)
     Then sets the location of the instance.
     If the instance already exists it uses that
     Returns: None
     '''
     locs = pm.ls(sl=True)
     grp_name = "_".join(locs[0].getParent().split('_')[:-2])+"_INST_GRP"
     print grp_name
     print pm.objExists(grp_name)
     if pm.objExists(grp_name): pm.PyNode(grp_name)
     else: grp=pm.group(em=True, n=grp_name)
     
     for loc in locs:
         #if the target isn't an instance create it
         targetExists = pm.ls(loc.target.get().split('_')[:-1][0]!='GEO', r=True, type='transform')[0]
         instanceExists = pm.ls(loc.target.get().split('_')[:-1][0]!='INST', r=True, type='transform')[0]
         if not instanceExists and targetExists:
             matchObj = pm.ls(loc.target.get(), r=True, type='transform')[0]
             instance = pm.instance(matchObj, n=('_'.join(matchObj.split('_')[:-1])+'_INST'))[0]
             #set the target to the new instance since it was created
             loc.target.set(instance)
         
         elif pm.objExists(loc.target.get()) and pm.objExists('_'.join(target.split('_')[:-1])+'_INST'):
             pm.error('Neither a GEO nor an INST object exists with this name')
         #otherwise initialize the instance variable    
         else: instance = pm.PyNode('_'.join(arg.split('_')[:-1])+'_INST')
         loc.t.connect( instance.t )
         loc.r.connect( instance.r )
         loc.s.connect( instance.s )
         instance.setParent(grp)
开发者ID:AndresMWeber,项目名称:aw,代码行数:32,代码来源:aw_locators.py


示例2: copyAnim

	def copyAnim(self):
		animFiles = []
		f=''
		wipPath = self.wipFolderEdit.text()

		selectedItems = self.wipAnimTable.selectedItems()

		if len(selectedItems):
			for item in selectedItems:
				if item.column() ==0:
					anim = item.text()
					print anim
					src = os.path.abspath(os.path.join(wipPath,anim))

					destPath = wipPath.replace('01_wip','03_preview')
					dest = os.path.abspath(os.path.join(destPath,anim))
					
					if os.path.isfile(src):
						if os.path.isfile(dest):
							pm.warning('Preview file exists already, will not overwrite ( save new version ? )')
						else:
							try:
								shutil.copyfile(src, dest)
							except:
								pm.error('Could not copy anim file to preview')
			
			self.bdPopulateFiles()
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:27,代码来源:animToolUI.py


示例3: copyPlayblast

	def copyPlayblast(self):
		blastFiles = []

		f=''
		wipPath = self.wipFolderEdit.text()

		selectedItems = self.wipAnimTable.selectedItems()
		
		if len(selectedItems):
			for item in selectedItems:
				if item.text() == 'Yes':
					animFile = self.wipAnimTable.item(item.row(),0).text()
					blastFile = self.hasPlayblast(animFile)
					wipBlastPath,blastFileName = os.path.split(blastFile)
					destPath = wipPath.replace('01_wip','03_preview')
					if destPath == wipPath:
						destPath = wipPath.replace('01_WIP','03_PREVIEW')
					dest = os.path.abspath(os.path.join(destPath,blastFileName))
					
					
					if os.path.isfile(blastFile):
						if os.path.isfile(dest):
							pm.warning('Blast exists already, will not overwrite ( save new version ? )')
						else:
							try:
								print("copying")
								shutil.copyfile(blastFile, dest)
								try:
									os.remove(blastFile)
								except OSError:
									pass
								self.bdPopulateFiles()
							except:
								pm.error('Could not copy blast file to preview')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:34,代码来源:animToolUI.py


示例4: storeDeformerWeights

def storeDeformerWeights(selection=True, type='rig_vertSnap'):
	'''
	Usage:
		storeDeformerWeights(selection=False)
		storeDeformerWeights(selection=True, type=['rig_vertSnap'])
		storeDeformerWeights(selection=False, type=['rig_vertSnap', 'wire'])
	'''
	
	deformers = pm.ls(type=type)
	if selection:
		if len(pm.ls(sl=True))==0:
			pm.error('select something numbnuts!')
		deformers = pm.ls(sl=True)[0].listHistory(type='rig_vertSnap')
	vsFile = {}
	for deformer in deformers:
		vs = Deformer(deformer)
		vs.initializeWeights()
		if len(vs.weightsList) > 0:
			vsFile[deformer.name()] = vs.weightsList
	try:
		filename = os.path.join( pm.fileDialog2(cap='Select a folder to store the weights', fm=3, okc='Select')[0], 'deformerWeights.json' )
	except:
		pm.error('Why did you cancel? :(')
	with open(filename, 'wb') as fp:
		print 'Storing weights in file:\n\t%s'%(filename)
		print '\t\tDeformers Stored:\n\t\t\t%s'%('\n\t\t\t'.join([deformer.name() for deformer in deformers]))
		json.dump(vsFile, fp, indent=4)
开发者ID:creuter23,项目名称:tools,代码行数:27,代码来源:lib_deformer.py


示例5: importMixamoFbx

    def importMixamoFbx(self) :
        print 'importMixamoFbx'
        pm.newFile(f=1)
        if self.fbxFile:
            if os.path.isfile(self.fbxFile):

                #import the FBX file
                pm.mel.eval( 'FBXImport -f "' + (self.fbxFile) + '"')
                #check for a default mesh in T-Pose. If found, replace geometry
                self.replaceGeometry()

                #clean its namespace
                removeNamespace()
                hips = pm.ls("Hips",type='joint')

                #add root joint for scale
                rootJnt = pm.joint(n='Root')
                pm.parent(hips[0],rootJnt)

                #clean up textures
                self.cleanUpTextures()
                pm.currentUnit(t='ntsc')

                return 1
            else:
                pm.error('Fbx file %s doesn\'t exist'%self.fbxFile)
                return 0
        else:
            pm.error('No file was given')
            return 0
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:30,代码来源:zoobeMixamo.py


示例6: _get_vert_weight_dict

def _get_vert_weight_dict() :
	sel = pm.ls( sl=True )
	if( len( sel ) != 1 ) :
		pm.error( 'Please select ONE mesh transform' )

	mesh = sel[0]
	if( mesh.type() != 'transform' ) :
		pm.error( 'Please select a MESH TRANSFORM' )

	# get the skincluster
	skinclusters = []
	for node in pm.listHistory( mesh ) :
		if( type( node ) == pm.nodetypes.SkinCluster ) :
			skinclusters.append( node )

	vertweightdict = {}

	for skincluster in skinclusters :
		for joint in skincluster.getWeightedInfluence() :
			verts, weights = skincluster.getPointsAffectedByInfluence( joint )
			for i, vert in enumerate( verts[0] ) :
				weight = weights[i]
				
				if( not vert in vertweightdict.keys() ) :
					vertweightdict[ vert ] = []

				vertweightdict[ vert ].append( ( joint, weight ) )

	return vertweightdict, skinclusters
开发者ID:kotchin,项目名称:mayaSettings,代码行数:29,代码来源:th_skinClusterMerge.py


示例7: run_cmd_ui

 def run_cmd_ui(self, *arg):
     if self.py_path:
         self.clear_script_reporter()
         self.cmds[0] = self.user_cmd
         
         cmd = ""
         with codecs.open(self.py_path, encoding="utf-8", mode="r") as f:
             cmd = f.read()
         
         if cmd:
             cmd += u"\n" + self.user_cmd
             with codecs.open(self.exec_path, encoding="utf-8", mode="w") as f:
                 f.write(cmd)
             
             try:
                 execfile(self.exec_path, globals())
             except Exception, error:
                 traceback.print_exc(file=sys.stdout)
                 if "encoding declaration in Unicode string" == error.args[0]:
                     try:
                         exec(cmd.encode("cp850"))
                     except Exception, error:
                         pmc.error(error)
                         traceback.print_exc(file=sys.stdout)
                 else:
                     pmc.error(error)
开发者ID:michimussato,项目名称:PyPELyNE,代码行数:26,代码来源:dockable_sciptwindow.py


示例8: _finalize

	def _finalize(self, type):
		nparticles = pm.ls(sl=True)
		for nparticle in nparticles:
			if pm.objectType(nparticle.getShape()) != 'nParticle':
				nparticles.remove(nparticle)
		print nparticles[0].getShape()
		nparticle=[nparticles[0], nparticles[0].getShape()]
		emitterCons = nparticle[1].listConnections(type='pointEmitter')
		if emitterCons:
			emitter = nparticle[1].listConnections(type='pointEmitter')[0]
		else: 
			pm.error('The particle doesn\'t have an emitter connected')
		if type==0:
			#set the max particles + emitter to max
			nparticle[1].maxCount.set(nparticle[1].getCount())
			emitter.rate.set(20000) #arbitrary high value
			print 'Setting max particle count for %s to %s' % (nparticle[1].name(), nparticle[1].getCount())
			mm.eval("setNClothStartState")
			mm.eval("performSetNClothStartState(1)")
		if type==1:
			#reset the max particles + emitter rate
			mm.eval("clearNClothStartState")
			mm.eval("performSetNClothStartState 0")
			nparticle[1].maxCount.set(-1)
			emitter.rate.set(5000)
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:aw_scatterParticle.py


示例9: __init__

 def __init__(self, skinCluster=None, transform=None, verbose=0):
     #Conditional argument setting
     if verbose: print dir(skinCluster)
     if transform:
         if transform.getShape().listHistory(type='skinCluster'):
             skinCluster = transform.getShape().listHistory(type='skinCluster')[0]
             if verbose: print 'Found skinCluster connected to transform: %s'%skinCluster
         else:
             pm.warning('no skinCluster found on transform %s'%transform)
             skinCluster = None
     if transform==None and skinCluster==None:
         pm.error('You have to specify either a skinCluster or a transform')
     #generating information
     self.skinCluster = skinCluster
     if self.skinCluster:
         self.node = self.skinCluster.node()
         self.shape = self.skinCluster.getGeometry()[0]
         self.transform = self.shape.getParent()
         self.outputMesh = self.skinCluster.getOutputGeometry()
         self.inputMesh = self.skinCluster.getInputGeometry()
         self.weights = self._convertWeightsToList( self.skinCluster.getWeights( self.shape ) )
         self.influences = self.skinCluster.getInfluence()
     else:
         self.node = None
         self.shape = None
         self.transform = None
         self.outputMesh = None
         self.inputMesh = None
         self.weights = []
         self.influences = []
开发者ID:AndresMWeber,项目名称:aw,代码行数:30,代码来源:lib_skinCluster.py


示例10: FindPVposition

def FindPVposition( objs=pm.ls(sl=True) ):

	if not len(objs) == 3:
		pm.error( 'ehm_tools...findPVposition: objs arguments takes exactly 3 objects. %s was given.'%len(objs) )

	base = objs[0]
	mid  = objs[1]
	tip  = objs[2]

	A = dt.Vector( pm.xform( base, q=True, t=True, ws=True ) )
	B = dt.Vector( pm.xform( mid, q=True, t=True, ws=True ) )
	C = dt.Vector( pm.xform( tip, q=True, t=True, ws=True ) )

	AC = C - A
	AB = B - A

	D =  A + ( (dt.dot(AB,AC.normal()))  * AC.normal() ) # AB projected on AC

	position =  B + B - D
	
	if (position[0]  - B[0] < 0.001) and (position[1]  - B[1] < 0.001) and (position[2]  - B[2] < 0.001):
		pm.warning( 'ehm_tools...FindPVposition: Limbs were straight. None was returned!' )
		return None
	else:
		return position
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:25,代码来源:findPVposition.py


示例11: create_follicle

def create_follicle(transform, name=None, uPos=0.0, vPos=0.0):
    """ Create a follicle at u and v position (if polygon mesh, needs UV coords)
    Args:
        transform (pm.nt.Transform): PyNode transform of mesh
    Returns (pm.nt.Follicle): the resulting follicle
    Usage:
        create_follicle(pm.ls(sl=True)[0], uPos=0.5, vPos=0.5)
    """
    shape = transform.getShape()
    print type(shape) == pm.nodetypes.Mesh
    if type(shape) not in [pm.nodetypes.Mesh, pm.nodetypes.NurbsSurface]:
        pm.error("You need to specify a mesh of type nurbs or poly, incorrect mesh specified")
    if not name:
        name = transform.name() + "_FOL"
    follicle_shp = pm.createNode("follicle", name=name)
    follicle_xfm = follicle_shp.getParent()
    # One different connection for poly/nurbs then all connections
    # (The polygons will need to have UVs in order to work.)
    if type(shape) == pm.nodetypes.Mesh:
        shape.outMesh.connect(follicle_shp.inputMesh)
    else:
        shape.local.connect(shape.inputSurface)
    shape.worldMatrix[0].connect(follicle_shp.inputWorldMatrix)
    follicle_shp.outRotate.connect(follicle_xfm.rotate)
    follicle_shp.outTranslate.connect(follicle_xfm.translate)
    # Now setup attributes
    follicle_shp.parameterU.set(uPos)
    follicle_shp.parameterV.set(vPos)
    follicle_xfm.t.lock()
    follicle_xfm.r.lock()
    return follicle
开发者ID:creuter23,项目名称:tools,代码行数:31,代码来源:lib_fol.py


示例12: _attachRenderProxy

	def _attachRenderProxy( self, objects ):
		path = self.fileInput.text()
		proxy = []
		
		if os.path.isdir(path):
			for file in glob.glob(path+"/*.mib"):
				bipx = pm.createNode('mip_binaryproxy',n=file.split('/').pop().split('.')[0]+'_BINARYPROXY')
				bipx.object_filename.set(file)
				proxy.append(bipx)
		else:
			bipx = pm.createNode('mip_binaryproxy',n=path.split('/').pop().split('.')[0]+'_BINARYPROXY')
			bipx.object_filename.set(path)
			proxy.append( bipx )
			
		if not objects:
			for prx in proxy:
				objects.append(pm.polyCube())
				
		for arg in objects:
			if len(proxy)==0: pm.error('No proxies found in folder. Womp Womp.')
			elif len(proxy)>1:
				print 'more than one proxy'
				#turn the lo geometry shader on
				arg.miExportGeoShader.set(1)
				#connect the proxy to the lo's geo shader
				proxy[random.randint(0,len(proxy)-1)].outValue.connect(arg.miGeoShader, f=True)
			else:
				print 'one proxy'
				#turn the lo geometry shader on
				arg.miExportGeoShader.set(1)
				#connect the proxy to the lo's geo shader
				proxy.pop().outValue.connect(arg.miGeoShader, f=True)
开发者ID:creuter23,项目名称:tools,代码行数:32,代码来源:aw_binaryProxy.py


示例13: importMixamoFbx

    def importMixamoFbx(self):
        print "importMixamoFbx"
        pm.newFile(f=1)
        if self.fbxFile:
            if os.path.isfile(self.fbxFile):

                # import the FBX file
                pm.mel.eval('FBXImport -f "' + (self.fbxFile) + '"')
                # clean its namespace
                removeNamespace()
                # self.logger.info('Imported file %s',self.fbxFile)
                hips = pm.ls("Hips", type="joint")

                # add root joint for scale
                rootJnt = pm.joint(n="Root")
                pm.parent(hips[0], rootJnt)
                # self.logger.info('Added root joint %s',rootJnt)

                # clean up textures
                self.cleanUpTextures()
                pm.currentUnit(t="ntsc")
                # add shadow plane

                return 1
            else:
                pm.error("Fbx file %s doesn't exist" % self.fbxFile)
                return 0
        else:
            pm.error("No file was given")
            return 0
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:30,代码来源:zoobeMixamoBatchTest.py


示例14: _removeInBetweenNode

 def _removeInBetweenNode(self):
     args = pm.ls(sl=True)
     for arg in args:
         #store the connections
         arg_inputs_raw =  arg.listConnections(scn=True, s=False, p=True)
         arg_outputs = arg.listConnections(scn=True, d=False, p=True)
         print arg_outputs
         print arg_inputs_raw
         #check if there are no connections on either side
         if not len(arg_outputs) or not len(arg_inputs_raw):
             pm.error('Object is not connected on both sides numbnuts')
         #sort out unliked node types
         arg_inputs=[]
         for arg_input in arg_inputs_raw:
             for not_accept in ['initial', 'default']:
                 add=1
                 if not_accept in arg_input.name():
                     add=0
                     break
             if add: arg_inputs.append(arg_input)
             
         #remove the old connection input
         arg.listConnections(c=True,d=False,p=True)[0][0].disconnect()
         #connect the two originals if they're the same type
         print "input is %s, output is %s" % (arg_inputs[0], arg_outputs[0])
         print arg_inputs[0].type()
         print arg_outputs[0].type()
         if (arg_inputs[0].type() == arg_outputs[0].type()):
             arg_outputs[0].connect(arg_inputs[0], f=True)
         else: pm.error('Connections don\'t match!', sl=True)
开发者ID:AndresMWeber,项目名称:aw,代码行数:30,代码来源:aw_shaders.py


示例15: convertLightmapSequence

def convertLightmapSequence(ast, aet, res, occres, fileFormat, falloff=0.0):
	'''The first selected object will bake occlusion to it, with all other selected as inputs
	   It automatically bakes to the "maya/sourcimages/occlusionBake/" folder and auto-versions
	Args:
		ast (int): animation start time
		aet (int): animation end time
		res (int): resolution for the map to bake
		occres (int): resolution for the occlusion
		fileFormat (string): accepts: TIFF,IFF,JPG,RGB,RLA,TGA,BMP,HDR
		falloff (float): float for controlling AO falloff
	Returns (None)
	Example: convertLightmapSequence(1,5,256,32)
	'''
	sel=pm.ls(sl=True, type='transform')
	extension = {'TIFF':0,'IFF':1,'JPG':2,'RGB':3,'RLA':4,'TGA':5,'BMP':6,'HDR':7}
	pathBase = "/jobs/{JOB}/{SHOT}/{MAYA}/{OBJ}".format(JOB = os.getenv('JOB'),
														 SHOT = os.getenv('SHOT'),
														 MAYA='maya/sourceimages/occlusionBake',
														 OBJ=sel[0])
	
	#Create and add objects to the bakeSet
	if len(sel)>0:
		if not pm.objExists('tmpBakeSet'):
			bakeSet = pm.createNode('textureBakeSet', n='tmpBakeSet')
		else:
			bakeSet = pm.PyNode('tmpBakeSet')
	else:
		pm.error('No objects selected...')
	for obj in sel:
		bakeSet.add(obj.getShape())
	
	#Set the shit for the bakeSet
	bakeSet.xResolution.set(res)
	bakeSet.yResolution.set(res)
	bakeSet.colorMode.set(3)
	bakeSet.occlusionRays.set(occres)
	bakeSet.bakeToOneMap.set(1)
	bakeSet.fileFormat.set(extension[fileFormat])
	bakeSet.occlusionFalloff.set(falloff)
	
	#Version up the folder and now that's the pathBase
	if not os.path.exists(pathBase):
		os.makedirs(pathBase)
	folders = [folder for folder in os.listdir(pathBase) if os.path.isdir(os.path.join(pathBase, folder))]
	version = 'v%03d'% (len(folders)+1)
	if len(folders)==0:
		version = 'v001'
	pathLgt = os.path.join(pathBase,version)
	pathBase = os.path.join(pathBase,version,'lightMap')
	if not os.path.exists(pathBase):
		os.makedirs(pathBase)
	
	#Now finally bake
	for frame in range(ast,aet+1):
		bakeSet.prefix.set('occBake%04d'%frame)
		pm.currentTime(frame)
		pm.convertLightmap('initialShadingGroup', sel[0], camera='persp', prj=pathLgt, sh=True, bo=bakeSet)

	#Get dat selection bak
	pm.select(sel, r=True)
开发者ID:AndresMWeber,项目名称:aw,代码行数:60,代码来源:aw_convertLightmapSequence.py


示例16: setWeightsAtIndex

 def setWeightsAtIndex(self, index, weights, autoAddInfluence=True):
     ''' Returns the weight dict for the given index of the object (verts/cvs do not matter)
     Args:
         index (int): index of shape node component you want queried
         weights (list[list]): weights stored as: [[influence (string), weight (float)], w2...w(n)]
         autoAddInfluence (Boolean): detects whether influence wasn't added and auto-adds if not
     Returns:
         (dict): dictionary of {influence:weights}
     '''
     # TODO: allow this to input dict weights since that's way easier to manipulate.
     # Error checking
     if 0 > index or index > len(self.weights) -1:
         pm.error('Index does not exist on skinCluster for given shape')
     weightTotal=0
     for weight in weights:
         if not type(weight) == list: pm.error('Unsupported format for input weights, please read help')
         weightTotal+=weight[1]
     if weightTotal > 1:
         pass #this used to error check, but maya normalizes anyways.
         pm.warning('Your input weight values you surpassed 1, normalization will occur. Results may vary')
     component=None
     if self.shape.type() == 'nurbsCurve':
         component = self.shape.cv[index]
     if self.shape.type() == 'mesh':
         component = self.shape.vtx[index]
     
     if autoAddInfluence:
         for weight in weights:
             sourceInfluence = weight[0]
             if sourceInfluence not in self.influences:
                 self.addInfluence(sourceInfluence)
     pm.skinPercent(self.skinCluster, component, transformValue=(weights))   
     self._update()
     return True
开发者ID:AndresMWeber,项目名称:aw,代码行数:34,代码来源:lib_skinCluster.py


示例17: replaceSuffix

def replaceSuffix(suffix_replace, args=[], validSuffix=False):
    """
    Function: To remove a suffix and replace it
    State: validSuffix = False: do not attempt to validate the suffix, replace no matter
           validSuffix = True: check if the suffix is valid and replace suffix if it is or append suffix if not
    Returns: list or string depending on type(args)
    """
    outArgs = []
    if args == []:
        args = pm.ls(sl=True)
    # if it's not a string do this
    if not isinstance(args, basestring):
        for arg in args:
            # if the arg has no valid suffix (and we're checking for that), just append the suffix
            if detectSuffix(arg) == None and validSuffix:
                outArgs.append(arg + "_" + suffix_replace)
            else:
                outArgs.append("_".join(arg.split("_")[:-1]) + "_" + suffix_replace)
        return outArgs[0]
    # otherwise it's a string so do this
    elif isinstance(args, basestring):
        # if it has no valid suffix (and we're checking for that) just append it to the end
        if detectSuffix(args) == None and validSuffix:
            return args + "_" + suffix_replace
        # if it has no underscores
        elif len(args.split("_")) == 1:
            return args + "_" + suffix_replace
        # otherwise replace the suffix as normal
        else:
            return "_".join(args.split("_")[:-1]) + "_" + suffix_replace
    else:
        pm.error("Argument not a string or a list, please fix your codezz")
开发者ID:AndresMWeber,项目名称:aw,代码行数:32,代码来源:lib_naming.py


示例18: constraint_store

def constraint_store():
	filepath = os.path.basename( cmds.file(q=True, sn=True) )
	constraints_folder = os.path.join( pm.workspace( q=True, rd=True ), 'data/constraints/')
	if not os.path.exists(os.path.dirname(constraints_folder)):
		os.makedirs(os.path.dirname(constraints_folder))
	sel = pm.ls(sl=True)
	constraintFile=None
	if len(sel)==0:
		pm.error('Select something numbnuts!')
	for obj in sel:
		for child in obj.getChildren():
			type = pm.objectType(child)
			constraintString = None
			if 'Constraint' in type:
				constrainer = child.getWeightAliasList()[0].split('.')[1][:-2]
				#print 'Constraint found of type = %s on object: %s from object: %s' % (type, obj, constrainer)
				#print child.connections(p=True,c=True,d=True)
				if constraintString == None:
					constraintString = type+':'+constrainer+':'+obj
				else:
					constraintString = constraintString + ',' + type+':'+constrainer+':'+obj
				#print constraintString
			if constraintString:
				if constraintFile:
					constraintFile=constraintFile+'\n'+constraintString
				else:
					constraintFile=constraintString
	constraints_file = os.path.join(constraints_folder, gp.getuser(), (filepath[:-3]+'_'+time.strftime("%Y%m%dT%H%M%S")+'.constraints'))
	if not os.path.exists(os.path.dirname(constraints_file)):
		os.makedirs(os.path.dirname(constraints_file))
	with open(constraints_file, 'w') as f:
		f.write(constraintFile)
		print 'Successfully wrote constraints file:\n\t%s' % (constraints_file)
开发者ID:AndresMWeber,项目名称:aw,代码行数:33,代码来源:aw_constraintManage.py


示例19: rig_makeCtrlLabel

def rig_makeCtrlLabel(label):
	'''Creates a control that is displayed in customized choice of letters
	Args:
		label (string): the name of the desired control/visual display text
	Returns (pm.nt.Transform): returns the display control object
	Example Usage:
		rig_makeCtrlLabel("display")
	'''
	if not pm.objExists(label + "_CTRL"):
		txt_crv=pm.PyNode( pm.textCurves(ch=0,t=label,f="Courier")[0] )
		curves=[]
		i=1
		for crvShp in pm.ls(txt_crv.getChildren(ad=True), et="nurbsCurve"):
			crvTrm = crvShp.getParent()
			crvShp.getParent().setParent(w=True)
			pm.makeIdentity(crvShp.getParent(),apply=True,s=1,r=1,t=1,n=0)
			crvTrm.rename("display_%02d_CRV" % i)
			curves.append(crvTrm)
			i+=1
		displayCtrl=rig_combineCurves(curves,label+'_CTRL')
		pm.delete(txt_crv)
		displayCtrl.centerPivots()
		pm.move(displayCtrl, (0,0,0), rpr=True)
		pm.makeIdentity(displayCtrl,apply=True,s=1,r=1,t=1,n=0)
		displayGrp=pm.group(em=1,n=(label + "Offset_GRP"))
		displayCtrl.setParent(displayGrp)
		for displayCtrlShape in displayCtrl.listRelatives(shapes=True, fullPath=True):
			pm.setAttr(displayCtrlShape + ".overrideEnabled", 1)
			pm.setAttr(displayCtrlShape + ".overrideColor",17)
			
		rig_ctrlLock([displayCtrl], ["tx","ty","tz","rx","ry","rz","sx","sy","sz","v"], setKeyable=False, lock=True)
		return displayCtrl
	else:
		pm.error("That control already exists smarty pants!\n")
开发者ID:AndresMWeber,项目名称:aw,代码行数:34,代码来源:lib_mpc.py


示例20: vPrint

def vPrint(txt, verb=2, type=0):
    """global verbose print function
        # gVerb = 2 print each step
        # gVerb = 1 print problemes
        # gVerb = 0 print nothing
        # type = 0 print
        # type = 1 warning
        # type = 2 error
    """
    global gVerb
    if verb <= gVerb:
        
        # to properly distinguish probleme from everything else
        if verb == 1:
            start = '\t1# '
        else:
            start = '\t # '
        
        # and then print everything
        if type == 0:
            print start + txt
        elif type == 1:
            pmc.warning(start + txt)
        else:
            pmc.error(start + txt)
开发者ID:loichuss,项目名称:maya,代码行数:25,代码来源:vPrint.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python core.fileDialog2函数代码示例发布时间:2022-05-25
下一篇:
Python core.duplicate函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap