本文整理汇总了Python中maya.cmds.promptDialog函数的典型用法代码示例。如果您正苦于以下问题:Python promptDialog函数的具体用法?Python promptDialog怎么用?Python promptDialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了promptDialog函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: newModule
def newModule():
# MODULE NAME
result = mc.promptDialog(
title='New Module Name',
message='Enter Name:',
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if result == 'OK':
name = mc.promptDialog(query=True, text=True)
else: return
filename = mc.fileDialog2(fileMode=1, caption="Select module File")[0]
modGrp = mc.group(em = 1, n = name)
mc.parent(modGrp, 'modules')
mc.setAttr((addString('Name',modGrp)), name, type = "string")
mc.setAttr((addString('Module_Path',modGrp)), filename, type = "string")
# GET THE SCRIPT OF THE MODULE
print getModuleScript(name)
launch()
开发者ID:bepsy3d,项目名称:frankenstein,代码行数:25,代码来源:frank.py
示例2: performTranferV1
def performTranferV1(self):
getMesh=cmds.ls(sl=1)
if len(getMesh)<2:
print "select a skinned mesh group and an unskinned target mesh group"
return
else:
pass
getMeshController=getMesh[0]
getMeshTarget=getMesh[1]
getChildrenController=cmds.listRelatives(getMeshController, c=1, typ="transform")
if getChildrenController==None:
getChildrenController=([getMeshController])
getChildrenTarget=cmds.listRelatives(getMeshTarget, c=1, typ="transform")
if getChildrenTarget==None:
getChildrenTarget=([getMeshTarget])
result = cmds.promptDialog(
title='find XML',
message="Enter path",
text="C:\Users\\"+str(getFolderName)+"\Documents\maya\projects\default\scenes\\",
button=['Continue','Cancel'],
defaultButton='Continue',
cancelButton='Cancel',
dismissString='Cancel' )
if result == 'Continue':
skinPath=cmds.promptDialog(q=1)
if skinPath:
pass
else:
print "nothing collected"
self.callJointsWin(getChildrenController, getChildrenTarget, skinPath)
开发者ID:edeglau,项目名称:storage,代码行数:30,代码来源:skinTransfer.py
示例3: make_geo_layer
def make_geo_layer(geos):
if not geos:
return False
print('// make_geo_layer(geos)->')
print(geos)
geos = mklist(geos)
# query user for input
answer = mc.promptDialog(title='Sharc Question',
message='Enter name for new geomtry matte render layer.',
text='NameMe_Matte')
print('// make_geo_layer:answer='+answer)
if answer == 'dismiss':
return False
else:
mc.promptDialog(q=1)
# create a render layer to store our work in
print('// make_geo_layer:geos->')
print(geos)
rl = createRenderLayer(geos,name=answer,nr=1,mc=1)
print('// made render layer ='+rl+'\n')
# make a SG, material, name it, color it
sg = sets(renderable=1,noSurfaceShader=1,empty=1,name='geo_shader_SG')
mat = shadingNode('surfaceShader',asShader=1)
mat.outColor >> sg.surfaceShader
mat = rename(mat,'geo_shader')
mat.setAttr('outColorR',1)
mat.setAttr('outColorG',1)
mat.setAttr('outColorB',1)
# assign new shader to the geos
for geo in geos:
sets(sg,forceElement=geo)
arnold_disable_all_aovs(rl)
return True
开发者ID:pinkwerks,项目名称:Maya-Scripts,代码行数:33,代码来源:makeBuffers.py
示例4: renameSelection
def renameSelection():
"""rename all the selected objects going 1 by 1"""
sel = mn.ls( sl = True )
for s in sel:
s() #select
mc.refresh()
result = mc.promptDialog(
title = 'Rename Object ' + s.name,
message = 'Enter Name:',
button = ['OK', 'Cancel','Stop'],
defaultButton = 'OK',
tx = s.name,
cancelButton = 'Cancel',
dismissString = 'Cancel')
if result == 'OK':
text = mc.promptDialog(query=True, text=True)
if '#' in text:
similars = mn.ls( text.replace( '#', '*' ) )
if not similars:
similars = []
s.name = text.replace( '#', str( len( similars ) ) )
else:
s.name = text
if result == 'Stop':
return
开发者ID:skarone,项目名称:PipeL,代码行数:25,代码来源:renamer.py
示例5: infoButton
def infoButton(*args):
cmds.promptDialog(
title='Info',
message='Info',
button=['OK'],
defaultButton='OK',
dismissString='OK')
开发者ID:ahamburger,项目名称:bedazzler,代码行数:7,代码来源:gui.py
示例6: Renameanim
def Renameanim(posefile,*args):
filename = os.path.basename(posefile).split('.')[0]
dirname = os.path.dirname(posefile)
seltab = mc.shelfTabLayout('Animation',q=1,st=1)
AnimRename = mc.promptDialog(
title='AnimRename',
message='AnimRename:',
text = filename,
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if AnimRename=='OK':
newanimname = mc.promptDialog (query=True, text=True)
renamanim= dirname+'/'+ newanimname+'.anim'
renamimag= dirname+'/'+ newanimname+'.bmp'
animimg = posefile.replace('.anim','.bmp')
print animimg
mc.sysFile(posefile,rename= renamanim)
mc.sysFile(animimg,rename= renamimag)
Refresh_UI(savepathini)
print'Anim name changed succesfully'
else:
return
mc.shelfTabLayout('Animation',e=1,st=seltab)
开发者ID:sid2364,项目名称:Maya_Python,代码行数:25,代码来源:SR_AnimPoseLib.py
示例7: checkin
def checkin():
print 'checkin'
saveFile() # save the file before doing anything
print 'save'
filePath = cmds.file(q=True, sceneName=True)
print 'filePath: '+filePath
toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
print 'toCheckin: '+toCheckin
if amu.canCheckin(toCheckin):
comment = 'Comment'
commentPrompt = cmds.promptDialog(
title='Comment',
message='What changes did you make?',
button=['OK','Cancel'],
defaultButton='OK',
dismissString='Cancel',
sf = True)
if commentPrompt == 'OK':
comment = cmds.promptDialog(query=True, text=True);
else:
return
amu.setComment(toCheckin, comment)
dest = amu.getCheckinDest(toCheckin)
saveFile()
cmds.file(force=True, new=True) #open new file
dest = amu.checkin(toCheckin) #checkin
else:
showFailDialog()
开发者ID:byu-animation,项目名称:relic-tools,代码行数:30,代码来源:maya_checkin.py
示例8: defaultButtonPush09
def defaultButtonPush09(*args):
Maximum = cmds.promptDialog(
title = "Maximum shots of Episode",
message = "(Total shot of Episode) Insert_number:",
button = ["OK", "Cancel"],
defaultButton = "OK",
cancelButton = "Cancel",
dismissString = "Cancel")
if Maximum == "OK":
text001 = cmds.promptDialog(query = True, text = True)
Num = 0
EPI = cmds.promptDialog(
title = "Episode",
message = "ep + insert number:",
button = ["OK", "Cancel"],
defaultButton = "OK",
cancelButton = "Cancel",
dismissString = "Cancel")
if EPI == "OK":
Episode = cmds.promptDialog(query = True, text = True)
for x in range(1, int(text001)+1):
Num = Num+1
AnimCachePath = "I:/bubblebathbay/episodes/%s/%s_sh%.3d/FX/publish/fx/" %(Episode,Episode,int(Num))
if os.path.exists(AnimCachePath):
if len(os.listdir(AnimCachePath)) != 0:
VersionFolder = [i for i in os.listdir(AnimCachePath) if i.startswith("v") and not i.endswith("-copy")]
LatestVersion = reduce(lambda a,b: a if int(a.strip("v")) > int(b.strip("v")) else b ,VersionFolder)
if len(os.listdir(AnimCachePath+LatestVersion))== 0:
print(Episode+"sh%.3d" %int(Num))
else:
print(Episode+"sh%.3d Empty or not Required" %int(Num))
else:
print(Episode+"sh%.3d Empty or not Required" %int(Num))
开发者ID:ChengJiunHao,项目名称:BBB_stuff,代码行数:34,代码来源:BBB_FX.py
示例9: selectByAttr
def selectByAttr(attr=''):
'''
Select nodes with the specified attribute
@param attr: Attribute to use a for the selection filter
@type attr: str
'''
# Check Attribute
if not attr:
result = mc.promptDialog( title='Select By Attribute',
message='Attribute:',
button=['Select','Cancel'],
defaultButton='Select',
cancelButton='Cancel',
dismissString='Cancel' )
if result == 'Select':
attr = mc.promptDialog(q=True,text=True)
# Check Attribute
if not attr: return
# Select By Attribute
sel = mc.ls('*.'+attr,o=True)
# Return Result
return sel
开发者ID:auqeyjf,项目名称:glTools,代码行数:27,代码来源:selection.py
示例10: StripAndPublishComponent
def StripAndPublishComponent(component):
"""Prior to publishing a guide component, save a temp version and strip it of locked nodes."""
if not cmds.objExists('rig_%s_guide' % component):
rigUtils.log('Object not found: rig_%s_guide' % component, 'e')
return
prompt = cmds.promptDialog(m='Enter comment', b=['OK', 'Cancel'], cb='Cancel', db='OK', t='Enter Comment')
if prompt == 'Cancel': return
comment = cmds.promptDialog(q=True, tx=True)
tmp = tempfile.mkstemp('.ma')[1]
rigUtils.log('Saving temp file for %s: %s' % (component, tmp))
cmds.file(rn=tmp)
cmds.file(s=True, f=True, typ='mayaAscii')
rigUtils.log('Removing lockNode commands from temp file: %s' % tmp)
tmp2 = tempfile.mkstemp('.ma')[1]
fin = open(tmp, 'r')
fout = open(tmp2, 'w')
# remove lockNode commands from ma file
for line in fin.readlines():
if 'lockNode' in line: continue
fout.write(line)
fin.close()
fout.close()
publishComponentGuide(component, tmp2, comment)
开发者ID:timm-gitHub,项目名称:fbRepo,代码行数:31,代码来源:bodyPublish.py
示例11: saveInPreWindow
def saveInPreWindow(nClothShapeName,charNameTarget):
"""创建预设保存窗口,输入预设名,保存预设
Description:
在预设保存窗口拿到用户输入的预设名,若预设名符合要求则保存预设
Arguments:
nClothShapeName:布料节点名称
charNameTarget:目标角色名
Returns:
无
"""
result = cmds.promptDialog(title = "Save Preset", message = "Char Preset Name:", button = ["Save", "Cancel"],
defaultButton = "Save", cancelButton = "Cancel", dismissString = "Cancel") #拿到用户所选择的按钮
if result == "Save":
presetName = cmds.promptDialog(query=True, text=True)
#
#对输入的预设名进行检查:
# 1、检查该预设名是否合理(只能是英文字母,不能含有下划线等符号);
# 2、检查预设名是否已经存在(maya自带该检查功能)
#
p = re.compile("^[A-Za-z]+$") #正则表达式,匹配所有英文字母
if not p.match(presetName):
cmds.confirmDialog(title = "Warning", message = "Please Input Letters(a-z A-Z) Only!", button = "OK", defaultButton = "OK")
saveInPreWindow(nClothShapeName,charNameTarget) #递归调用,重新创建预设保存窗体
else:
cPresetName = presetName + "_" + charNameTarget
savePresetP(nClothShapeName, cPresetName)
return cPresetName
开发者ID:chloechan,项目名称:clothAndHair,代码行数:30,代码来源:clothAndHairMag.py
示例12: setCutGeometry
def setCutGeometry(proxyList, cutGeo=[]):
"""
Set the cut geometry for the specified proxy bounds objects
@param proxyList: List of proxy objects to set cut geometry for.
@type proxyList: list
@param cutGeo: The cut geometry list to set for the specified proxy bounds objects. If empty, string dialog is provided.
@type cutGeo: list
"""
# Check Proxy List
if not proxyList: return
for proxy in proxyList:
if not isProxyBound(proxy):
raise Exception('Invalid proxy object "' + proxy + '"!')
if not cmds.objExists(proxy + '.cutGeometry'):
print('Adding "cutGeometry" attribute to proxy bounds object "' + proxy + '"')
cutGeoAttr([proxy])
# Check Cut Geometry List
if not cutGeo:
result = cmds.promptDialog(title='Set Cut Geometry',
message='Cut Geometry:',
button=['Set', 'Cancel'],
defaultButton='Set',
cancelButton='Cancel',
dismissString='Cancel')
if result == 'Set':
cutGeo = cmds.promptDialog(q=True, text=True)
if not cutGeo:
print('No valid cut geometry list provided!')
# Set Cut Geometry List
for proxy in proxyList:
cmds.setAttr(proxy + '.cutGeometry', str(cutGeo), type='string')
开发者ID:bennymuller,项目名称:glTools,代码行数:34,代码来源:proxyMesh.py
示例13: remapGeometry
def remapGeometry():
'''
'''
# Check Window
win = 'skinClusterDataUI'
if not mc.window(win,q=True,ex=True): return
# Check SkinClusterData
skinData = glTools.gl_global.glSkinClusterData
if not skinData: return
# Get User Selections
geo = ''
sel = mc.ls(sl=1,dag=True)
if not sel:
result = mc.promptDialog(title='Remap Geometry',message='Enter Name:',button=['Remap', 'Cancel'],defaultButton='Remap',cancelButton='Cancel',dismissString='Cancel')
if result == 'Remap':
geo = mc.promptDialog(q=True,text=True)
else:
print('User cancelled!')
return
else:
geo = sel[0]
# Remap Geometry
skinData.remapGeometry(geometry=geo)
# Refresh UI
reloadUI()
# Return Result
return geo
开发者ID:auqeyjf,项目名称:glTools,代码行数:32,代码来源:skinClusterData.py
示例14: setRootScale
def setRootScale(self) :
''' Menu callback '''
for rn in m.ls(type = 'peelSolveOptions') :
for skelRoot in m.getAttr("peelSolveOptions.rootNodes") :
if not m.objExists ( skelRoot ) :
m.warning("Could not find: " + str( skelRoot ))
continue
attr = skelRoot + ".mocapScale"
val = m.getAttr(attr) if m.objExists( attr ) else 1.0
ret = m.promptDialog(m="Scale for: " + str(skelRoot), text=str(val))
if ret != 'Confirm' :
print ret
continue
text = m.promptDialog(q=True, text=True)
try :
fval = float(text)
except ValueError :
m.warning("Invalid Value: " + str( text) )
continue
print "Setting scale attribute on: ", attr, "to", str(fval)
if not m.objExists( attr ) :
m.addAttr( skelRoot, sn='ms', ln='mocapScale', at='float')
m.setAttr( attr, keyable=True)
m.setAttr( attr, fval)
开发者ID:mocap-ca,项目名称:cleanup,代码行数:30,代码来源:loader.py
示例15: setAddGeometry
def setAddGeometry(proxyList,addGeo=[]):
'''
Set the add geometry for the specified proxy bounds objects
@param proxyList: List of proxy objects to set add geometry for.
@type proxyList: list
@param addGeo: The add geometry list to set for the specified proxy bounds objects. If empty, string dialog is provided.
@type addGeo: list
'''
# Check Proxy List
if not proxyList: return
for proxy in proxyList:
if not isProxyBound(proxy):
raise Exception('Invalid proxy object "'+proxy+'"!')
if not mc.objExists(proxy+'.addGeometry'):
print('Adding "addGeometry" attribute to proxy bounds object "'+proxy+'"')
addGeoAttr([proxy])
# Check Add Geometry List
if not addGeo:
result = mc.promptDialog( title='Set Add Geometry',
message='Add Geometry:',
button=['Set', 'Cancel'],
defaultButton='Set',
cancelButton='Cancel',
dismissString='Cancel' )
if result == 'Set':
addGeo = mc.promptDialog(q=True,text=True)
if not addGeo:
print('No valid add geometry list provided!')
# Set Add Geometry List
for proxy in proxyList:
mc.setAttr(proxy+'.addGeometry',str(addGeo),type='string')
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:proxyMesh.py
示例16: selToShelf
def selToShelf():
"""
Saves all the selected textScrollList attributes to the shelf to be keyframed.
"""
results = cmds.promptDialog(
title="Creating a shelf button.",
message="Enter Shelf Button Name:",
button=["OK", "Cancel"],
defaultButton="OK",
cancelButton="Cancel",
dismissString="Cancel",
)
fileName = cmds.promptDialog(query=True, text=True)
# if( results ):
# Get the current shelf
currentShelf = mel.eval(
"global string $gShelfTopLevel;\rstring $shelves = `tabLayout -q -selectTab $gShelfTopLevel`;"
)
# Compile the info from the textScrollList
# Get all the attrs from the textScrollList
selectedTSL = cmds.textScrollList("sbaKeyTSL", q=True, si=True)
# Calling my function to complies the attribute to be keyframed correctly.
keyFrameLines = compileKeyframes(selectedTSL)
# Create the shelfButton
cmds.shelfButton(l=fileName, iol=fileName, c=keyFrameLines, image="setKey.xpm", parent=currentShelf)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:31,代码来源:mclavan_fp_extra.py
示例17: Newtab
def Newtab(*args):
sel_tab = mc.shelfTabLayout('tabs',q=1,st=1)
crnt_tab= mc.shelfTabLayout(sel_tab,q=1,ca=1)
Newtab = mc.promptDialog(
title='Create New Tab',
message='New Tab Name:',
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if Newtab == 'OK':
n_text = mc.promptDialog(query=True, text=True)
if n_text == '':
mc.confirmDialog (title='Error' ,message= 'Sorry, The name entered is not valid', button=['OK'] ,defaultButton='Yes')
else:
if crnt_tab:
for each in crnt_tab:
if each == n_text:
mc.confirmDialog (title='Error' ,message= 'Sorry, The name entered is already exists', button=['OK'] ,defaultButton='Yes')
return
#else:
if sel_tab == 'Animation':
Nw_tab=savepathini+'Savepose/Animation/'+n_text+'/'
mc.shelfLayout(n_text,w=450,h=200,bgc=(0.3,0.3,0.3),p=Animation)
mc.sysFile(Nw_tab, makeDir=True )
else:
mc.shelfLayout(n_text,w=450,h=200,bgc=(0.3,0.3,0.3),p=Poses)
Nw_tab=savepathini+'Savepose/Poses/'+n_text+'/'
mc.sysFile(Nw_tab, makeDir=True )
mc.shelfTabLayout(sel_tab,e=1,st=n_text)
开发者ID:sid2364,项目名称:Maya_Python,代码行数:31,代码来源:SR_AnimPoseLib.py
示例18: ui
def ui():
result = cmds.promptDialog(
title='Retime Animation Curves',
message=('Enter new_frame/src_frame separated by a space.'+
'\n\nOn Frame X I want to see Frame Y = X/Y'),
button=['Selected', 'Scene', 'Cancel'],
defaultButton='Selected',
cancelButton='Cancel',
dismissString='Cancel')
if result == 'Cancel':
return
text = cmds.promptDialog(query=True, text=True)
print text
time_filter=[]
value_pairs = text.split(' ')
for value_pair in value_pairs:
values = value_pair.split('/')
pair = (float(values[0]),float(values[1]))
time_filter.append(pair)
if result == 'Selected':
selected(time_filter)
else:
scene(time_filter)
开发者ID:timmygaul,项目名称:animlib,代码行数:26,代码来源:retime.py
示例19: Renamepose
def Renamepose(read1,*args):
filename = os.path.basename(read1).split('.')[0]
print filename
dirname = os.path.dirname(read1)
seltab = mc.shelfTabLayout('Poses',q=1,st=1)
PoseRename = mc.promptDialog(
title='PoseRename',
message='PoseRename:',
text = filename,
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if PoseRename=='OK':
newposename = mc.promptDialog (query=True, text=True)
renampose= dirname+'/'+ newposename+'.anim'
renameimg= dirname+'/'+ newposename+'.bmp'
read2=read1.replace('.anim','.bmp')
mc.sysFile(read1,rename= renampose)
mc.sysFile(read2,rename= renameimg)
Refresh_UI(savepathini)
print'Pose name changed successfully'
else:
return
mc.shelfTabLayout('Poses',e=1,st=seltab)
开发者ID:sid2364,项目名称:Maya_Python,代码行数:25,代码来源:SR_AnimPoseLib.py
示例20: SetLights
def SetLights(self, *args):
#user input for which light rig
result = cmds.promptDialog(
title='Light Rig Name',
message='Enter Name:',
button=['OK', 'Cancel'],
defaultButton='OK',
cancelButton='Cancel',
dismissString='Cancel')
if result == 'OK':
text_input = cmds.promptDialog( query=True, text=True )
#create suffix list to hold camera names
name_suffix = []
#Iterate through the list and add the user input
for index in name_suffix:
n = cmds.ls( text_input+index[0:] )
try:
child = cmds.listRelatives( n, children=True )
if len(child) > 1:
print "Camera has constrain %s"%child[1]
else:
cmds.parentConstraint('CAM:POS',n)
print "Parent Constrain created"
except NameError:
cmds.confirmDialog( title='No Cameras', message='Reference Cameras first' )
cmds.confirmDialog(title='parentConstraint', message='Check Cameras')
开发者ID:blam4521,项目名称:Constrain-Tool,代码行数:33,代码来源:LightTool_01.py
注:本文中的maya.cmds.promptDialog函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论