Add new window to right side of screen with Maya's inbuilt UI

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  06 June 2018
Add new window to right side of screen with Maya's inbuilt UI

I've found some example Qt code on docking a window to the side of Maya, but I'm still new to Qt and would ideally like the use the inbuilt Maya UI for the time being.

I'm assuming you create the window as normal and dock it after, how exactly do you do that? The window will follow a similar style to the attribute editor.

Last edited by JustAnotherGuy : 06 June 2018 at 09:26 AM.
  06 June 2018
Are you looking for something like this....

import maya.cmds as cmds
import maya.mel as mel
import sys
myPath = '/home/prem/Downloads/MayaUtlityScript/'
if not myPath in sys.path:
if cmds.window("MyRigShortcut", exists=True):
  cmds.deleteUI("MyRigShortcut", window=True)
  cmds.deleteUI(doc, control=True)
buttonForm = cmds.formLayout( parent = "MyRigShortcut", numberOfDivisions=100 )
b1 = cmds.button (label = "Toggle Joint Visibilty", parent = buttonForm, align="left", c = "HideShow()")
b2 = cmds.button (label = "Zero Out", parent = buttonForm, align="right", c = "zeroOut()")
column = cmds.columnLayout()
allowedAreas = ['right', 'left']
cmds.formLayout( buttonForm, edit=True, attachPosition=[(b1, 'left', 0, 0),(b2, 'left', 25, 25),(b3, 'left', 60, 32),(b4, 'left', 80, 40),
(column, 'right', 50, 50), (column, 'left', 50, 50)])
doc = cmds.dockControl( l="MyRigShortcut", area='right', content="MyRigShortcut", ret=False, allowedArea=allowedAreas )
def HideShow():
  jointList = []
  jointList = = "joint" )
  for j in jointList:
    n = cmds.getAttr (j+".drawStyle")
    if (n==0):
def zeroOut():
  attrVsDefaultValue = {'sx':1, 'sy':1, 'sz':1, 'rx':0, 'ry':0, 'rz':0, 'tx':0, 'ty':0, 'tz':0}
  sel =
  for obj in sel:
    for attr in attrVsDefaultValue:
        cmds.setAttr('%s.%s'%(obj, attr), attrVsDefaultValue[attr])

Download Vehicle Rig
  06 June 2018
Thanks, though it's a little different from what I was after, apologies for not being more clear in the first post I was meaning like adding a separate tab underneath the Channel Box and Attribute Editor as a way of grouping the important attributes.
  06 June 2018
Found the command btw, for anyone else who comes across this, in the pace of calling

you call this:
pm.workspaceControl('window_name', tabToControl=('AttributeEditor', -1), label='New Docked Window')

The way to remove it is slightly different if you don't want errors:

pm.deleteUI('window_name', layout=True)
pm.workspaceControlState('window_name', remove=True)
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 09:14 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.