当前位置: 首页>>代码示例>>Python>>正文


Python cmds.setFocus方法代码示例

本文整理汇总了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") 
开发者ID:mochio326,项目名称:SiShelf,代码行数:19,代码来源:synoptic.py

示例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 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:18,代码来源:ml_utilities.py

示例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() 
开发者ID:wiremas,项目名称:spore,代码行数:8,代码来源:canvas.py

示例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) 
开发者ID:abstractfactory,项目名称:maya-capture,代码行数:13,代码来源:tests.py

示例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) 
开发者ID:theodox,项目名称:mGui,代码行数:11,代码来源:boundCollection.py

示例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] 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:31,代码来源:ml_utilities.py


注:本文中的maya.cmds.setFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。