• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.getPanel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.getPanel函数的典型用法代码示例。如果您正苦于以下问题:Python getPanel函数的具体用法?Python getPanel怎么用?Python getPanel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getPanel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main(b_isolate=True):
	active_panel = cmds.getPanel(wf=True)
	model_panel  = cmds.getPanel(typ='modelPanel')
	src_panel    = None
	if active_panel and active_panel in model_panel:
		src_panel = active_panel
	
	if src_panel:
		iso_state = cmds.isolateSelect(src_panel, q=True, state=True)
		isExist   = True
		if b_isolate:
			if iso_state == False:
				isExist = False
				mel.eval('enableIsolateSelect "%s" 1;'%src_panel)
			selected = cmds.ls(sl=True)
			if selected:
				view_object = cmds.isolateSelect(src_panel, q=True, vo=True)
				if view_object:
					set_members = cmds.sets(view_object, q=True)
					if set_members == None:
						set_members = []
					for sel in selected:
						cmds.select(sel,r=True)
						if sel in set_members and isExist == True:
							cmds.isolateSelect(src_panel, rs=True)
						else:
							cmds.isolateSelect(src_panel, addSelected=True)
					cmds.isolateSelect(src_panel,u=True)
					cmds.select(selected, r=True)
		elif b_isolate == False and iso_state:
			cmds.isolateSelect(src_panel, state=False)
开发者ID:momotarou-zamurai,项目名称:kibidango,代码行数:31,代码来源:toggle_isolate_object.py


示例2: toggleObjectDisplay

def toggleObjectDisplay(purpose):

    # get active and find type of panel
    currentPanel = cmds.getPanel(withFocus=True)
    panelType = cmds.getPanel(to=currentPanel)

    if panelType == 'modelPanel':
        # all off
        cmds.modelEditor(currentPanel, e=True, alo=0)

        # arguments
        if purpose == 'anim':
            # specific on
            cmds.modelEditor(currentPanel, e=True, nurbsCurves=1)
            cmds.modelEditor(currentPanel, e=True, polymeshes=1)
            cmds.modelEditor(currentPanel, e=True, locators=1)
            cmds.modelEditor(currentPanel, e=True, cameras=1)
            cmds.modelEditor(currentPanel, e=True, handles=1)
            message('Panel display set for animation')
        elif purpose == 'cam':
            # specific on
            cmds.modelEditor(currentPanel, e=True, cameras=1)
            cmds.modelEditor(currentPanel, e=True, polymeshes=1)
            message('Panel display set for camera')
    else:
        message('Current panel is of the wrong type')
开发者ID:boochos,项目名称:work,代码行数:26,代码来源:display_lib.py


示例3: setThreePanelLayout

def setThreePanelLayout():     
    shotCamera = animMod.getShotCamera()
    if not shotCamera: shotCamera = "persp"
    mel.eval("toolboxChangeQuickLayoutButton \"Persp/Graph/Hypergraph\" 2;"+\
             #"ThreeTopSplitViewArrangement;"+\
             "lookThroughModelPanel %s hyperGraphPanel2;"%shotCamera+\
             "lookThroughModelPanel persp modelPanel4;")
             #"scriptedPanel -e -rp modelPanel2 graphEditor1;")
    viewports = [view for view in cmds.getPanel(type='modelPanel') if view in cmds.getPanel(visiblePanels=True)]
    defaultCameras = [u'front', u'persp', u'side', u'top']
    
    for view in viewports:
        camera          = utilMod.getCamFromSelection([cmds.modelEditor(view, query=True, camera=True)])
        cameraTransform = camera[0]
        cameraShape     = camera[1]
    
        if cameraTransform in defaultCameras:
            utilMod.animViewportViewMode(view)
            
            if cameraTransform == "persp":
                cmds.camera(cameraTransform, edit=True, orthographic=False)
                cmds.setAttr("%s.nearClipPlane"%cameraShape, 1000)
                cmds.setAttr("%s.farClipPlane"%cameraShape, 10000000)
                cmds.setAttr("%s.focalLength"%cameraShape, 3500)
        else:
            utilMod.cameraViewMode(view)
            cmds.setAttr("%s.displayFilmGate"%cameraShape, 1)
            cmds.setAttr("%s.overscan"%cameraShape, 1)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:28,代码来源:commandsMod.py


