Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

Query which standard Maya dockControl is visible

$
0
0
Maya stores the Channel Box / Attribute Editor/ Tool Settings (etc) dock labels and control names in a global mel string array called $gUIComponentDockControlArray. From that, you can query which one is currently visible (on top):
import pymel.core as pm
mayaDocks = pm.language.melGlobals["gUIComponentDockControlArray"]
for i in range(0, len(mayaDocks), 2):
    label = mayaDocks[i]
    ctrlName = mayaDocks[i+1]
    print label, ctrlName, pm.dockControl(ctrlName, query=True, r=True)
Which prints something like:
Channel Box / Layer Editor MayaWindow|dockControl1 True
Channel Box MayaWindow|dockControl2 False
Layer Editor MayaWindow|dockControl3 False
Attribute Editor MayaWindow|dockControl4 False
Tool Settings MayaWindow|dockControl5 False
Note that if they're floating, they'll return True.

Viewing all articles
Browse latest Browse all 610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>