本文整理汇总了Python中maya.cmds.popupMenu函数的典型用法代码示例。如果您正苦于以下问题:Python popupMenu函数的具体用法?Python popupMenu怎么用?Python popupMenu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了popupMenu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aiSwatchDisplayNew
def aiSwatchDisplayNew(plugName) :
nodeAndAttrs = plugName.split(".")
node = nodeAndAttrs[0]
cmds.formLayout('swatchDisplayForm')
cmds.text('swatchLabel', label=aiSwatchLabel(node))
cmds.swatchDisplayPort('swatchDisplay',
wh=(64, 64), rs=64)
cmds.popupMenu('swatchPopup', button=3)
cmds.menuItem( 'swatchSmall', label='Small' )
cmds.menuItem( 'swatchMedium', label='Medium' )
cmds.menuItem( 'swatchLarge', label='Large' )
cmds.setParent(upLevel=True)
gTextColumnWidthIndex = mel.eval("$tempVar=$gTextColumnWidthIndex;")
cmds.formLayout('swatchDisplayForm',
edit=True,
af=[('swatchLabel',"top", 0),
('swatchLabel', "bottom", 0),
('swatchDisplay',"top", 0),
('swatchDisplay', "bottom", 0),],
aof=[('swatchLabel', "right", -gTextColumnWidthIndex)],
an=[('swatchLabel', "left"),
('swatchDisplay', "right")],
ac=[('swatchDisplay', "left", 5, 'swatchLabel')]
)
aiSwatchDisplayReplace(plugName)
示例2: __enter__
def __enter__(self):
'''
Initialize the UI
'''
if mc.window(self.name, exists=True):
mc.deleteUI(self.name)
mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
if self.menu:
self.createMenu()
self.form = mc.formLayout()
self.column = mc.columnLayout(adj=True)
mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2,
columnAlign2=('right','left'),
columnAttach=[(1, 'both', 0), (2, 'both', 8)] )
#if we can find an icon, use that, otherwise do the text version
if self.icon:
mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
else:
mc.text(label=' _ _ |\n| | | |')
if not self.menu:
mc.popupMenu(button=1)
mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
mc.text(label=self.info)
mc.setParent('..')
mc.separator(height=8, style='single')
return self
示例3: locatorParticlesUI
def locatorParticlesUI():
"""
"""
# Define window
locParticleUI = 'locatorParticleWindow'
if cmds.window(locParticleUI, q=True, ex=True): cmds.deleteUI(locParticleUI)
locParticleUI = cmds.window(locParticleUI, t='Generate Particles')
# UI Layout
cmds.columnLayout(adj=False, cal='left')
partiTFG = cmds.textFieldGrp('locParticle_particleTFG', label='Particle', text='', cw=[(1, 100)])
radiusFFG = cmds.floatSliderGrp('locParticle_radiusFSG', label='radius', f=True, min=0.1, max=10.0, fmn=0.01,
fmx=100.0, pre=2, v=1.0, cw=[(1, 100)])
rotateLocCBG = cmds.checkBoxGrp('locParticle_rotateCBG', label='Add rotatePP', ncb=1, v1=0, cw=[(1, 100)])
scaleLocCBG = cmds.checkBoxGrp('locParticle_scaleCBG', label='Add scalePP', ncb=1, v1=0, cw=[(1, 100)])
selfCollideCBG = cmds.checkBoxGrp('locParticle_selfCollideCBG', label='self collide', ncb=1, v1=0, cw=[(1, 100)])
cmds.button(l='Create Particles', c='glTools.tools.generateParticles.locatorParticlesFromUI()')
# Popup menu
cmds.popupMenu(parent=partiTFG)
for p in cmds.ls(type=['particle', 'nParticle']):
cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')
# Show Window
cmds.showWindow(locParticleUI)
示例4: createLayout
def createLayout(self):
mainLayout = cmds.rowLayout(numberOfColumns=6, parent=self.parentLayout)
#manipulator orientation
#cmds.iconTextButton("manipOrientButton", style='textOnly', label='-', h=self.hb, annotation="Selected objects", command=updateManipOrient)
#launchManipOrient()
self.autoSmartSnapKeys = AutoSmartSnapKeys()
self.selectionCounter = SelectionCounter()
#selection
cmds.iconTextButton("selectionCounterButton", style='textOnly', font="smallPlainLabelFont", label='0', h=self.hb, annotation="Selected objects")
cmds.popupMenu("selectionCounterButtonMenu", button=1, postMenuCommand=self.selectionCounter.populateMenu)
#animation crash recovery
cmds.image("animationCrashRecoveryLed", w=14, h=14, annotation="Test")
#menu
cmds.iconTextButton(style='iconOnly', w=self.wb, h=self.hb, image= uiMod.getImagePath("aTools"), highlightImage= uiMod.getImagePath("aTools copy"), annotation="aTools Menu")
self.popUpaToolsMenu()
self.update = Update()
self.update.about = self.about
self.update.checkUpdates(self, mainLayout)
# set default config and startup scripts
self.setDefaultConfig()
示例5: __init__
def __init__( self ):
baseMelUI.BaseMelWindow.__init__( self )
mel.zooVisManUtils()
mel.zooVisInitialSetup()
self.setSceneChangeCB( self.populate )
self.UI_form = cmd.formLayout(docTag=0)
self.UI_check_state = cmd.checkBox(v=self.state(), al="left", l="turn ON", cc=self.on_state_change)
self.UI_button_marks = cmd.button(l="bookmarks")
self.UI_tsl_sets = cmd.textScrollList(ams=1, dcc=self.on_collapse, nr=18, sc=self.on_select)
self.POP_marks = cmd.popupMenu(p=self.UI_button_marks, b=1, aob=1, pmc=self.popup_marks)
self.POP_marks_sh = cmd.popupMenu(p=self.UI_button_marks, sh=1, b=1, aob=1, pmc=self.popup_marks_add)
self.POP_sets = cmd.popupMenu(p=self.UI_tsl_sets, b=3, pmc=self.popup_sets)
self.reparentUI = None
cmd.formLayout(self.UI_form, e=True,
af=((self.UI_check_state, "top", 3),
(self.UI_check_state, "left", 3),
(self.UI_button_marks, "top", 0),
(self.UI_button_marks, "right", 0),
(self.UI_tsl_sets, "left", 0),
(self.UI_tsl_sets, "bottom", 0)),
ac=((self.UI_button_marks, "left", 5, self.UI_check_state),
(self.UI_tsl_sets, "top", 0, self.UI_button_marks)),
ap=((self.UI_tsl_sets, "right", 0, 100)) )
self.populate()
self.show()
示例6: addBaseBtn
def addBaseBtn(s, joint, parent):
def addNew():
s.setAttr(joint, POSITION)
s.setAttr(joint, ROTATION)
s.setAttr(joint, SCALE)
def addExisting():
if position: s.setAttr(joint, POSITION, [position])
if rotation: s.setAttr(joint, ROTATION, [rotation])
if scale: s.setAttr(joint, SCALE, [scale])
position = joint.get(POSITION, "")
rotation = joint.get(ROTATION, "")
scale = joint.get(SCALE, "")
position = position if cmds.objExists(position) else None
rotation = rotation if cmds.objExists(rotation) else None
scale = scale if cmds.objExists(scale) else None
btn = joint.btn["joint"] = cmds.button(
h=30,
bgc=COLOUR["blue"],
l=shorten(joint.name),
p=parent,
c=Callback(addNew)
)
cmds.popupMenu(p=btn)
if position or rotation or scale:
cmds.menuItem(l="Use existing targets", c=Callback(addExisting))
else:
cmds.menuItem(l="Select a target to pick it", en=False)
示例7: __init__
def __init__(self):
"""
Initializes the pop up menu class call
"""
self.optionVars = []
IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked', 0)
mmActionOptionVar = OptionVarFactory('cgmVar_mmAction',0)
panel = mc.getPanel(up = True)
if panel:
# Attempt at fixing a bug of some tools not working when the pop up parent isn't 'viewPanes'
if 'MayaWindow' in mc.panel(panel,q = True,ctl = True):
panel = 'viewPanes'
sel = search.selectCheck()
IsClickedOptionVar.set(0)
mmActionOptionVar.set(0)
if mc.popupMenu('cgmMM',ex = True):
mc.deleteUI('cgmMM')
if panel:
if mc.control(panel, ex = True):
try:
mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = panel,
pmc = lambda *a: self.createUI('cgmMM'))
except:
guiFactory.warning('Exception on set key marking menu')
mel.eval('performSetKeyframeArgList 1 {"0", "animationList"};')
示例8: __init__
def __init__( self, parentUi, sels ):
self.sels = sels
self.mainCmd = allCtlsCmd.CTL()
cmds.popupMenu( 'locusChrigPopup', e=1, deleteAllItems=1 )
self.mirrorType = 'object'
self.parentUi = parentUi
self.radialPosList = [ "N", "NE", "E", "SE", "S", "SW", "W", "NW" ]
示例9: addMirrorMeshCmd
def addMirrorMeshCmd(self, logicalIndex, *args ):
items = cmds.textScrollList( globalInfo.meshInfoInst._selMeshList, q=1, ai=1 )
if not items: return None
nodeName = amCmd.getBlendAndFixedShapeNode( items[0] )
targetName, driverInfo, returnIndex = amCmd.addMirrorTarget( items[0], logicalIndex )
cmds.setParent( self._scrollLay )
cmds.rowColumnLayout( nc=3, cw=[(1,25),(2,self._mainWidthList[0]-30),(3,self._mainWidthList[1]-30) ] )
cmds.button( l="X", c= partial( self.removeBlendMeshInfoElement, nodeName, logicalIndex ) )
meshNameField = cmds.textField( tx=targetName.replace( items[0]+'_', '' ), cc=partial( self.meshNameChangeCmd, nodeName, returnIndex ) )
self._meshNameList.append( meshNameField )
cmds.popupMenu( markingMenu = 1 )
cmds.menuItem( l='Edit Anim Curve', rp='W', c=partial( self.editAnimCurveCmd, nodeName, returnIndex ) )
cmds.menuItem( l='Edit Mesh',rp='N', c=partial( self.editAssigned, returnIndex) )
cmds.menuItem( l='Add Mirror Mesh',rp='E', c=partial( self.addMirrorMeshCmd, returnIndex) )
cmds.menuItem( l='Select Delta Points', rp='S', c=partial( self.selectDeltaPointsCmd, items[0], logicalIndex ) )
widthList = uifnc.setWidthByPerList( [50,50], self._mainWidthList[1] )
cmds.rowColumnLayout( nc=2, cw=[(1,widthList[0]),(2,widthList[1]-30)] )
for element in driverInfo:
engleName, value1, value2, value3= element
cmds.text( l= engleName )
cmds.floatFieldGrp( precision=2, nf=3, cw3=[50,50,50], v1=value1, v2=value2, v3=value3 )
cmds.setParent( '..' )
示例10: postMenuCommand
def postMenuCommand(*args):
"""
This function is passed to, and executed by the menu created via makePopup()
whenever the popupMenu is shown. It's what you'd update to have custom menu
items appear based on what's selected.
"""
# Delete all the items from any pre-existing menus:
if mc.popupMenu(POP_NAME, exists=True):
mc.popupMenu(POP_NAME, edit=True, deleteAllItems=True)
# Make our menu the current menu for any new children:
mc.setParent(POP_NAME, menu=True)
if mc.dagObjectHit(): # undocumented command!
# If the user has Alt+RMB'd over a node, capture the return of the
# function that overrides the dagMenuProc's popupMenu. The return is
# the full name of the node that has been Alt+RMB'd over... and use it as
# the label for the menu. Extract the leaf name from the full path:
fullObjectName = eval('overrideDagMenuProc()')
leafObjectName = fullObjectName.split("|")[-1]
mc.menuItem(label=leafObjectName)
# Here, any custom code can be authored that is based on the object name
# For example, track if there are any highlighted components:
componentPreSelect = mc.ls(preSelectHilite=True)
if len(componentPreSelect):
mc.menuItem(divider=True)
mc.menuItem(label=componentPreSelect[0])
else:
# Otherwise, no thing Alt+RMB'd on:
mc.menuItem(label="No object under cursor")
示例11: create
def create(self):
if cmds.window( self.winName, ex=1 ):
cmds.deleteUI( self.winName, wnd=1 )
cmds.window( self.winName, title= self.title )
cmds.columnLayout()
columnWidth = self.width - 2
firstWidth = ( columnWidth -2 )* 0.23
secondWidth = ( columnWidth -2 ) - firstWidth
cmds.rowColumnLayout( nc=1, cw=[(1,columnWidth)] )
cmds.text( l='', h=5 )
fd_cutName = cmds.textFieldGrp( l='Cut Path : ', cw=[(1,firstWidth),(2,secondWidth)],
cc=self.cmdChangeCutName )
pu_cutName = cmds.popupMenu()
cmds.text( l='', h=5 )
cmds.separator()
cmds.text( l='', h=5 )
fd_sceneName = cmds.textFieldGrp( l='Scene Path : ', cw=[(1,firstWidth),(2,secondWidth)],
cc=self.cmdChangeSceneName )
pu_sceneName = cmds.popupMenu()
cmds.window( self.winName, e=1,
w = self.width, h = self.height )
cmds.showWindow( self.winName )
self.fd_cutName = fd_cutName
self.pu_cutName = pu_cutName
示例12: modifySubdivisions
def modifySubdivisions(*args):
if cmds.objExists("CMForegroundPlane"):
if cmds.window("SubdivisionsTextWindow", query = True, exists = True):
cmds.deleteUI("SubdivisionsTextWindow")
SubdivisionTextClass.UpdateSubSnap()
if os.path.exists(SubdivisionTextClass.ImagePath):
cmds.window( "SubdivisionsTextWindow", title = "Subdivisions Text" )
cmds.formLayout("SubWriterLayout", numberOfDivisions=100, w = 740, h = 400)
cmds.picture( "BasePicture", image = SubdivisionTextClass.ImagePath )
cmds.editRenderLayerGlobals( currentRenderLayer = "Subdivision_0")
SubdivisionTextClass.subColor = cmds.getAttr("CMForegroundPlane.imageName")[-5]
cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
cmds.window( "SubdivisionsTextWindow", edit = True, w = 740, h = 400)
#Create popupMenu for images
cmds.popupMenu( "SubdivisionPopUp", parent = "BasePicture" )
cmds.menuItem( label='TopLeft' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "lt") )
cmds.menuItem( label='TopRight' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "rt") )
cmds.menuItem( label='BottomLeft' , p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "lb") )
cmds.menuItem( label='BottomRight', p = "SubdivisionPopUp", c = functools.partial(SubdivisionTextClass.ChangePos, "rb") )
cmds.menuItem( label='ToggleColor', p = "SubdivisionPopUp", c = SubdivisionTextClass.toggleSubdivisionColour )
cmds.showWindow("SubdivisionsTextWindow")
else:
cmds.confirmDialog(m = "The signature camera must be created before running this tool")
示例13: remapNamespaces
def remapNamespaces(self, *args):
winName = "remapNamespacesWindow"
if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName)
window = cmds.window( winName, title = "Remap Namespaces")
cmds.columnLayout(adjustableColumn=True)
cmds.rowColumnLayout( numberOfColumns=3)
animData = aToolsMod.loadInfoWithUser("copyPasteAnim", "animData")
inputNameSpaces = list(set(utilMod.getNameSpace(animData["objects"])[0]))
outputNameSpaces = utilMod.listAllNamespaces()
for loopNameSpace in inputNameSpaces:
nameSpace = loopNameSpace[:-1]
eval("cmds.text('input%s', align='right', w=150, h=26, label='%s: ')"%(nameSpace, nameSpace))
eval("cmds.textField('output%s', w=150, h=26, text='%s')"%(nameSpace, nameSpace))
eval("cmds.button('output%s', w=26, h=26, label='...')"%(nameSpace))
if outputNameSpaces:
cmds.popupMenu(button=1)
for loopOutput in outputNameSpaces:
cmds.menuItem ("menu%s"%loopOutput, label=str(loopOutput), command=lambda x, loopOutput=loopOutput, nameSpace=nameSpace, *args: self.setOutputValue(loopOutput, nameSpace))
cmds.setParent( '..' )
cmds.button(label="Paste Animation in Place", command=lambda *args: self.remapAndPasteAnimation(animData, inputNameSpaces, pasteInPlace=True))
cmds.button(label="Paste Original Animation", command=lambda *args: self.remapAndPasteAnimation(animData, inputNameSpaces, pasteInPlace=False))
cmds.showWindow( window )
示例14: show
def show( self ) :
if mc.window( self.win , exists=True ) :
mc.deleteUI( self.win )
mc.window( self.win , t='pkControlMaker' , rtf=True )
mc.columnLayout( '%sMainCL'%self.ui , adj=True )
mc.button( '%sCurveBUT'%self.ui , l='plus' , w=50 , h=100 , c=partial( self.createCurve ) )
mc.popupMenu()
labels = ( 'plus' , 'crossArrow' , 'circle' , 'cube' ,
'capsule' , 'stick' , 'doubleStick' , 'square' )
for label in labels :
mc.menuItem( l=label , c=partial( self.changeButLabel , label ) )
nc = 6
wid = 180
cw = ( wid / nc )
mc.rowLayout( numberOfColumns=nc , columnWidth6=(cw,cw,cw,cw,cw,cw) )
mc.button( w=cw , l='N' , c=partial(self.assignColor,'none') )
mc.button( w=cw , l='R' , bgc=[1,0,0] , c=partial(self.assignColor,'red') )
mc.button( w=cw , l='G' , bgc=[0,1,0] , c=partial(self.assignColor,'green') )
mc.button( w=cw , l='B' , bgc=[0,0,1] , c=partial(self.assignColor,'blue') )
mc.button( w=cw , l='Y' , bgc=[1,1,0] , c=partial(self.assignColor,'yellow') )
mc.button( w=cw , l='W' , bgc=[1,1,1] , c=partial(self.assignColor,'white') )
mc.showWindow( self.win )
mc.window( self.win , e=True , w=wid+8 )
mc.window( self.win , e=True , h=150 )
示例15: expose_component
def expose_component(self,tabAnchor,rootData):
attrib_link = rootData[0]
ctrlHgt = 24
nodeData = attrib_link.split('.')
typeChk = mc.attributeQuery( nodeData[-1], node=nodeData[0], attributeType=True )
numericType = ['float','double','short','long','int','bool','enum','string']
clm = mc.columnLayout( adjustableColumn=True, rs=5 ,p=tabAnchor, w=420 -30 )
stringType = mc.getAttr(attrib_link,type=True)
fildCaption = mc.textField( tx=rootData[1],ed=False,w=410 -30 ,p=clm , font="boldLabelFont",bgc=[0.8,0.8,0.8])
mc.popupMenu( button=3 ,p=fildCaption)
mc.menuItem(l='Open in connection Editor' )
if stringType == 'string':
attrFld = mc.textField( ed=True,w=410 -30 ,p=clm )
mc.connectControl( attrFld, attrib_link )
else:
if typeChk in numericType:
mc.attrFieldSliderGrp( attribute=rootData[0],p=clm )
else:
flw = mc.flowLayout( columnSpacing=4 , p=clm )
fldLnk = mc.textField( tx=rootData[0],ed=False ,w=385,h=ctrlHgt,p=flw)
mc.button( label='<',p=flw)