本文整理汇总了Python中pymel.core.confirmDialog函数的典型用法代码示例。如果您正苦于以下问题:Python confirmDialog函数的具体用法?Python confirmDialog怎么用?Python confirmDialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirmDialog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setColor
def setColor(color, *args):
# Get current AOV name
aov = pc.radioButtonGrp(uiWidgets['aovs'], q=1, select=1)
if aov == 1:
aovName = 'mtoa_constant_rgbMask'
elif aov == 2:
aovName = 'mtoa_constant_rgbMask1'
elif aov == 3:
aovName = 'mtoa_constant_rgbMask2'
elif aov == 4:
aovName = 'mtoa_constant_rgbMask3'
if aovName is None:
raise Exception('Error while determining which AOV to focus on.')
print "AOV Name: %s" % aovName
listSel = pc.ls(sl=1)
if len(listSel) == 0:
pc.confirmDialog(t="Error", message="Nothing selected.", icon='critical')
else:
for sel in listSel:
recursiveAssign(aovName, sel, color)
示例2: initGeometry
def initGeometry(self):
selection = m.ls(sl=True)
meshes = m.ls(
selection=True,
long=True,
dagObjects=True,
allPaths=True,
type='mesh',
noIntermediate=True
)
if meshes:
for mesh in meshes:
transform = com.getParent(mesh)
if transform:
self.backupers.append(backuper.Backuper(mesh, transform))
m.polyNormalPerVertex(mesh, ufn=True)
m.polySoftEdge(transform, a=180, ch=False)
geomProcessor = geom_processor.GeomProcessor(mesh)
geomProcessor.params = Parameters
self.processors.append(geomProcessor)
else:
pm.confirmDialog(
title='Error',
message='Invalid selection. Select at least one mesh.',
button=['OK'],
defaultButton='OK',
icon='critical'
)
return
m.select(selection, r=True)
示例3: replaceL2H
def replaceL2H(fr, to):
#把参考文件的低模, 替换成高模
#
#把字段f替换成t
#
#列出所有参考文件,存到以namespace为key的字典中
refs = pm.system.getReferences()
noH = []
for key, value in refs.items():
name_space = key
fileRef = value
#列出参考文件的路径和文件名
file_path = fileRef.path
file_name = file_path.name
#将带'_l_'标示的低模, 替换成带'_h_'标示的高模
if fr in file_name:
hf = file_name.replace(fr, to)
hd = file_path.replace(fr, to)
dir = pm.Path(file_path).dirname()
#如果服务器上有高模文件就进行替换, 没有就加入到一个列表里以便弹窗报错
if hf in [f.name for f in dir.files()]:
fileRef.replaceWith(hd)
else :
noH.append(file_path)
if noH :
pm.confirmDialog( title=u'提示', message='\n'.join(noH) + u'\n 没有"_h_"文件', button=[u'确认'])
else:
pm.confirmDialog( title=u'提示', message=u'完成', button=[u'确认'])
示例4: doIDShdNetwork
def doIDShdNetwork(*args):
## check if the shading network is existing
shdName = 'idSetup'
if( len( pm.ls(shdName + "_SHD") ) ) != 0:
pm.confirmDialog(t="Warning", message="The shader has been existed!", icon='warning')
return 0
# aiUserDataColor
dataColor = pm.shadingNode('aiUserDataColor', asUtility=True, name=shdName+'DataColor')
dataColor.colorAttrName.set('idcolor')
# aiUserDataString
dataString = pm.shadingNode('aiUserDataString', asUtility=True, name=shdName+'DataString')
dataString.stringAttrName.set('Id')
# aiWriteColor
writeColor = pm.shadingNode('aiWriteColor', asUtility=True, name=shdName+'WriteColor')
# aiUtility
aiIDShd = pm.shadingNode('aiUtility', asShader=True, name=shdName+'_SHD')
aiIDShd.shadeMode.set(2)
# connections
dataColor.outColor >> writeColor.input
dataString.outValue >> writeColor.aovName
writeColor.outColor >> aiIDShd.color
示例5: check_overlapping
def check_overlapping(anim_curves, choice, current_time, offset_val):
for anim_curve in anim_curves:
key_cnt = anim_curve.numKeys()
message = 'Some Keys are overlapping within Offset Value\n'
message += 'Do you want continue on Moving other Keys ?\n'
for i in range(0, key_cnt):
key_time = anim_curve.getTime(i)
if choice == 'forward':
if key_time <= current_time + offset_val:
range_dialog = pm.confirmDialog(title='Error',
message=message,
button=['Yes', 'No'],
cancelButton='No',
dismissString='No')
if range_dialog == 'Yes':
return 1
else:
raise RuntimeError('Move Keys process interrupted by User.')
if choice == 'back':
if key_time >= current_time + offset_val:
range_dialog = pm.confirmDialog(title='Error',
message=message,
button=['Yes', 'No'],
cancelButton='No',
dismissString='No')
if range_dialog == 'Yes':
return 1
else:
raise RuntimeError('Move Keys process interrupted by User.')
示例6: __init__
def __init__(self):
self.name = "MusterSubmitClass"
self.widgets = {}
self.pools = []
self.userPass = {}
self.renderers = []
self.cameras = pm.ls(ca = True)
self.scene = pm.sceneName()
self.priority = self.__class__.defaults['priority']
self.childrenTabs = []
self.startFrame = pm.SCENE.defaultRenderGlobals.startFrame.get()
self.endFrame = pm.SCENE.defaultRenderGlobals.endFrame.get()
self.mustertool = None
self._saveUser = None
self._saveRenderer = None
self._savePool = None
self.fileInfo = PT.PRAFileInfo(self.scene)
try:
self.output = os.path.join(self.__class__.renderDrive, self.fileInfo.getProject(), self.fileInfo.getEpShotName()).replace("\\","/")
except TypeError: #file info returned None
self.output = ''
try:
self._getData() #this bit is slow. use threadding maybe?
except:
pm.confirmDialog(title = "Confirm", Message = "Error connecting to muster database / executable. Speak to your IT helpdesk. \nContinuing using Demo mode", buttonm = ['OK'] )
示例7: populateList
def populateList():
# Get shader type
shaderSel = pc.radioButtonGrp(uiWidgets['shaderType'], q=1, select=1)
if shaderSel == 1:
shaderType = 'lambert'
elif shaderSel == 2:
shaderType = 'blinn'
elif shaderSel == 3:
shaderType = 'phong'
# Get shader prefix
shaderPrefix = pc.textField(uiWidgets['shadersPrefix'], q=1, text=1)
if len(shaderPrefix) == 0:
listShaders = pc.ls(exactType=shaderType)
else:
listShaders = pc.ls(shaderPrefix+'*', exactType=shaderType)
if len(listShaders) == 0:
pc.confirmDialog(t="Error", message="No shaders fitting the given paramaters has been found.", icon='critical')
exit(1)
elif len(listShaders) > 0:
pc.confirmDialog(t="Shaders found", message=str(len(listShaders))+" shader(s) found. Click confirm to continue.")
else:
exit("Unknown error.")
# for info in infos.keys():
# print "#######################"
# print "### Shader: '%s'" % info
# print " - Found %s shape(s)" % len(infos[info])
# print "Shapes list: %s " % infos[info]
return listShaders
示例8: doSaveAOVData
def doSaveAOVData(*args):
color_tag = [ ['obj_R',(1, 0, 0)], ['obj_G', (0, 1, 0)], ['obj_B', (0, 0, 1)], ['obj_W', (1, 1, 1)] ]
sceneAOVs = aovs.AOVInterface().getAOVNodes(names=True)
#// collect custom id AOVs
id_aov_sets = [ ( name, node ) for name, node in sceneAOVs if( name.find('id_') == 0 and node.hasAttr('isID') ) ]
aov_info = str()
for aov_name, aov_node in id_aov_sets:
aov_info += '\n'
for cl_attr, cl_val in color_tag:
# print '%s: %s, %s' % (aov_name, cl_attr, cl_val)
list_obj = pm.PyNode( aov_node + "." + cl_attr ).get().split(';')[:-1]
#// convert to a list to save out as a file
aov_info += ( aov_name + '.' + cl_attr + '--' + ';'.join(list_obj) + '\n' )
#// write to file
if( outputAOVLists(aov_info) == 0 ):
pm.confirmDialog( t='Cancel!', message='Svaing is cancel!', b=['OK'], icon='information' )
return 0
pm.confirmDialog( t='Save Complete!', message='Save AOVs Info is done!', b=['OK'], icon='information' )
return 1
示例9: setButtonPress
def setButtonPress(self, *args):
"""Sets the plane we'll be snapping to from the three selected vertices
Called by "set plane" button
"""
sel = pm.ls(selection=1, flatten=1)
if len(sel) ==3:
self.cleanUp()
pos1 = sel[0].getPosition()
pos2 = sel[1].getPosition()
pos3 = sel[2].getPosition()
vct1 = pos2-pos1
vct2 = pos3-pos1
# ^ is owerwritten to perform a cross product
self.normal = vct1 ^ vct2
self.normal.normalize()
self.position = pos1
pm.select(sel)
layerObj = pm.createDisplayLayer(name=self.layername, empty=1)
for i, vtx in enumerate(sel):
annotation = pm.annotate(vtx, tx="V%d" % (i+1), p=vtx.getPosition(space="world") )
annotation.setAttr("overrideEnabled", 1)
annotation.setAttr("overrideColor", 17)
annTrans = annotation.getParent()
annTrans.rename("annotateVts%d" % (i+1))
layerObj.addMembers(annTrans)
layerObj.addMembers(annotation)
layerObj.setAttr("displayType", 1)
else:
pm.confirmDialog(message="Please select exactly 3 vertices", title="Error", button="OK",
defaultButton="OK", dismissString="OK", cancelButton="OK")
示例10: replaceString
def replaceString(*args):
fileNodes = pc.ls(exactType='file')
# Get the search string
searchString = pc.textField(uiWidgets['searchField'], q=1, text=1)
# Get the replace string
replaceString = pc.textField(uiWidgets['replaceField'], q=1, text=1)
if len(searchString) == 0 or len(replaceString) == 0:
pc.confirmDialog(t="Error", message="Either the search or the replace string is empty. Try again.", icon='critical')
exit(1)
fileModified = 0
for node in fileNodes:
filePath = str(node.fileTextureName.get())
print "Found a file node: %s" % node
print "Current path is: %s" % filePath
if str(searchString) in filePath:
print "Found an occurence of the search string."
print type(filePath)
newFilePath = filePath.replace(searchString,replaceString)
print "Setting new path to: %s" % newFilePath
node.fileTextureName.set(newFilePath)
fileModified += 1
pc.confirmDialog(t="Success", message=str(fileModified)+" file(s) has been modified.")
示例11: delGroupId
def delGroupId():
model = MODELIntercept()
model.modelHistory()
for name in model.historyResult:
shape = pm.PyNode(name)
historyLst = shape.listHistory()
if len(historyLst) == 1 and historyLst[0] == shape:
pass
else :
sg = [h for h in historyLst if h.type() == "shadingEngine"]
if len(sg) == 1:
shaderLst = sg[0].surfaceShader.inputs()
if shaderLst:
try:
outAttrLst = shape.outputs(type = "shadingEngine", c = 1, p = 1)
osattr = outAttrLst[0][0]
odattr = outAttrLst[0][1]
newattr = pm.PyNode(".".join(osattr.name().split(".")[:-1]))
newattr >> odattr
except:
pass
inAttrLst = shape.inputs(type = "shadingEngine", c = 1, p = 1)
isattr = inAttrLst[0][1]
idattr = inAttrLst[0][0]
isattr // idattr
groupID = [g for g in historyLst if g.type() == "groupId"]
pm.delete(groupID)
pm.confirmDialog( title=u'提示', message=u'groupId清理完成', button=['OK'], defaultButton='OK')
示例12: simpleWarning
def simpleWarning(message, icon='information'):
pm.confirmDialog(
icon=icon,
title=SCRIPT_NAME,
message=message,
button=['Ok']
)
示例13: _prep
def _prep(self,args):
basename=self.inputName.getText()
nparticle=pm.ls(sl=True)[0]
if not pm.objExists(self.inputBar.getText()):
pm.error ('GEO plane doesn\'t exist')
geo = pm.PyNode(self.inputBar.getText())
if not isinstance(nparticle.getShape(), pm.nt.NParticle):
pm.error('Your selection is not an nParticle object')
#create an instancer
tempCube=pm.polyCube(n='temp_iinst_GEO',w=.01,h=.01,d=.01,ch=0)
self.instancer=pm.PyNode(pm.particleInstancer(nparticle,name=(nparticle.name().replace('_NPARTICLE','_INSTANCER')),addObject=True,object=tempCube[0],cycleStep=1,cycleStepUnits='Frames',levelOfDetail='Geometry',rotationUnits='Degrees',rotationOrder='XYZ',position='worldPosition',rotation='rotPP',scale='scalePP',objectIndex='indexPP'))
pm.delete(tempCube)
#group the nparticle + instancer
group=pm.group(n=(nparticle.name().replace('_NPATICLE','_lodA_GRP')))
nparticle.setParent(group)
self.instancer.setParent(group)
#nCache itR
if not pm.objExists( nparticle.name().replace('_NPARTICLE','_NUCLEUS') ):
pm.error('Nucleus doesn\'t exist!')
nucleus = nparticle.name().replace('_NPARTICLE','_NUCLEUS')
#delete everything unnecessary that might cause issues
print geo, nucleus
print 'issue?'
pm.delete(geo, nucleus)
print 'issue?'
pm.select(nparticle)
mm.eval('performCreateNclothCache 1 \"add\";')
pm.confirmDialog(m='WARNING, DO NOT SAVE AFTER THIS STEP',t='DONT SAVE!')
示例14: error_gui
def error_gui(message):
"""Simple gui for displaying errors
"""
pm.confirmDialog(
title=str('gozbruh Error:'),
message='\n' + str(message),
button=['Ok'])
示例15: doAddAOVAttr
def doAddAOVAttr(*args):
if( ( isSelEmpty() and isObjType() ) == False ):
return 0
aovName = pm.textFieldButtonGrp( 'txtBtnAddAttr', query=True, text=True )
if( len(aovName) == 0 ):
pm.confirmDialog( t='warning', message='AOV name field is empty!', icon='warning' )
return 0
for obj in sel:
if( not( obj.hasAttr(prefixAOV+'Id') ) ):
addUserAttr( obj, 'string' )
# add AOV name as Attribute
pm.PyNode( obj + '.' + prefixAOV + 'Id' ).set( 'id_'+aovName )
# skip loop if the input textfield is empty
if( len(aovName) == 0 ): continue
# add AOV render pass
# check if AOV already existing
if( len( pm.ls('aiAOV_id_'+aovName) ) == 0 ):
addAOV( aovName )
return 1