In order to support Qt 5 Maya 2017 now uses the PySide2 module and shiboken2. While this is supposed to bring a lot of improvements into Maya’s UI, including speed and new functions, it also breaks a lot of old scripts. Including my BroDynamics and other tools. I though about using Qt.py, but that would require me to include it with all my scripts, and really it was too complex for a lot of my tools, especially those shipped as one file.
At first I was a bit terrified, thinking that I’ll have to re-write a lot of code. But in fact I was able to adapt all of my scripts in few minutes.
So, the biggest changes in PySide2 are:
– Some widgets moved from QtGui to QtWidgets
– shiboken is also changed to shiboken2
Before the change I was using PySide like this:
from PySide import QtCore, QtGui someWidget = QtGui.QWidget()
The biggest change is to switch to another method of importing PySide:
from PySide.QtCore import * from PySide.QtGui import *
This way you import all modules directly, and instead of writing QtGui.QWidget you can just use QWidget. Obvious but very handy in this case.
Without any further speculation, here is my final PySide import code.
try: from PySide2.QtGui import * from PySide2.QtCore import * from PySide2.QtWidgets import * from shiboken2 import wrapInstance print 'Using PySide2' except: from PySide.QtGui import * from PySide.QtCore import * from shiboken import wrapInstance print 'Using PySide'
And then using simple Replace, available in any text editor, change all “QtGui.” and “QtCore.” to “”. Just remove them.
I will test BroDynamics and other scripts for some time, before making new versions available to the public. Stay tuned 🙂
Here are a few links you may find useful as well:
Maya Help – PyQt and PySide Widget Best Practices
Phew, it took me a while to get it all together. It was huge update. Last few days was I was fighting with bugs mostly, which started to appear seemingly out of nowhere.
There are three main updates in this release.
– Added 2 more simulation modes: Points and RBD
– UI Improved
Since there are these huge updates, there may be new bugs in this release, which I did not have a chance to catch yet. Feel free to report any problems you enouncter, and I will try to fix it ASAP.
Along with this release I made new promo video, and started making a series of How To videos.
I think later I will sit back and write a nice post about some behind-the-scenes… Or not… We’ll see 😀
– A lot of bug fixes and improvements overall.
– Compatibility fix! Now works with Maya 2014 too. Probably with 2013 as well.
– UI reworked, now windows delete properly when you close the main BroDynamics window, docked or undocked. Memory leak here and performance impact after closing and openning it often should be fixed now.
– Icons everywhere! 😀
– NEW! Added single object simulation based on nParticles.
– NEW! Rigid Body and Ragdoll simulation module.
– Added SnapRuntime plugin for object matching for RBD mostly. Thank you, Red9.
– Fixed Get button in Batch Window
– Batch window’s list will now properly update when you hit Undo. Now no need to worry about making mistakes there at all.
Working on an update.