示例4: getPanel

def getPanel():
    isModelPanel = False
    panel = cmds.getPanel(withFocus=True)
    panelType = cmds.getPanel(typeOf=panel)
    if panelType == "modelPanel":   
        isModelPanel = True
    return isModelPanel, panel 
开发者ID:davidkaplan,项目名称:tippett-codesamples,代码行数:7,代码来源:playblast.py


示例5: view

 def view(self,opt):
     panels=mc.getPanel(vis=1)
     for pane in panels:
         if mc.getPanel(to=pane) == 'modelPanel' : 
             mc.modelEditor(pane,e=1,sel=True)
             mc.modelEditor(pane,e=1,sel=False)
             mc.modelEditor(pane,e=1,sel=True)
开发者ID:RobRuckus,项目名称:rcTools,代码行数:7,代码来源:rcMaya.py


示例6: isolate

	def isolate(self):
		"""isolate node in viewport"""
		currPanel = mc.getPanel( withFocus = True )
		panelType = mc.getPanel( to = currPanel )
		if panelType == 'modelPanel':
			self()
			mc.isolateSelect( currPanel, state = 1 )
开发者ID:skarone,项目名称:PipeL,代码行数:7,代码来源:mayaNode.py


示例7: desIsolate

def desIsolate():
	"""desisolate"""
	currPanel = mc.getPanel( withFocus = True );
	panelType = mc.getPanel( to = currPanel )
	if panelType == 'modelPanel':
		mc.isolateSelect( currPanel, state = 0 )
		mm.eval( 'enableIsolateSelect %s 0;'%currPanel )
开发者ID:skarone,项目名称:PipeL,代码行数:7,代码来源:utils.py


示例8: get_panel_type

def get_panel_type():
    '''
    returns type of panel under focus
    '''
    current_panel = cmds.getPanel(withFocus=True)
    current_panel_type = cmds.getPanel(typeOf=current_panel)
    return current_panel_type
开发者ID:Owacle,项目名称:maya-toolbelt,代码行数:7,代码来源:tool_belt.py


示例9: altFrame

def altFrame(*args):
    # cmds.nodeType(sel), object type
    # optimize, real slow
    pnl = cmds.getPanel(withFocus=True)
    typ = cmds.getPanel(typeOf=pnl)
    if typ == 'modelPanel':
        sel = cmds.ls(sl=True, fl=True)
        gs = ac.GraphSelection()
        locs = []
        if sel:
            for item in sel:
                if cmds.objectType(item, i='transform') or cmds.objectType(item, i='joint'):
                    loc = cn.locator(obj=item, ro='zxy', X=0.35, constrain=False, shape=False)[0]
                    locs.append(loc)
                else:
                    try:
                        print cmds.listRelatives(item, parent=True)[0], '_______________'
                        loc = cn.locator(obj=cmds.listRelatives(item, parent=True)[0], ro='zxy', X=0.35, constrain=False, shape=False)
                        print loc, '_____________________'
                        loc = loc[0]
                        locs.append(loc)
                    except:
                        message('didnt frame object: ' + item)
            cmds.select(locs)
            mel.eval("fitPanel -selected;")
            cmds.delete(locs)
            gs.reselect()
        else:
            message('select an object')
    else:
        mel.eval("fitPanel -selected;")
开发者ID:boochos,项目名称:work,代码行数:31,代码来源:display_lib.py


