本文整理汇总了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]