Issue
I have some issues in maxplus, the python distribution in 3ds max with pyside.
I try to parent my qtmainwindow to the max window. To minimize my qtmainwindow when max is minimized.
We want to leave the maxplus python installation untouched so I cannot install sip or shiboken to use wrapinstance to get a qobject. Now I would like to know how the parenting would be possible without those packages.
edit: I recognized that shiboken is available but when I try to parent my QMainWindow to the applicatin it gives a
** system exception **
here is a bit of code i hope that helps to understand:
from PySide import QtCore, QtGui,shiboken
import MaxPlus
class ControlMainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(ControlMainWindow, self).__init__(parent)
maxWinHwd = MaxPlus.Core.GetWindowHandle()
parent=shiboken.wrapInstance(long(maxWinHwd), QtGui.QWidget)
self.setParent(parent)
def main():
global app
app = QtGui.QApplication.instance()
if not app:
app = QtGui.QApplication(sys.argv)
global window
window=ControlMainWindow()
window.show()
if __name__ == '__main__':
main()
Thanks in advance
Solution
I'm tackling the exact same problem now, so this is the best solution I've found so far that works OOTB without having to resort to relying on the Blur 3ds max Python extensions:
http://tech-artists.org/forum/showthread.php?5162-MaxPlus-parent-PySide-Window-to-Max-Window
I've tried to make a commented version of the code here as well, though I'm new to ctypes, so it may not be 100% correct:
I hope that helps!
Answered By - sonictk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.