Max 2015 Pyside ui parent to Max window

Max 2015 Pyside ui parent to Max window

Anonymous
Not applicable
2,371 Views
8 Replies
Message 1 of 9

Max 2015 Pyside ui parent to Max window

Anonymous
Not applicable

We have just started testing Max 2015 and have been looking at the Python/Pyside implementation. We currently use the Blur Python methodology, but are changing the studio to only use the MaxPlus classes etc. 

The PySide Ui example that ships with the app is a good start, but there is no code that parents the ui to the main Max window, which we believe is a fundamental requirement as it is much better to have any relative ui stay with the Max window when minimizing/maximizing and stays on top of the window unless minimized by choice. Has anyone seen or found any code that supports the parenting of a pyside ui?

 

I have looked at the Chris Diggins article but its using a class (qtwinmigrate) that is for PyQt4. we are not looking to complie PyQt4 for use in this way, so a pyside solution is what we need.

 

Any feedback will be welcome.

0 Likes
2,372 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

So many views with no replies. Great. Smiley Mad

0 Likes
Message 3 of 9

Anonymous
Not applicable

Well, I have managed to get an externally created ui to be a child of Max 2015 without the need for blur python and only using PySide. However, as people only come to this page other than to see if the issue that Autodesk should have resolved has been resolved by someone else, I do not think it will be responded to. Or perhaps it will. But only to ask me how I did it. Well, I am not going to tell you yet. Stay tuned for the next installment of "Adventures in Autodesk!!"

 

Seriously tho, once I have it sorted and am 100% confident it does what I need it to, I may post the answer. Unless ADesk want to pay me for my code, nudge nudge, wink, wink.Smiley Very Happy

0 Likes
Message 4 of 9

robotProdigy
Advocate
Advocate

Looks like I will be writing another Max tool for my company, and am dredding not being able to use Python/PySide due to PySide's window focus issues with Max. Dredding more using MaxScript and .Net as even those have behaved very badly together, and well...MaxScript.

 

Ugh.

0 Likes
Message 5 of 9

drew_avis
Autodesk
Autodesk

This is not a solution, but a work-around.  You can prevent a PySide window from "dissappearing" behind Max when you click somewhere else in the Max UI by setting some window hints to stay on top.  eg:

 

 

def main():

 w = QtGui.QWidget()
 w.resize(250, 150)
 w.setWindowTitle('QT Window1')

 btn = QtGui.QPushButton('Button', w)
 btn.clicked.connect(press)

 _GCProtector.widgets.append(w)
 w.setWindowFlags(w.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
 
 w.show()

 

The downside is that this window is always displayed and on top, even when you minimize the Max window, or open other dialogs.

 

Hope this helps.

 

Drew



Drew Avis
Content Experience Designer
0 Likes
Message 6 of 9

Anonymous
Not applicable

Hi, thanks for the reply. I had already looked at the solution you provided, but it is not what we want to do as it is often the case that artists will have multiple scripted tools open at any given time and scrren space is a premium with what we do. 

I am sure that Adesk will eventually put something in place, but until then, we will probably stick to Max 2011 and Blur python until such time as Adesk realise that they need to put more effort into providing a stable release with fully supported and working versions of python.

0 Likes
Message 7 of 9

robotProdigy
Advocate
Advocate

Better late than never - the latest Max 2016 Extension addresses this issue. 

 

After updating to this extension, look in the below file for a working example.

C:\Program Files\Autodesk\3ds Max 2016\scripts\Python\demoPySideQWidget.py

 

http://forums.autodesk.com/t5/programming/2016-extension-address-pyside-window-non-parenting-issue/m...

 

-Paul

0 Likes
Message 8 of 9

lee.dunham
Collaborator
Collaborator

For those still needing a better workaround;

 

https://github.com/alfalfasprossen/qtinwin/blob/master/maxparenting.py

0 Likes
Message 9 of 9

Anonymous
Not applicable

Thanks for the reply, but I am now using max 2018 and have a solution that works. Just a shame it took so long for Autodesk to properly implement something that other 3d apps have had for years.

 

The solution on GitHub is similar to what we previously used (ctypes), so its great that others did the same.

 

MaxPlus is horrible to use, at least pymxs is somewhat usable, even if the documentation is shockingly absent. I did ask Autodesk why there is no docs and the reply?

 

"If you can use maxscript and understand python, you can just work out the syntax"

 

Farcical.

 

Max docs have always been abysmally laid out, short on real examples (not just the ones that are mostly unhelpful) and the MaxPlus documentation is convoluted and poorly structured.

 

If it was not for the fact that I have to use it, I would only use Maya or Houdini.

0 Likes