PDA

View Full Version : Native Maya UI Elements in PyQt interface


BigRoyNL
11-15-2011, 04:16 PM
Hey Guys,

I was wondering if there was a way to get interfaces you've created before (without PyQt) in Mel or Python into a PyQt layout, for example as if its a widget.

I'm currently trying to create a special window to hold a combination of my older scripts. I want the global box to run on PyQt and contain sub-interfaces/modules from older scripts (plain MEL/Python UI) but with minimal changes to my original UI scripts, preferably close to nothing.

Any tips on how to do this? Since the Maya UI commands are now actually creating PyQt elements, how can I get them to work together nicely?

Thanks in advance.

Regards,
Roy

cgrebeld
11-16-2011, 06:14 PM
Check out the API class MQtUtil:
http://download.autodesk.com/global/docs/mayasdk2012/en_us/index.html?url=cpp_ref/class_m_qt_util.html,topicNumber=cpp_ref_class_m_qt_util_html

You can use that in combination with the PyQt 'sip' module.

BigRoyNL
11-16-2011, 06:38 PM
So does this make it possible to run Maya native commands to become part of the layout or add them to the layout? For example:

cmds.columnLayout()
cmds.button()
cmds.button()
cmds.setParent()

I'll try to do some more research into the link you gave me. So far I've already been having a hard time installing the 'sip' module within Maya's Python.

Thanks!

-Roy

cgrebeld
11-16-2011, 07:35 PM
Installing PyQt & sip in maya is a whole other topic. But once you have that going you can use MQtUtil.
I found this nice example:
http://nathanhorne.com/?p=183

NateH
11-17-2011, 12:56 AM
To embed a native Maya Qt widget into a PyQt widget you need to create the Maya widget first, and then using PyQt alter it's parent to be the proper location/layout inside your PyQt hierarchy.

Here's an example embedding a cmdScrollFieldExecuter (Script editor input) into a QMainWindow:
http://nathanhorne.com/?p=381

BigRoyNL
11-17-2011, 06:09 AM
Hey Nathan,

That's awesome. Once I get this thing up and running I'll start playing with it!

Thanks all.

Regards,
Roy

CGTalk Moderation
11-17-2011, 06:09 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.