def get_cur_model_panel():
u"""
获取当前显示视窗,如果没有则激活一个显示视窗并返回
Returns: PyNode-modelPanel
"""
model_panel_list = pm.getPanel(type="modelPanel")
visible_panel_list = pm.getPanel(vis=True)
cur_panel = [i for i in model_panel_list if i in visible_panel_list]
if cur_panel:
pm.setFocus(cur_panel[0])
return cur_panel
else:
fouces_panel = ''
for i in pm.getPanel(vis=True):
if i not in ['outlinerPanel1', 'scriptEditorPanel1']:
fouces_panel = i
break
if not fouces_panel:
fouces_panel = 'scriptEditorPanel1'
pm.modelPanel(model_panel_list[0], e=1, replacePanel=fouces_panel)
pm.setFocus(model_panel_list[0])
return model_panel_list
import maya.OpenMayaUI as omui
def set_display_mode_to_wireframe():
view = omui.M3dView.active3dView()
view.setDisplayStyle(omui.M3dView.kWireFrame, False)
set_display_mode_to_wireframe()