本文整理汇总了Python中pymel.core.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: rig_makeBlockGeo
def rig_makeBlockGeo(meshes, constrain=False, *args):
'''
Args:
meshes (list(pm.nt.Transform)): meshes to cut up
constrain (boolean): whether to constrain them or not
Returns:
list (pm.nt.Transform): list of block geometries created
Usage:
rig_makeBlockGeo(pm.ls(sl=True), constrain=True)
'''
blockgeos=[]
joints=[]
for mesh in meshes:
skinCluster = rig_getConnectedSkinCluster(mesh)
if skinCluster:
joints+= skinCluster.getWeightedInfluence()
if len(joints)==1:
dup=pm.duplicate(mesh, n=mesh.name().replace('GEO','BLOCKGEO'))[0]
blockgeos.append(dup)
rig_unlockTransform(dup)
pm.parentConstraint(joints[0], dup, mo=True)
else:
for joint in joints:
blockgeo = rig_makeBlockGeoFromJoint([mesh], joint)
if blockgeo:
if pm.objExists(blockgeo):
blockgeos+=blockgeo
pm.delete(blockgeo, ch=True)
if constrain:
for geo in blockgeo:
rig_unlockTransform(geo)
pm.parentConstraint(joint, geo, mo=True)
else:
pm.warning('No skinCluster detected on mesh %s' % mesh)
return blockgeos
开发者ID:AndresMWeber,项目名称:aw,代码行数:35,代码来源:lib_skinClusterFuncs.py
示例2: 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
示例3: getCurrentTranslator
def getCurrentTranslator(self, nodeName):
"""
get the current translator for this node, querying and setting the default if not yet set
"""
try :
# asString allows for enum attributes as well
transName = pm.getAttr(nodeName + ".aiTranslator", asString=True)
except :
transName = None
translators = self.getTranslators()
if not transName or transName not in translators:
# set default
transName = getDefaultTranslator(nodeName)
if transName is None:
if not translators:
pm.warning("cannot find default translator for %s" % nodeName)
return
transName = translators[0]
try :
pm.setAttr(nodeName + ".aiTranslator", transName)
except:
pm.warning("cannot set default translator for %s" % nodeName)
import traceback
traceback.print_exc()
return transName
开发者ID:Quazo,项目名称:breakingpoint,代码行数:25,代码来源:templates.py
示例4: ReverseShape
def ReverseShape( objs=None, axis='x' ):
scaleValue = ( -1, 1, 1 )
if axis == 'y':
scaleValue = ( 1, -1, 1 )
elif axis == 'z':
scaleValue = ( 1, 1, -1 )
elif axis != 'x':
pm.warning('Axis was not correct, used "x" axis instead.')
if objs == None:
objs = pm.ls( sl=True )
else:
objs = pm.ls( objs )
for obj in objs:
try:
shape = obj.getShape()
if shape.type() == 'mesh':
pm.select( shape.vtx[:] )
pm.scale( scaleValue )
pm.select( objs )
elif shape.type() == 'nurbsCurve':
pm.select( shape.cv[:] )
pm.scale( scaleValue )
pm.select( objs )
except:
pm.warning("Object doesn't have a shape. Skipped!")
'''
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:30,代码来源:reverseShape_backup.py
示例5: setWipFolder
def setWipFolder(self):
currentScene = pm.sceneName()
if currentScene:
projectPath,fileName = os.path.split(currentScene)
wipFolder = ''
try:
wipFolder = pm.fileDialog2(dir=projectPath,ds=2,fm=3,okc='Select Folder')[0]
except:
pm.warning('No folder was selected')
if wipFolder:
self.wipFolderEdit.setText(wipFolder)
self.wipFolderPath = wipFolder
self.bdPopulateFiles()
else:
projectPath = pm.workspace.path
charactersFolder = os.path.abspath(os.path.join(projectPath,'scenes','characters'))
path = ''
try:
path = pm.fileDialog2(dir=charactersFolder,ds=2,fm=3,okc='Select Folder')[0]
except:
pm.warning('No folder was selected')
if path:
self.wipFolderEdit.setText(path)
self.wipFolderPath = path
self.bdPopulateFiles()
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:26,代码来源:animToolUI.py
示例6: loadDeformerWeights
def loadDeformerWeights(filename=None):
'''
Usage:
loadDeformerWeights(filename='/jobs/mercedesFable_5402587/build/charTortoise/maya/export/WEIGHTS/tortoiseAFacial/extraWeights/deformerWeights/v03/deformerWeights.json')
loadDeformerWeights()
'''
if not filename:
try:
filename = pm.fileDialog2(cap='Select a json file you stored', fm=1, okc='Load', ff='JSON (*.json)')[0]
except:
pm.error('file not found, whatever.')
with open(filename, 'rb') as fp:
data = json.load(fp)
for key in data.keys():
if pm.objExists(key):
deformer = Deformer(pm.PyNode(key))
print 'Loading weights for deformer:\t%s'%deformer
for deformedShape in data[key].keys():
if pm.objExists(deformedShape):
print '\tLoading deformer weights on shape:\t%s'%deformedShape
deformedTransform = pm.PyNode(deformedShape).getParent()
#print data[key][deformedShape]
deformer.setWeights(data[key][deformedShape], deformedTransform)
else:
pm.warning('Object %s does not exist to apply deformer weights to...skipping'%deformedShape)
else:
pm.warning('Deformer %s doesn\'t exist...skipping'%key)
开发者ID:creuter23,项目名称:tools,代码行数:27,代码来源:lib_deformer.py
示例7: copyZoobeAnimations
def copyZoobeAnimations(self,zoobeChar):
print 'Importing Zoobe Animations'
if zoobeChar:
sourceChar = 'source:' + zoobeChar
fuseChar = self.name
rigFile = os.path.join(CHARACTERS_PATH,self.name,'rigging',self.name + '.ma')
zoobeCharFolder = os.path.join(ANIM_LIB_PATH,zoobeChar)
if os.path.isdir(zoobeCharFolder):
animFiles = [f for f in os.listdir(zoobeCharFolder) if (f.endswith('.ma') or f.endswith('.mb'))]
animFile = '/home/zoobe/mixamo/testproject/incoming/animLib/violet/violet_angry_action_01.ma'
#self.copyAnimation(animFile,sourceChar,fuseChar,0,300)
for anim in animFiles:
print animFile
animPath = os.path.join(zoobeCharFolder,anim)
print animPath
pm.openFile(animPath,f=1)
start = pm.playbackOptions(q=1,ast=1)
end = pm.playbackOptions(q=1,aet=1)
print start, end
self.copyAnimation(animPath,sourceChar,fuseChar,start,end)
print 'saving animation %s'%anim.split('.')[0]
self.saveAnimation(anim.split('.')[0])
else:
pm.warning('Did not find %s char folder'%zoobeChar)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:30,代码来源:zoobeMixamo.py
示例8: add_to_bake_layer
def add_to_bake_layer( layer = None, objects = None ):
# Get the node for the bake Layer
layer_node = get_bake_layer( layer )
if layer_node == None:
pmc.error( 'add_to_bake_layer requires one "BakeLayer" node.')
# get the list of nodes for the objects
if objects == None:
pmc.warning( 'No objects specified, using selection' )
obj_list = pmc.ls( sl = True, typ = 'transform' )
elif isinstance( objects, pmc.nt.Transform ):
obj_list = [ objects ]
elif isinstance( pmc.PyNode( objects ), pmc.nt.Transform ):
obj_list = [ pmc.PyNode( objects ) ]
elif isinstance( object, [ tuple, list ] ):
obj_list = objects
else:
pmc.error( 'Objects supplied for add_to_bake_layer command were invalid' )
if len( obj_list ) < 1:
pmc.error( 'No valid objects were supplied or selected for the bake_layer_command' )
# Make connections
for obj in obj_list:
multi_connect(layer_node, 'lm', obj, 'bake')
开发者ID:hunnybear,项目名称:xnormal_maya_plugin,代码行数:35,代码来源:utils.py
示例9: ec_zero
def ec_zero(attr="all"):
selection = mc.ls(sl=True, type='transform')
try:
if attr == "sx" or attr == "sy" or attr == "sz":
for i in range(0, len(selection)):
mc.setAttr(selection[i]+"."+attr, 1.0)
elif attr == "s":
for i in range(0, len(selection)):
mc.setAttr(selection[i]+"."+attr, 1, 1, 1, type="double3")
elif attr == "all":
for i in range(0, len(selection)):
listat = mc.listAttr(selection[i], v=True, k=True)
print "listat :"
if listat is None:
print "ERROR: listat is None : %s" % selection[i]
else:
for k in range(0, len(listat)):
if listat[k] == "scaleX" or listat[k] == "scaleY" or listat[k] == "scaleZ" or listat[k] == "scale" or\
listat[k] == "visibility":
mc.setAttr(selection[i]+"."+listat[k], 1.0)
else:
mc.setAttr(selection[i]+"."+listat[k], 0.0)
else:
if attr == "t" or attr == "r":
for i in range(0, len(selection)):
mc.setAttr(selection[i]+"."+attr, 0.0, 0.0, 0.0, type="double3")
else:
for i in range(0, len(selection)):
mc.setAttr(selection[i]+"."+attr, 0.0)
py.headsUpMessage("Reset: %s attribute of object %s" % (attr, selection))
except:
py.warning("ERROR: %s attribute of %s is locked or otherwise unavailable to reset" % (attr, selection[i]))
开发者ID:coxevan,项目名称:tech_art_tools,代码行数:32,代码来源:ecZeroChannel.py
示例10: uiAddWidgetSizeAnim
def uiAddWidgetSizeAnim(widget, onoff, size, size_offset=0):
size_anim = None
try:
print widget
size_anim = QtCore.QPropertyAnimation(widget, "geometry")
except:
pm.warning("Failed to create QPropertyAnimation ")
geometry = widget.geometry()
width = geometry.width()
x, y, _, _ = geometry.getCoords()
size_start = QtCore.QRect(x, y, width, int(not (onoff)) * size + size_offset)
size_end = QtCore.QRect(x, y, width, onoff * size + size_offset)
size_anim.setStartValue(size_start)
size_anim.setEndValue(size_end)
size_anim.setDuration(200)
size_anim_curve = QtCore.QEasingCurve()
if onoff:
size_anim_curve.setType(QtCore.QEasingCurve.InQuad)
else:
size_anim_curve.setType(QtCore.QEasingCurve.OutQuad)
size_anim.setEasingCurve(size_anim_curve)
return size_anim
开发者ID:Mortaciunea,项目名称:yart,代码行数:26,代码来源:utils.py
示例11: FindDeformers
def FindDeformers ( shape=None , type=''):
if shape==None:
obj = pm.ls(sl=True)[0]
shape = obj.getShape()
if shape :
# List Deformers
history = pm.listHistory( shape, pruneDagObjects=True, interestLevel=2 )
deformers = []
for node in history :
nodeTypes = pm.nodeType( node, inherited=True )
if 'geometryFilter' in nodeTypes:
if type=='' and nodeTypes[1] != 'tweak' :
deformers.append(node)
elif nodeTypes[1] == type and nodeTypes[1] != 'tweak':
deformers.append(node)
return deformers
else:
pm.warning('No shape found.')
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:26,代码来源:findDeformers.py
示例12: RigFK
def RigFK( jnts=None, side='L', ctrlSize=1.0, stretch=True, color='r' ):
if not jnts:
jnts = pm.ls( sl=True )
else:
jnts = pm.ls( jnts )
# find color of the ctrls
color = 'y'
if side == 'L':
color = 'r'
elif side == 'R':
color = 'b'
shapes = []
for jnt in jnts:
if not jnt or not jnt.type()=='joint':
pm.warning('ehm_tools...RigFK: %s was not a joint, skipped!'%jnt)
shapes.append( (JntToCrv ( jnts = jnt , size = ctrlSize )).newShapes )
LockHideAttr( objs=jnt, attrs='t' )
LockHideAttr( objs=jnt, attrs='radius' )
if stretch == True:
# add length attribute and connect it to scale
pm.addAttr ( jnt , ln = "length" , at = "double" , min = 0 , dv = 1 , k = True )
jnt.length >> jnt.scaleX
LockHideAttr( objs=jnt, attrs='s' )
Colorize( shapes=shapes, color=color )
return shapes
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:35,代码来源:rigFK.py
示例13: save_poseDeformerList
def save_poseDeformerList(obj):
'''stores poseDeformer files for the curreitnnt object
Args:
obj (pm.PyNode): the object to get deformers from
Returns (boolean): whether the export worked on not
Usage:
save_poseDeformerList(pm.ls(sl=True)[0])
'''
poseDeformers = get_connectedPoseDeformers(obj)
if poseDeformers:
folder = os.path.join( environ.POSEDEFORMERS, obj )
versionFolder = lib_env.folder_detectVersions( folder, versionUp=True )
if versionFolder:
folder = versionFolder
else:
folder = os.path.join(folder, 'v001')
if not os.path.exists(folder):
os.makedirs(folder)
for poseDeformer in poseDeformers:
file = os.path.join(folder, poseDeformer+'.ma')
command = 'poseDeformer_export(\"%s\", \"%s\", -1)'%(poseDeformer,file)
print command
eval( command )
else:
pm.warning('Object %s has no pose deformers attached to it...'%obj)
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:aw_poseDeformer.py
示例14: 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
示例15: get_sel_nucleus
def get_sel_nucleus(self):
print 'get_sel_nuclues'
cmd = 'ls -sl -dag -lf -l -type nucleus'
self.Nucleus = pm.mel.eval(cmd)
if not self.Nucleus:
pm.warning('select some nuclues first.')
print self.Nucleus
开发者ID:hongloull,项目名称:digital37,代码行数:7,代码来源:ClothCache.py
示例16: _unbuild_modules
def _unbuild_modules(self, strict=False, **kwargs):
# Unbuild all children
for module in self.modules:
if not module.is_built():
continue
# If we are unbuilding a rig and encounter 'locked' modules, this is a problem
# because we cannot touch it, however we need to free the grp_anm and grp_rig to
# delete them properly.
# In that situation we'll unparent the module grp_anm and grp_rig node.
if module.locked:
if module.grp_anm and module.grp_anm.exists() and module.grp_anm.getParent() == self.grp_anm.node:
pymel.warning(
"Ejecting {0} from {1} before deletion".format(module.grp_anm.name(), self.grp_anm.name()))
module.grp_anm.setParent(world=True)
if module.grp_rig and module.grp_rig.exists() and module.grp_rig.getParent() == self.grp_rig.node:
pymel.warning(
"Ejecting {0} from {1} before deletion".format(module.grp_rig.name(), self.grp_rig.name()))
module.grp_rig.setParent(world=True)
else:
try:
module.unbuild(**kwargs)
except Exception, e:
self.error("Error building {0}. Received {1}. {2}".format(module, type(e).__name__, str(e).strip()))
traceback.print_exc()
if strict:
raise (e)
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:27,代码来源:classRig.py
示例17: checkAndLoadPlugin
def checkAndLoadPlugin(pluginName):
""" Checks and loads plugin with GUI dialogs """
if pm.pluginInfo(pluginName, query=True, loaded=True) == False:
ans = pm.confirmDialog(
title="Warning!!!",
message="%s not loaded,,, \n Do you wish to load it now?" % pluginName,
button=["YES", "NO"],
defaultButton="YES",
dismissString="NO",
)
if ans == "YES":
try:
pm.loadPlugin(pluginName)
return True
except RuntimeError:
pm.warning("%s plugin not found in path!" % pluginName)
pm.confirmDialog(
title="Warning!!!",
message="%s plugin not found!" % pluginName,
button=["OK"],
defaultButton="OK",
dismissString="OK",
)
return False # TODO : Raise Plugin Not Found Error!
if ans == "NO":
return False
开发者ID:atvKumar,项目名称:mkUtils,代码行数:26,代码来源:mkUtils.py
示例18: bdMirrorCon
def bdMirrorCon(self):
print 'Mirror Controller'
selection = pm.ls(sl=True)
if selection.count > 0:
for sel in selection:
if ('L_' in sel.name()) or ('R_' in sel.name()):
print sel.name()
conGrp = sel.getParent()
conGrpPos = conGrp.getTranslation(space='world')
conGrpRot = conGrp.getRotation(space='world')
exp = ['L_','R_']
if 'R_' in conGrp.name():
exp.reverse()
print exp
mirrorConGrp = pm.duplicate(conGrp,name = conGrp.name().replace(exp[0],exp[1]))[0]
mirroCon = mirrorConGrp.getChildren()[0]
mirroCon.rename(sel.name().replace(exp[0],exp[1]))
mirroCon.getShape().overrideColor.set(self.conColors[exp[1]])
mirrorConGrp.setTranslation([conGrpPos[0]*-1,conGrpPos[1],conGrpPos[2]])
mirrorConGrp.setRotation([conGrpRot[0],conGrpRot[1],conGrpRot[2]*-1])
else:
pm.warning( 'Central controller, no need (sic) to mirror it!')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:25,代码来源:bdAnimCon_beta.py
示例19: exportAnimation
def exportAnimation(self):
exportFolder = ASSETS_PATH + 'characters/' + self.name + '_std/animations/'
exportAnimationsPath = os.path.join(CHARACTERS_PATH ,self.name,'animation')
animFiles = []
if os.path.isdir(exportAnimationsPath):
animFiles = [f for f in sorted(os.listdir(exportAnimationsPath)) if f.endswith('.ma') or f.endswith('.ma') ]
else:
pm.warning('No animation files found, aborting!')
return
#self.logger.info('########### Exporting animations for OGRE ###########')
for anim in animFiles:
animFile = os.path.join(exportAnimationsPath,anim)
pm.openFile(animFile,f=1)
start = int(pm.playbackOptions(q=1,ast=1))
end = int(pm.playbackOptions(q=1,aet=1))
#ogreExport -all -outDir "P:/mixamo_character/assets/characters/EveBavaria_std/animations/" -skeletonClip "EveBavaria_action_unjured_walk_35" startEnd 0 34 frames sampleByFrames 1 -lu pref -scale 1.00 -skeletonAnims -skelBB -np bindPose
cmd = 'ogreExport -all -outDir "'+ exportFolder + '"'
cmd += ' -skeletonClip "' + anim.split('.')[0] + '"'
if 'speak' in anim:
cmd += ' startEnd 0 1'
else:
cmd += ' startEnd ' + str(start) + ' ' + str(end)
cmd += ' frames sampleByFrames 1 -lu pref -scale 1.00 -skeletonAnims -skelBB -np bindPose'
pm.mel.eval(cmd)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:26,代码来源:zoobeMixamo.py
示例20: bdCreateCircleCon
def bdCreateCircleCon(self):
print 'Circle Controller'
test = mui.MQtUtil.findControl('createConBtn1')
print test
animConName = self.bdGetConName()
if animConName != '':
conSize = self.inputConSize.text()
overrideColor = self.conColors[str(self.inputConSide.currentText())]
if not conSize:
conSize=1
selection = pm.ls(sl = True)
selPos = [0,0,0]
selRot = [0,0,0]
if selection:
selPos = selection[0].getTranslation(space='world')
selRot = selection[0].getRotation(space='world')
circleCon = pm.circle(n = animConName ,nr=(0, 1, 0), c=(0, 0, 0),radius=float(conSize) ) [0]
circleCon.getShape().overrideEnabled.set(1)
circleCon.getShape().overrideColor.set(overrideColor)
circleConGrp = pm.group(circleCon,name = circleCon.name() + '_GRP')
circleConGrp.setTranslation(selPos)
circleConGrp.setRotation(selRot)
else:
pm.warning('Need a name, aborting')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:28,代码来源:bdAnimCon_beta.py
注:本文中的pymel.core.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论