本文整理汇总了Python中maya.cmds.control函数的典型用法代码示例。如果您正苦于以下问题:Python control函数的具体用法?Python control怎么用?Python control使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了control函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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");
示例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
示例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))
示例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('..')
示例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
示例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
示例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)
示例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)
示例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)
示例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 )
示例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")
示例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)
示例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 )
示例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'))