Hey Tomas, thanks for getting back.

I actually managed to get it working by using the following (too much?):

    model_panels = []
    focus_panel = cmds.getPanel(withFocus=True)
    # Check if current panel is a modelPanel
    if cmds.objectTypeUI(focus_panel) == "modelEditor":
        cmds.modelEditor(focus_panel, edit=True, imagePlane=True)
    else:
        for panel in cmds.lsUI(editors=True):
            if "modelPanel" in panel:
                model_panels.append(panel)

        for model_panel in model_panels:
            if cmds.modelEditor(model_panel, query=True, activeView=True):
                try:
                    cmds.modelEditor(model_panel, edit=True, 
imagePlane=True)
                except Exception as e:
                    pass

Basically it checks if the current focus panel is of modelPanel. If it is 
not, it will query all modelPanels and sets the main viewport (not the tear 
off etc)

If anyone has a better approach to this, do feel free to chip in :)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/365fea6f-4a0a-4ad8-831b-dd80bb545243%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to