本文整理汇总了Python中maya.cmds.control函数的典型用法代码示例。如果您正苦于以下问题:Python control函数的具体用法?Python control怎么用?Python control使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了control函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: open
def open():
'''
just a shortcut method to construct and display main window
'''
window = MainWindow.getInstance()
if cmds.control(MainWindow.DOCK_NAME,q=True,exists=True):
cmds.control(MainWindow.DOCK_NAME,e=True,visible=True)
else:
cmds.dockControl(MainWindow.DOCK_NAME,l=window.createWindowTitle(),content=MainWindow.WINDOW_NAME,
area='right',allowedArea=['right', 'left'],
width=window.preferedWidth.get(),
floating=window.preferedFloating.get(),
visibleChangeCommand=window.visibilityChanged)
if window.preferedFloating.get():
cmds.window(MainWindow.DOCK_NAME,e=True,
topEdge=window.preferedTop.get(),leftEdge=window.preferedLeft.get(),
w=window.preferedWidth.get(),h=window.preferedHeight.get())
Utils.silentCheckForUpdates()
# bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
cmds.evalDeferred(lambda *args: cmds.dockControl(MainWindow.DOCK_NAME,e=True,r=True));
# a bit of a fake, but can't find a better place for an infrequent save
LayerEvents.layerAvailabilityChanged.addHandler(window.savePrefs, MainWindow.DOCK_NAME)
return window
开发者ID:leandropim,项目名称:Tapp,代码行数:30,代码来源:mainwindow.py
示例2: create
def create(self):
if cmds.window(self.window, exists=True):
cmds.deleteUI(self.window);
self.window = cmds.loadUI(uiFile=self.uiFile, verbose=False)
cmds.showWindow(self.window);
try:
initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True )
if initPos[0] < 0:
initPos[0] = 0
if initPos[1] < 0:
initPos[1] = 0
cmds.windowPref( self.window, edit=True, topLeftCorner=initPos )
except :
pass
ctrlPath = '|'.join([self.window, 'radioButton']);
cmds.radioButton(ctrlPath, edit=True, select=True);
ctrlPath = '|'.join([self.window, 'groupBox_4']);
cmds.control(ctrlPath, edit=True, enable=False);
ctrlPath = '|'.join([self.window, 'groupBox_2', 'pushButton_7']);
cmds.button(ctrlPath, edit=True, enable=False);
ctrlPath = '|'.join([self.window, 'groupBox_2', 'lineEdit']);
cmds.textField(ctrlPath, edit=True, text="-u --oiio");
开发者ID:Quazo,项目名称:breakingpoint,代码行数:27,代码来源:txManager.py
示例3: findControlParent
def findControlParent(control='', split=3):
# split = which parent in full path to return
path = cmds.control(control, q=1, fpn=1)
stf = path.split('|')
tmp = stf[len(stf) - split]
result = cmds.control(tmp, q=1, fpn=1)
return result
开发者ID:boochos,项目名称:work,代码行数:7,代码来源:display_lib.py
示例4: changePrefix
def changePrefix(s, element, text):
text = text.strip().title()
if text and 2 < len(text) < 30 and "@" not in text:
cmds.layout(element, e=True, bgc=(0.3,1,0.3))
s.data["pref"] = text
s.save()
else:
cmds.control(element, e=True, bgc=(1,0.4,0.4))
开发者ID:internetimagery,项目名称:gameAnimExport,代码行数:8,代码来源:__init__.py
示例5: dockWindow
def dockWindow(window):
dWindow = "moduleManagerDockedWindow"
if cmds.dockControl(dWindow, exists=1):
cmds.deleteUI(dWindow)
formLayout = str(cmds.formLayout(parent=window))
cmds.dockControl(dWindow, allowedArea="all", content=formLayout, area="right", label=self.title)
cmds.control(window, p=formLayout, e=1, w=310)
cmds.setParent('..')
开发者ID:Phoenyx,项目名称:TruemaxScriptPackage,代码行数:9,代码来源:manager.py
示例6: hideUIElements
def hideUIElements():
global hiddenElements
global elementsToHide
for i in cmds.lsUI(ctl=True):
for e in elementsToHide:
if i.find(e) != -1 and cmds.control(i, q=True, visible=True):
hiddenElements.append(i)
#print "hiding... " + i
cmds.control(i, e=True, visible=False)
break
开发者ID:alaindomissy,项目名称:cadnano2,代码行数:10,代码来源:mayaUI.py
示例7: getViewSize
def getViewSize():
'''
Gets the size of the pane under the cursor and retruns
it as a array index 0 is x axis and index 1 is y axis
'''
viewPanel = cmds.getPanel(underPointer=True)
size = [0, 0]
size[0] = cmds.control(viewPanel, q=True, w=True)
size[1] = cmds.control(viewPanel, q=True, h=True)
return size
开发者ID:cmcpasserby,项目名称:pbTools,代码行数:10,代码来源:helpers.py
示例8: SundayUIToolsDockedOutliner
def SundayUIToolsDockedOutliner():
outlinerLayout = cmds.paneLayout(parent = mel.eval('$temp1=$gMainWindow'))
if cmds.dockControl('sundayOutlinerInTheDock', exists = True):
cmds.deleteUI('sundayOutlinerInTheDock')
outlinerDock = cmds.dockControl('sundayOutlinerInTheDock', width = 275, area = 'left', label = 'Outliner', content = outlinerLayout, allowedArea = [
'right',
'left'])
mel.eval('OutlinerWindow;')
cmds.control('outlinerPanel1Window', edit = True, parent = outlinerLayout)
开发者ID:elliottjames,项目名称:jeeves,代码行数:10,代码来源:SundayUIToolsPy.py
示例9: updateEnabled
def updateEnabled(self):
'''
triggers update on this action's enabled state, and updates controls with that state
'''
enabled = self.isEnabled()
for i in self.updateControls:
if i[1]:
cmds.menuItem(i[0],e=True,enable=enabled)
else:
cmds.control(i[0],e=True,enable=enabled)
开发者ID:leandropim,项目名称:Tapp,代码行数:11,代码来源:actions.py
示例10: SundayWarehouseBrowserDockedUI
def SundayWarehouseBrowserDockedUI():
if cmds.dockControl('sundayWarehouseBrowserDock', query = True, exists = True):
cmds.deleteUI('sundayWarehouseBrowserDock')
SundayWarehouseBrowserUI()
mainWindow = cmds.paneLayout(parent = mel.eval('$temp1=$gMainWindow'))
cmds.dockControl('sundayWarehouseBrowserDock', width = 275, area = 'right', label = 'Sunday | Warehouse Browser', content = mainWindow, allowedArea = [
'right',
'left'], backgroundColor = [
4.6007e+18,
4.6007e+18,
4.6007e+18])
cmds.control(warehouseBrowserUI, edit = True, parent = mainWindow)
开发者ID:elliottjames,项目名称:jeeves,代码行数:13,代码来源:SundayWarehousePy.py
示例11: __init__
def __init__(self, *args):
# first delete window if it already exists
if (cmds.window('MainWindow', exists=True)):
cmds.deleteUI('MainWindow')
path = os.path.dirname(__file__)
ui_file = path + '/ui/launcher.ui'
self.ui = cmds.loadUI(f=ui_file)
## Create dock layout and tell it where it can go
dockLayout = cmds.paneLayout(configuration='single', parent=self.ui)
cmds.dockControl(allowedArea='all', area='right', floating=True, content=dockLayout, label='RenderBOX 1.0 Launcher')
## parent our window underneath the dock layout
cmds.control(self.ui, e=True, parent=dockLayout)
cmds.button( "send_PB", edit=True, command=self.sendJob )
开发者ID:vfxpipeline,项目名称:RenderBOX,代码行数:13,代码来源:renderboxLauncher.py
示例12: setupScene
def setupScene(*args):
cmds.currentUnit(time = 'ntsc')
cmds.playbackOptions(min = 0, max = 100, animationStartTime = 0, animationEndTime = 100)
cmds.currentTime(0)
#check for skeleton builder or animation UIs
if cmds.dockControl("skeletonBuilder_dock", exists = True):
print "Custom Maya Menu: SetupScene"
channelBox = cmds.formLayout("SkelBuilder_channelBoxFormLayout", q = True, childArray = True)
if channelBox != None:
channelBox = channelBox[0]
#reparent the channelBox Layout back to maya's window
cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
#edit the channel box pane's attachment to the formLayout
cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
#print "deleting dock and window and shit"
cmds.deleteUI("skeletonBuilder_dock")
if cmds.window("SkelBuilder_window", exists = True):
cmds.deleteUI("SkelBuilder_window")
if cmds.dockControl("artAnimUIDock", exists = True):
channelBox = cmds.formLayout("ART_cbFormLayout", q = True, childArray = True)
if channelBox != None:
channelBox = channelBox[0]
#reparent the channelBox Layout back to maya's window
cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
#edit the channel box pane's attachment to the formLayout
cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
#print "deleting dock and window and shit"
cmds.deleteUI("artAnimUIDock")
if cmds.window("artAnimUI", exists = True):
cmds.deleteUI("artAnimUI")
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:51,代码来源:customMayaMenu.py
示例13: updateToTool
def updateToTool(self):
'''
update controls to current tool
'''
isPainting = self.isPainting()
cmds.control(self.cmdLayout.innerLayout,e=True,enable=isPainting)
cmds.button(self.cmdLayout.buttons[1],e=True,label="Flood" if isPainting else "Paint")
if (isPainting):
self.controls.brushRadiusSlider.setValue(cmds.artUserPaintCtx(self.TOOL_PAINT,q=True,radius=True))
self.controls.brushRadiusSlider.setEnabled(isPainting)
layersAvailable = LayerDataModel.getInstance().layerDataAvailable
cmds.layout(self.cmdLayout.buttonForm,e=True,enable=layersAvailable)
开发者ID:leandropim,项目名称:Tapp,代码行数:14,代码来源:tabPaint.py
示例14: createInfinityMM
def createInfinityMM():
# pmn = 'graphEditor1GraphEdanimCurveEditorMenu' # standard rmb popupmenu
gEd = 'graphEditor1GraphEd' # graph editor name
if not m.control( gEd, ex=1 ):
print ('the graph editor: ' + str(gEd) + ' does not (yet) exist!! :/')
return
# our new popup
pup = 'tweakGraphEditPopup'
if not m.popupMenu( pup, ex=1 ):
m.popupMenu( pup, parent=gEd, markingMenu=1, ctrlModifier=1 )
m.popupMenu( pup, edit=1, deleteAllItems=1 )
m.setParent( pup, menu=1 )
# display infinities checkbox
cmd = 'from maya.cmds import animCurveEditor; animCurveEditor( "' +gEd+ '", e=1, displayInfinities=int(not animCurveEditor( "' +gEd+ '", q=1, displayInfinities=1 )) )'
m.menuItem( 'displayInfinitiesMenuItem', label='Display Infinities', checkBox=m.animCurveEditor( gEd, q=1, displayInfinities=1 ), c=cmd, radialPosition='N' )
m.menuItem( 'preInfinityMenuItem', label='< Pre Infinity', subMenu=True, parent=pup ) # radialPosition='W'
m.menuItem( 'postInfinityMenuItem', label='Post Infinity >', subMenu=True, parent=pup ) # , radialPosition='E'
m.menuItem( 'bothInfinityMenuItem', label='< Both Infinity >', subMenu=True, parent=pup ) # , radialPosition='S'
infType = ['cycle', 'linear', 'constant', 'cycleRelative', 'oscillate']
itemList = ['preInfinityMenuItem', 'postInfinityMenuItem', 'bothInfinityMenuItem']
for i in range(3):
for type in infType:
cmd = 'from maya.cmds import setInfinity;'
if i != 0:
cmd += 'setInfinity( poi="' + type + '" );'
if i != 1:
cmd += 'setInfinity( pri="' + type + '" );'
m.menuItem( label=type, parent=itemList[i], c=cmd )
开发者ID:ewerybody,项目名称:melDrop,代码行数:32,代码来源:graph.py
示例15: __init__
def __init__(self, parent=get_maya_window()):
super(MTTViewer, self).__init__(parent)
if cmds.control(VIEWER_NAME, exists=True):
cmds.deleteUI(VIEWER_NAME, window=True)
self.parent = parent
self.setObjectName(VIEWER_NAME)
self.setWindowTitle(VIEWER_TITLE)
self.setWindowIcon(QIcon(WINDOW_ICON))
self.texture_path = None
self.texture_compare_path = None
self.is_mtt_sender = False
# UI variables
self.viewer_statusbar = None
self.graphics_view = None
self.channel_btn = dict()
self.fit_btn = None
self.reset_zoom_btn = None
self.toggle_tile_btn = None
self.toggle_compare_btn = None
self.toggle_picker_btn = None
self.settings_btn = None
# create UI
self.__create_ui()
# self.setMouseTracking(True)
# restore geometry
self.restoreGeometry(MTTSettings.value('Viewer/windowGeometry'))
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:32,代码来源:mttViewer.py
示例16: startUp
def startUp():
print( '########## mayaWrangler >>>>>>>>>>>>>>>>>>>>>>>>' )
# todo embedd in interface:
wantSecondsCurrentTimeField = 1
wantCurrentTimeFieldInt = 1
wantCurrentTimeToMinMaxPopup = 1
wantTweakGraphEditPopup = 1
wantShelfSwitcherMM = 1
if not m.layout( lyout, ex=1 ):
raise IOError, 'timeSlider layout: ' + lyout + ' does not exist (yet)! :/'
print ('check! layout: ' + str(lyout) + ' exists!')
if not m.control( currTimeField, ex=1 ):
raise IOError, 'currTimeField: ' + currTimeField + ' does not exist (yet)! :/'
print ('check! currTimeField: ' + str(currTimeField) + ' exists!')
if wantSecondsCurrentTimeField:
createSecondsCurrentTimeField()
if wantCurrentTimeFieldInt:
makeCurrentTimeFieldInt()
if wantCurrentTimeToMinMaxPopup:
addCurrentTimeToMinMaxPopup()
if wantTweakGraphEditPopup:
createTweakGraphEditPopup()
if wantShelfSwitcherMM:
import shelfSwitcher
shelfSwitcher.build()
print( '########## mayaWrangler <<<<<<<<<<<<<<<<<<<<<<<<<' )
开发者ID:ewerybody,项目名称:melDrop,代码行数:28,代码来源:mayaWranglerUI.py
示例17: view_outliner
def view_outliner(floating=False):
"""
Toggle the outliner on as a dock window to the right side of the viewport,
if floating is ture then toggle outliner to a floating window.
makes sure to delete the dockControl UI when visibility is lost to
ensure the name is available for maya.
.. old::
panel_window = 'outlinerPanel1Window'
if cmds.window(panel_window, q=True, exists=True):
cmds.deleteUI(panel_window, window=True)
else:
panel = cmds.getPanel(withLabel='Outliner')
cmds.outlinerPanel(panel, e=True, tearOff=True)
"""
# Constants
TABLAYOUT = "MAM_TAB_LAYOUT"
DOCK_CONTROL_OUTLINER = "MAM_DOCK_CONTROL_OUTLINER"
if not cmds.paneLayout(TABLAYOUT, q=True, ex=True):
cmds.paneLayout(TABLAYOUT, p="viewPanes") # mel.eval('$tmp = $gMainWindow'))
# Creat or show outliner.
if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, ex=True):
cmds.dockControl(
DOCK_CONTROL_OUTLINER,
label="Outliner",
width=280,
content=TABLAYOUT,
allowedArea=["left", "right"],
area="right",
)
# Tear it off or dock it depending on floating arg.
vis_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True)
fl_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, fl=True)
cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, fl=floating)
if vis_state and not fl_state == floating:
pass
else:
cmds.dockControl(
DOCK_CONTROL_OUTLINER, e=True, vis=not (cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True))
)
if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True):
try:
cmds.deleteUI(DOCK_CONTROL_OUTLINER)
except RuntimeError:
pass
else:
# Create outliner pane under tablayout if it's not there.
outliner_window = "outlinerPanel1Window"
if not cmds.control(outliner_window, q=True, ex=True):
panel = cmds.getPanel(withLabel="Outliner")
cmds.outlinerPanel(panel, e=True, p=TABLAYOUT)
# cmds.control(outliner_window, e=True, p=TABLAYOUT)
if floating:
cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, height=600)
开发者ID:arubertoson,项目名称:maya-mamtools,代码行数:60,代码来源:display.py
示例18: job
def job(scroll='', k=False):
import webrImport as web
ss = web.mod('selectionSet_lib')
# print '\n run job \n'
#
add = []
if scroll:
if cmds.control(scroll, ex=True):
cmds.textScrollList(scroll, edit=True, ra=True)
selection = cmds.ls(sl=True, fl=True) # returns full path if same object with dif namespace existskeys
if selection:
for sel in selection:
if '|' in sel:
sel = sel.split('|')
sel = sel[len(sel) - 1]
add.append(sel)
else:
add.append(sel)
add = ss.outputDict(add)
# keys or values
if k:
# add to list
cmds.textScrollList(scroll, edit=True, append=sorted(add.keys()))
else:
# add to list
cmds.textScrollList(scroll, edit=True, append=sorted(add.values()))
else:
pass
# message('no selection', warning=True)
else:
pass
开发者ID:boochos,项目名称:work,代码行数:31,代码来源:selectionUI_macro_lib.py
示例19: __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"};')
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:30,代码来源:cgmSetKey.py
示例20: __init__
def __init__(self):
"""
Initializes the pop up menu class call
"""
self.optionVars = []
self.IsClickedOptionVar = OptionVarFactory("cgmVar_IsClicked", "int", 0)
self.mmActionOptionVar = OptionVarFactory("cgmVar_mmAction", "int", 0)
self.setupVariables()
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()
self.IsClickedOptionVar.set(0)
self.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("cgm.setMenu failed!")
开发者ID:jakebarnwell,项目名称:PythonGenerator,代码行数:32,代码来源:cgmSetMenu.py
注:本文中的maya.cmds.control函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论