tech maya python brotools

Maya - new approach to dockable windows


Maya 2017 brought us new interface, new features and... new problems in form of API changes. First thing we faced was switch from PySide to PySide2. But that could be easily solved with simple import trick:

    from PySide2.QtGui import *
    from PySide2.QtCore import *
    from PySide2.QtWidgets import *
    from shiboken2 import wrapInstance

    print "Using PySide2"

    from PySide.QtGui import *
    from PySide.QtCore import *
    from shiboken import wrapInstance

    print "Using PySide"

Or by using great module: by Marcus Ottosson

But, as it turns out, this was not all. Maya now uses workspaceControl instead of dockControl . Well, not instead, but in addition to. But dockControl now just looks ugly, because it only supports docking to the far-right and far-left, where's there are no much more dockable regions in maya. Basically, you can't dock it next to Attribute editor anymore, only workspaceControl can do that.

Another problem was that workspaceControl is QWidget and I could not just add QMainWindow to it, so I could not use setMenuBar or setStatusBar commands.

I spent some time trying to come up with a solution, and so far this is what I've got. It is still work in progress, but it works! With custom menubar and statusbar functions.

Feel free to join the discussion.

Or write comments right here.

Maya 2016

Maya 2017