示例10: __set_renderer_by_str

    def __set_renderer_by_str(self, value):
        """
        This function sets the active rendere from it s string name
        @param value: str, the name of the rendere
        """
        currPanel = cmds.getPanel(withFocus = 1)
        panelType = cmds.getPanel(to = currPanel)

        if value in self.RENDERERS_SHORTCUT:
            #create the mel command to eval
            cmd = 'setRendererInModelPanel \"{r}\" {cp};'.format(
                r = self.RENDERERS_SHORTCUT[value] , 
                cp = currPanel)
            
            #make sure we have a model panel active
            if (panelType == "modelPanel"):
                mel.eval(cmd)
            else :
                OpenMaya.MGlobal.displayError("In order to set stuff" +
                " on the viewport we need an acive viewport")

        else :
            #print the error
            strSupp = [str(k) for k in self.RENDERERS_SHORTCUT.keys()]
            supp = "\n-" +"\n- ".join(strSupp)
            OpenMaya.MGlobal.displayError("You did not provide a valid " + 
                "renderer name, supported renderer names are :" + 
                " \n {r}".format(r = supp) + 
                " \n got {v}".format(v= type(value).__name__))        
开发者ID:Leopardob,项目名称:animShader,代码行数:29,代码来源:light_set.py


示例11: initializeCallback

    def initializeCallback(self):

        #get current model panel
        self.currentModelPanel = cmds.getPanel(wf = 1)
        if "modelPanel" not in self.currentModelPanel:
            self.currentModelPanel = cmds.getPanel(vis = 1)
            for i in self.currentModelPanel:
                if "modelPanel" in i:
                    self.currentModelPanel = i


        #try removing old callbacks from memory
        try:
            OpenMayaUI.MUiMessage.removeCallback(self.callBack)
        except:
            pass

        #create a callback that is registered after a frame is drawn with a 3D content but before 2D content
        self.callback = OpenMayaUI.MUiMessage.add3dViewPostRenderMsgCallback(self.currentModelPanel, self.update)
        self.view3D.refresh(True, True)

        #create QT maya window event filter
        main_window_ptr = OpenMayaUI.MQtUtil.mainWindow()
        self.qt_Maya_Window = wrapInstance(long(main_window_ptr), QtCore.QObject)
        self.qt_Maya_Window.installEventFilter(self.userKeyboardEvents) 

        #create viewport event filter
        active_view_ptr = self.view3D.widget()
        self.qt_Active_View = wrapInstance(long(active_view_ptr), QtCore.QObject)
        self.qt_Active_View.installEventFilter(self.userMouseEvents)

        cmds.inViewMessage( amg='<hl>Tool:</hl> Use <hl>"Esc"</hl> to cancel the tool', pos='botLeft', fade=True )

        print "Initialized..."
开发者ID:jonntd,项目名称:ViewportPainter,代码行数:34,代码来源:ViewportPainter.py


示例12: getCurrentCamera

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
    
    if mc.nodeType(camShape) == 'transform':
        return camShape
    elif mc.nodeType(camShape) == 'camera':
        return mc.listRelatives(camShape, parent=True)[0]
开发者ID:Bumpybox,项目名称:Tapp,代码行数:29,代码来源:ml_utilities.py


示例13: getCurrentModelPanel

 def getCurrentModelPanel():
     currentModelPanel = mc.getPanel(wf=True)
     if "modelPanel" not in currentModelPanel:
         currentModelPanel = mc.getPanel(vis=True)
         for each in currentModelPanel:
             if "modelPanel" in each:
                 currentModelPanel = each
     return currentModelPanel
开发者ID:csaez,项目名称:mscreen,代码行数:8,代码来源:mscreen.py


示例14: activePanel

def activePanel():
    fpanel = mc.getPanel( wf=1 )
    panelType = mc.getPanel( to=fpanel)
    if panelType == 'modelPanel':
        fpanel = mc.getPanel( wf=1 )
    else:
        fpanel = 'modelPanel4'
    return fpanel
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:8,代码来源:stereoPlayblast_final_01.py


示例15: activePanel

def activePanel():
    fpanel = mc.getPanel(wf=1)
    panelType = mc.getPanel(to=fpanel)
    if panelType == "modelPanel":
        fpanel = mc.getPanel(wf=1)
    else:
        fpanel = "modelPanel4"
    return fpanel
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:8,代码来源:stereoPlayblast_new_01.py


