本文整理汇总了Python中maya.cmds.lsUI函数的典型用法代码示例。如果您正苦于以下问题:Python lsUI函数的具体用法?Python lsUI怎么用?Python lsUI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lsUI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: toggle_server
def toggle_server(self, arg=None):
if self.ServerStarted:
self.ServerStarted = False
self.timer.stop()
del self.timer
del self.receiver
if cmds.window(self.winName, exists=True):
cmds.intField(self.ui_oscport, edit=True, enable=True)
cmds.button(self.receiveButton, edit=True, label='Start Receiving')
for name in cmds.lsUI(type='shelfButton'):
if cmds.shelfButton(name, query=True, label=True) == 'NI mate receiver':
cmds.setParent('MayaWindow')
cmds.shelfButton(name, edit=True, enableBackground=False)
else:
self.receiver = NImateReceiver(self.osc_port)
self.timer = TimerObj(self.timer_exec)
self.ServerStarted = True
if cmds.window(self.winName, exists=True):
cmds.intField(self.ui_oscport, edit=True, enable=False)
cmds.button(self.receiveButton, edit=True, label='Stop Receiving')
for name in cmds.lsUI(type='shelfButton'):
if cmds.shelfButton(name, query=True, label=True) == 'NI mate receiver':
cmds.setParent('MayaWindow')
if self.record:
cmds.shelfButton(name, edit=True, enableBackground=True, backgroundColor=(1,0,0))
else:
cmds.shelfButton(name, edit=True, enableBackground=True, backgroundColor=(0,0.667,1))
开发者ID:Delicode,项目名称:NI-mate-plugins,代码行数:31,代码来源:NImateReceiverForMaya.py
示例2: mouseMoveEvent
def mouseMoveEvent(self, event):
#print 'Mouse Move'
if event.buttons() == QtCore.Qt.MiddleButton:
if not self.rect().contains(event.pos()):
#self.hide()
#self.parent().layout().removeWidget(self)
drag = QtGui.QDrag(self)
data = QtCore.QMimeData()
data.setText(self.text())
data.setImageData(self.icon().pixmap(32, 32, self.icon().Normal, self.icon().On))
drag.setMimeData(data)
drag.setPixmap(QtGui.QPixmap.grabWidget(self))
#drag.setPixmap(self.icon().pixmap(32, 32, self.icon().Normal, self.icon().On))
drag.setHotSpot(QtCore.QPoint(22, 22))
shelfButtons = set(cmds.lsUI(typ='shelfButton'))
dropAction = drag.exec_(QtCore.Qt.MoveAction|QtCore.Qt.CopyAction, QtCore.Qt.CopyAction)
new_buttons = list(set(cmds.lsUI(typ='shelfButton')).difference(shelfButtons))
if len(new_buttons) == 1:
button = new_buttons.pop()
print 'Dropped button!', button
else:
print 'Dropped', dropAction
#print dropAction
#print drag.target()
#print drag.target().objectName()
super(ShelfButton, self).mouseMoveEvent(event)
开发者ID:Temujin2887,项目名称:mlib,代码行数:30,代码来源:shelfbutton.py
示例3: uiCloseSceneUpdate
def uiCloseSceneUpdate( *args ):
existingWindows = cmds.lsUI( windows=1 )
for ui in sgBModel_editUi.targetWindowsClose_whenSceneUpdate:
if ui in existingWindows:
cmds.deleteUI( ui )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:7,代码来源:sgBExcute_startup.py
示例4: removeUiSeparateView
def removeUiSeparateView( cam ):
import sgBFunction_attribute
import sgBFunction_dag
uiPrefix = 'separatedViewCam_'
uis = cmds.lsUI( wnd=1 )
for ui in uis:
if not len( ui ) > len( uiPrefix ): continue
if ui[ : len( uiPrefix ) ] != uiPrefix: continue
cmds.deleteUI( ui, wnd=1 )
if not cmds.objExists( cam ): return None
for cam in cmds.ls( type='camera' ):
if not cmds.objExists( cam ): continue
cam = sgBFunction_dag.getTransform( cam )
sgBFunction_attribute.addAttr( cam, ln='filmTranslateCams', at='message' )
sgBFunction_attribute.addAttr( cam, ln='aniamtionCam', at='message' )
cons1 = cmds.listConnections( cam+'.filmTranslateCams', d=1, s=0 )
cons2 = cmds.listConnections( cam+'.aniamtionCam', d=1, s=0 )
if cons1: cmds.delete( cons1 )
if cons2: cmds.delete( cons2 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:sgBProject_coc.py
示例5: main
def main(log=None):
if not log:
import logging
log = logging.getLogger()
# use ' ' as a fill char and center aligned
log.debug('{0:-<40}'.format('remove_open_windows'))
wins = cmds.lsUI(wnd=True)
if wins:
for x in wins :
if ( cmds.window(x,q=True,vis=True) and x != 'MayaWindow' ) :
#print x
# remove scriptEditor will cause maya crash ,so set scriptEditorPanel1Window vis to false
if x != 'scriptEditorPanel1Window' :
try:
cmds.deleteUI(x,window=True)
except:
log.error('delete window %s error' % x)
log.error(traceback.format_exc())
else:
log.debug('delete window %s success' % x)
else:
# close scriptEditor
cmds.window(x,e=True,vis=False)
log.warning('close window %s' % x)
开发者ID:hongloull,项目名称:digital37,代码行数:25,代码来源:remove_open_windows.py
示例6: on_actionLoadAttributes_triggered
def on_actionLoadAttributes_triggered(self, clicked=None):
if clicked==None:return
mainChannelBox = 'mainChannelBox'
ChannelBoxs = mc.lsUI(typ='channelBox')
ChannelBoxs.remove(mainChannelBox)
if len(ChannelBoxs) == 0:return
DriverOBJ = mc.channelBox(mainChannelBox, q=True, mol=True)
DriverAttr = mc.channelBox(mainChannelBox, q=True, sma=True)
if not DriverOBJ or not DriverAttr:return
self.driverAttributelineEdit.setText('%s.%s'%(DriverOBJ[0], DriverAttr[0]))
DrivenOBJ = mc.channelBox(ChannelBoxs[0], q=True, mol=True)
DrivenAttr = mc.channelBox(ChannelBoxs[0], q=True, sma=True)
DrivenAttrList = []
for attribute in DrivenAttr:
DrivenAttrList.append('%s.%s'%(DrivenOBJ[0], attribute))
self.drivenAttributelineEdit.clear()
self.drivenAttributelineEdit.addItems(DrivenAttrList)
开发者ID:zclongpop123,项目名称:MPToolkit,代码行数:27,代码来源:quickSDKTool.py
示例7: lsUI
def lsUI( **kwargs ):
""" List UI elements as python wrapped types
:param kwargs: flags from the respective maya command are valid
If no special type keyword is specified, all item types will be returned
:return: list of NamedUI instances of respective UI elements """
long = kwargs.pop( 'long', kwargs.pop( 'l', True ) )
head = kwargs.pop( 'head', kwargs.pop( 'hd', None ) )
tail = kwargs.pop( 'tail', kwargs.pop( 'tl', None) )
if not kwargs:
kwargs = {
'windows': 1, 'panels' : 1, 'editors' : 1, 'controls' : 1,
'controlLayouts' : 1,'collection' : 1, 'radioMenuItemCollections' : 1,
'menus' : 1, 'menuItems' : 1, 'contexts' : 1, 'cmdTemplates' : 1 }
# END kwargs handling
kwargs['long'] = long
if head is not None: kwargs['head'] = head
if tail is not None: kwargs['tail'] = tail
# NOTE: controls and controlLayout will remove duplcate entries - we have to
# prune them ! Unfortunately, you need both flags to get all items, even layouts
# NOTE: have to ignore errors as there are still plenty of items that we cannot
# wrap
return wrapUI( set( cmds.lsUI( **kwargs ) ), ignore_errors = True )
开发者ID:adamcobabe,项目名称:mrv,代码行数:26,代码来源:base.py
示例8: clear_superflous_windows
def clear_superflous_windows(self, arg=None):
'''----------------------------------------------------------------------------------
This clears the interface of window clutter and puts display in wire to lower file load time
----------------------------------------------------------------------------------'''
windows = cmds.lsUI(wnd=1)
for eachWindow in closeWindow:
if eachWindow in windows:
windows.remove(eachWindow)
cmds.deleteUI(windows, window=1)
开发者ID:edeglau,项目名称:storage,代码行数:9,代码来源:MayaSelectArray.py
示例9: highlightCmdReporter
def highlightCmdReporter():
'''find cmdScrollFieldReporter and highlight it'''
mwin = getMayaWindowWidget()
cmdReporters = cmds.lsUI(type='cmdScrollFieldReporter')
if not cmdReporters: return
# only setup for the first one
cmdReporter = mwin.findChild(QtGui.QTextEdit, cmdReporters[0])
highlighter = Highlighter(parent=mwin)
highlighter.setDocument(cmdReporter.document())
开发者ID:iVerb,项目名称:myRandomStuff,代码行数:9,代码来源:cmdReporterHighlighter.py
示例10: getUI
def getUI(self,name):
items = cmds.lsUI(dumpWidgets=True)
for item in items:
if self._windowName in item:
self._objectList.append(item)
for item in self._objectList:
if item.endswith(name):
return item
print self._objectList
开发者ID:kanishk2391,项目名称:RenderQueue,代码行数:9,代码来源:RenderQueue_v02.py
示例11: 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
示例12: turnOffModelEditors
def turnOffModelEditors():
"""
Turns off all modelEditors in maya
"""
mel.eval('cycleCheck -e off;')
for editor in cmds.lsUI(panels = True):
if cmds.objectTypeUI(editor) == 'modelEditor':
logger.info('Turning off %s' % editor)
cmds.modelEditor(editor, edit = True, allObjects = False)
for editor in cmds.lsUI(editors = True):
if 'BB_myMayaEditor' in editor:
logger.info('Turning off %s' % editor)
## check for height fields that need to be turned of manually as they still display
heightFields = cmds.ls(type = 'heightField')
for eachHF in heightFields:
try:
cmds.setAttr('%s.visibility' % eachHF, 0)
except:
pass
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:21,代码来源:sg_asset_lib.py
示例13: clear_superflous_windows
def clear_superflous_windows(self, arg=None):
'''----------------------------------------------------------------------------------
This clears the interface of window clutter and puts display in wire to lower file load time
----------------------------------------------------------------------------------'''
windows = cmds.lsUI(wnd=1)
getDeleteWindows=((each) for each in windows if each not in closeWindow)
for each in getDeleteWindows:
try:
print each
cmds.deleteUI(each, window=1)
except:
pass
开发者ID:edeglau,项目名称:storage,代码行数:12,代码来源:RigToolKit.py
示例14: clearDock
def clearDock(dockName):
"""
Clear given dock layout
:param dockName: Dock layout name
:type dockName: str
"""
if dockName in mc.lsUI(type='dockControl'):
try:
mc.deleteUI(dockName)
except:
pass
开发者ID:snaress,项目名称:studio_dev,代码行数:12,代码来源:pUtil.py
示例15: turnOnModelEditors
def turnOnModelEditors():
"""
Turns on all modelEditors in maya
"""
for editor in cmds.lsUI(panels= True):
if cmds.objectTypeUI(editor)=='modelEditor':
print 'Turning on %s' % editor
cmds.modelEditor(editor, edit = True, allObjects = True)
for editor in cmds.lsUI(editors= True):
if 'BB_myMayaEditor' in editor:
print 'Turning on %s' % editor
cmds.modelEditor(editor, edit = True, allObjects = True)
cmds.modelEditor(editor, edit = True, allObjects = False)
## check for height fields that need to be turned of manually as they still display
heightFields = cmds.ls(type = 'heightField')
for eachHF in heightFields:
try:
cmds.setAttr('%s.visibility' % eachHF, 1)
except:
pass
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:21,代码来源:maya_asset_MASTERCLEANUPCODE.py
示例16: removeOpenWindows
def removeOpenWindows():
'''
hide open windows, ignore MayaWindow and nexFloatWindow
'''
ignore = ['MayaWindow', 'nexFloatWindow']
windows = mc.lsUI(wnd=True)
toRemove = [win for win in windows if win not in ignore]
for eachWin in toRemove:
if mc.window(eachWin, q=True, vis=True):
mc.window(eachWin, e=True, vis=False)
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:12,代码来源:__init__.py
示例17: toggleIcon
def toggleIcon(off=False):
p = Get()
# List shelf buttons
buttons = cmds.lsUI(type='shelfButton')
# interate through buttons to find one using appropriate images
for btn in buttons:
img = cmds.shelfButton(btn, q=1, image=1)
# toggle icon
if img in p.iconOff or img in p.iconOn:
if not off:
cmds.shelfButton(btn, edit=True, image=p.iconOff)
else:
cmds.shelfButton(btn, edit=True, image=p.iconOn)
开发者ID:boochos,项目名称:work,代码行数:13,代码来源:pairSelect.py
示例18: getShelfButtonsWithTag
def getShelfButtonsWithTag( tag ):
buttons = []
shelves = cmd.lsUI( cl=True, type='shelfLayout' ) or []
for shelf in shelves:
if not cmd.shelfLayout( shelf, ex=True ):
continue
shelfButtons = cmd.shelfLayout( shelf, q=True, ca=True ) or []
for button in shelfButtons:
if cmd.control( button , ex=True ):
if control( button, q=True, docTag=True ) == buttonTag:
buttons.append( button )
return buttons
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:14,代码来源:triggeredUI.py
示例19: p4ProjectMenu
def p4ProjectMenu(*args):
#clear any projects that are in the collection first
items = cmds.lsUI(menuItems = True)
for i in items:
data = cmds.menuItem(i, q = True, docTag = True)
if data == "P4Proj":
cmds.deleteUI(i)
#find projects
toolsPath = cmds.internalVar(usd = True) + "mayaTools.txt"
if os.path.exists(toolsPath):
f = open(toolsPath, 'r')
mayaToolsDir = f.readline()
f.close()
projects = os.listdir(mayaToolsDir + "/General/Scripts/")
p4Projects = []
#Test_Project_Settings
for proj in projects:
if proj.rpartition(".")[2] == "txt":
if proj.partition("_")[2].partition("_")[0] == "Project":
p4Projects.append(proj)
#set the current project
try:
f = open(mayaToolsDir + "/General/Scripts/projectSettings.txt", 'r')
settings = cPickle.load(f)
f.close()
currentProj = settings.get("CurrentProject")
except:
pass
#add the projects to the menu
for proj in p4Projects:
projectName = proj.partition("_")[0]
if projectName == currentProj:
val = True
else:
val = False
menuItem = cmds.menuItem(label = projectName, parent = "perforceProjectList", cl = "perforceProjectRadioMenuCollection", rb = val, docTag = "P4Proj", c = partial(setProj, projectName))
cmds.menuItem(parent = "perforceProjectList", optionBox = True, c = partial(editProj, projectName))
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:48,代码来源:customMayaMenu.py
示例20: setViewportQuality
def setViewportQuality():
global modelEditors
global backgroundColors
backgroundColors.append(cmds.displayRGBColor('background',q=True))
backgroundColors.append(cmds.displayRGBColor('backgroundTop',q=True))
backgroundColors.append(cmds.displayRGBColor('backgroundBottom',q=True))
cmds.displayRGBColor('background', 1, 1, 1)
cmds.displayRGBColor('backgroundTop', 0.762112, 0.87892, 1)
cmds.displayRGBColor('backgroundBottom', 1, 1, 1)
for i in cmds.lsUI(panels=True):
if cmds.modelEditor(i, query=True, exists=True):
sts = cmds.modelEditor(i, query=True, stateString=True)
sts = sts.replace("$editorName", i)
modelEditors.append(sts)
cmds.modelEditor(i, edit=True, displayAppearance="smoothShaded", lineWidth=2)
开发者ID:alaindomissy,项目名称:cadnano2,代码行数:16,代码来源:mayaUI.py
注:本文中的maya.cmds.lsUI函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论