Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5788

Toggle all panels script

$
0
0

@arch wrote:

I made a python script to toggle all currently open panels to mimic the behavior of Adobe products when you press the Tab key.

I found that trying to this using the rhino commands resulted in the panels reappearing in the wrong order and it would take a while with noticeable flickering compared to right-clicking and selecting close, which is instant.

This is faster and panels don't flicker, but it still doesn't guarantee that the tab that had focus will retain its focus when reopened. Maybe someone can suggest how to address that remaining issue.

import scriptcontext as SC
import Rhino

A = 0
currentlyOpen = 0

if (SC.sticky.has_key("panelsToToggle")):
    A = SC.sticky["panelsToToggle"]
else:
    currentlyOpen = Rhino.UI.Panels.GetOpenPanelIds()
if currentlyOpen:
    SC.sticky["panelsToToggle"] = currentlyOpen     
    for i in currentlyOpen:
        Rhino.UI.Panels.ClosePanel(i)
if not currentlyOpen:
    if A:
        for i in A:
            Rhino.UI.Panels.OpenPanel(i)
    SC.sticky.clear()

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5788

Trending Articles