示例16: getCurrentCamera

	def getCurrentCamera(self):
		pan = mc.getPanel(wf=1)
		cam = ""
		if ( "modelPanel" == mc.getPanel(to=pan) ):
			cam = mc.modelEditor(pan,q=1,camera=1);
			print mc.nodeType(cam)
		if(cam == ""):
			return None
		return mn.Node( cam );
开发者ID:skarone,项目名称:PipeL,代码行数:9,代码来源:lighterHelperUI.py


示例17: turnOffCreateNewSetField

 def turnOffCreateNewSetField(self):
     
     if not cmds.columnLayout(self.createNewSetLayout, query=True, visible=True): return
     
     cmds.iconTextButton (self.plusBtn, edit=True, visible=True, w=25)
     cmds.columnLayout(self.createNewSetLayout, edit=True, visible=False, w=1) 
     viewports = [view for view in cmds.getPanel(type='modelPanel') if view in cmds.getPanel(visiblePanels=True)]
     if len(viewports) > 0: cmds.setFocus(viewports[0])
     self.adjustButtonsWidth() 
开发者ID:Italic-,项目名称:maya-prefs,代码行数:9,代码来源:selectSets.py


示例18: isolate

def isolate( node ):
	"""isolate node"""
	nod = mn.Node( node )
	nod()
	currPanel = mc.getPanel( withFocus = True );
	panelType = mc.getPanel( to = currPanel )
	if panelType == 'modelPanel':
		mc.isolateSelect( currPanel, state = 1 )
		mm.eval( 'enableIsolateSelect %s 1;'%currPanel )
开发者ID:skarone,项目名称:PipeL,代码行数:9,代码来源:utils.py


示例19: toggleGeo

def toggleGeo():
    pnl = cmds.getPanel(withFocus=True)
    if cmds.getPanel(to=pnl) == 'modelPanel':
        state = cmds.modelEditor(pnl, q=True, polymeshes=True)
        if state:
            cmds.modelEditor(pnl, e=True, polymeshes=0)
            # cmds.modelEditor(pnl, e=True, nurbsSurfaces=0)
        else:
            cmds.modelEditor(pnl, e=True, polymeshes=1)
开发者ID:boochos,项目名称:work,代码行数:9,代码来源:display_lib.py


示例20: frameGraphEditor

def frameGraphEditor(centerCurrentTime=False):
    '''
    If graph editor has focus, frame the selected or visible animation curves.
    '''
    
    panel = mc.getPanel(up=True)
    if not panel:
        panel = mc.getPanel(withFocus=True)
    if not panel:
        return False
    panelType = mc.getPanel(to=panel)
    if panelType != 'scriptedPanel':
        return False
    scriptedType = mc.scriptedPanel(panel, query=True, type=True)
    if scriptedType != 'graphEditor':
        return False
    
    graphEditor = panel+'GraphEd'
    
    keySel = utl.KeySelection()
    if keySel.selectedKeys():
        pass
    elif keySel.visibleInGraphEditor():
        pass
    
    if keySel.selected:
        times = keySel.getSortedKeyTimes()
        start = times[0]
        end = times[-1]
    else:
        keySel.frameRange()
        start = keySel._timeRangeStart
        end = keySel._timeRangeEnd
    
    values = sorted(keySel.keyframe(query=True, valueChange=True))
    minValue = values[0]
    maxValue = values[-1]
    
    if start == end:
        start = start-1
        end = end+1  
        
    if maxValue == minValue:
        minValue = minValue-0.5
        maxValue = maxValue+0.5
    
    #add a 10% padding 
    timePadding = (end-start)/10.0
    valuePadding = (maxValue-minValue)/10.0
    
    mc.animView(graphEditor, startTime=start-timePadding, endTime=end+timePadding, minValue=minValue-valuePadding, maxValue=maxValue+valuePadding)
    
    if centerCurrentTime:
        mc.animCurveEditor(graphEditor, edit=True, lookAt='currentTime')
    
    return True   
开发者ID:Italic-,项目名称:maya-prefs,代码行数:56,代码来源:ml_frameGraphEditor.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.gridLayout函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.getAttr函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap