本文整理匯總了Python中maya.cmds.setFocus方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.setFocus方法的具體用法?Python cmds.setFocus怎麽用?Python cmds.setFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類maya.cmds
的用法示例。
在下文中一共展示了cmds.setFocus方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: node_select
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def node_select(selectpartslist):
newselectpartslist = []
for i in selectpartslist:
if cmds.objExists(i):
newselectpartslist.append(i)
else:
print 'No Object "'+i+'" !!!'
modi = cmds.getModifiers()
if modi == 0:
cmds.select(newselectpartslist, r=True)
elif modi == 1:
cmds.select(newselectpartslist, tgl=True)
elif modi == 5:
cmds.select(newselectpartslist, add=True)
elif modi == 4:
cmds.select(newselectpartslist, d=True)
#cmds.setFocus("MayaWindow")
示例2: getModelPanel
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def getModelPanel():
'''Return the active or first visible model panel.'''
panel = mc.getPanel(withFocus=True)
if mc.getPanel(typeOf=panel) != 'modelPanel':
#just get the first visible model panel we find, hopefully the correct one.
panels = getModelPanels()
if panels:
panel = panels[0]
mc.setFocus(panel)
if mc.getPanel(typeOf=panel) != 'modelPanel':
OpenMaya.MGlobal.displayWarning('Please highlight a camera viewport.')
return None
return panel
示例3: enter_widget
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def enter_widget(self):
""" set focuts to the panel under the cursor """
panel = cmds.getPanel(underPointer=True)
cmds.setFocus(panel)
self.setFocus()
示例4: test_parse_active_view
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def test_parse_active_view():
"""Parse active view works"""
# Set focus to modelPanel1 (assume it exists)
# Otherwise the panel with focus (temporary panel from capture)
# got deleted and there's no "active panel"
import maya.cmds as cmds
cmds.setFocus("modelPanel1")
options = capture.parse_active_view()
capture.capture(**options)
示例5: update_filter
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def update_filter(self, *args, **kwargs):
sender = kwargs['sender']
def filter_exp(x):
return sender.text in x
if sender.text:
self.collection.update_filter(filter_exp)
else:
self.collection.update_filter(None)
cmds.setFocus(self.window.main.flt.filter_text)
示例6: getCurrentCamera
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import setFocus [as 別名]
def getCurrentCamera():
'''
Returns the camera that you're currently looking through.
If the current highlighted panel isn't a modelPanel,
'''
panel = mc.getPanel(withFocus=True)
if mc.getPanel(typeOf=panel) != 'modelPanel':
#just get the first visible model panel we find, hopefully the correct one.
for p in mc.getPanel(visiblePanels=True):
if mc.getPanel(typeOf=p) == 'modelPanel':
panel = p
mc.setFocus(panel)
break
if mc.getPanel(typeOf=panel) != 'modelPanel':
OpenMaya.MGlobal.displayWarning('Please highlight a camera viewport.')
return False
camShape = mc.modelEditor(panel, query=True, camera=True)
if not camShape:
return False
camNodeType = mc.nodeType(camShape)
if mc.nodeType(camShape) == 'transform':
return camShape
elif mc.nodeType(camShape) in ['camera','stereoRigCamera']:
return mc.listRelatives(camShape, parent=True, path=True)[0]