Override current windows? QT

97 views
Skip to first unread message

I73

unread,
Feb 14, 2017, 7:37:09 PM2/14/17
to Python Programming for Autodesk Maya
I'm looking for a way to override the UV editor window to add my own buttons and fields. Is there any way I can do this in QTpython? Or suggestions?

Kyle Burris

unread,
Feb 28, 2017, 8:57:04 AM2/28/17
to Python Programming for Autodesk Maya
This is a total hack, but it might get you started. You can use the lsUI command to find any existing maya UI element. From there you can use sip, and open maya to get a qtLayout from a maya layout. I don't fully understand the sip line, it was taken from some code I wrote several years ago. If you're using pyside then I believe you have to use shiboken instead of sip. I would prepare yourself for a lot of tedious hacking and restarting of maya.

import sip
import PyQt4.QtGui as QtGui
import PyQt4.QtCore as QtCore
import maya.OpenMayaUI as omui

print cmds.lsUI(ed=True)
parentLayout
= cmds.editor('polyTexturePlacementPanel1', q=True, p=True)
uvLayout
= sip.wrapinstance(long(omui.MQtUtil.findLayout(parentLayout)), QtCore.QObject)
uvLayout
= uvLayout.children()[0].layout()
qtButton
= QtGui.QPushButton('TEST')
uvLayout
.addWidget(qtButton)

I73

unread,
Feb 28, 2017, 2:14:11 PM2/28/17
to Python Programming for Autodesk Maya
Hey Kyle, thanks for the reply! I'm using C++ but looking at the python it seems I can use this example. I'm just glad its not using cmds and actually QT!!! I'll post my working code to help others out. 

Kyle Burris

unread,
Mar 1, 2017, 8:35:27 AM3/1/17
to Python Programming for Autodesk Maya
Another option to consider is to make your own window with say a custom toolbar at the top and then try to embed the UV editor into another Qt layout. 

I've done this before to embed a simplified graph editor into a a character finaling tool. I don't know about the UV editor but with the graphEditor all I got from cmds was just the graph widget and nothing else. Thus I was left with the laborious task of recreating the graphEdior tool bar. 
Reply all
Reply to author
Forward
0 new messages