當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。