Getting PySide2 (Python for Qt) to work inside Marvelous Designer 10

Marvelous Designer 10 is using Qt5 for the user interface, but unfortunately for some reason they don’t ship the Python Qt binding anymore.

https://www.marvelousdesigner.com/company/news/view/61

After doing some tinkering, I was able to get PySide2 to work inside MD 10 . But it involved copying and removing some files to the MD installation directory, so follow at your own risk :) . Here are the procedures involved:

Firstly we need to know which version of Python MD 10 is shipping with. By executing sys.version in the Python console window (Menu Script->Python) we know that it is using Python-3.7.9 64 bit.

So we go to the Python download webpage and get that specific version:

https://www.python.org/downloads/release/python-379/

After downloading the 64 bit installer , install the Python standalone in some directory , e.g : C:\Python-3_7_9.

Next we need to know which Qt5 version is used by MD 10. I asked the support team and their answer was Qt-5.14.2.

https://marvelousdesigner.zendesk.com/hc/en-us/community/posts/900002201406-Qt-Support-was-removed-from-MD10-?page=1

So we need to add the corresponding PySide2-5.14.2 module to the standalone Python package.

pip install PySide2==5.14.2

Here comes the complicated part (for me). In the past with MD version 8, I was able to just append the site-packages directory to MD Python sys.path, and it would just worked because MD8 was shipped with PythonQt dlls.

md8_pythonQt.JPG

And that’s not the case with MD10. When i just did the sys.path.append, what happened is when I tried to import PySide2 or shiboken2 in the Python console, there was dll error.

ImportError: DLL load failed: %1 is not a valid Win32 application.

After googling the error and trying to finding some alternative solution to no avail, the only way i can make it to actually work is to remove the installed Python files inside MD10 installation directory and copy our entire Python standalone files and directory to the MD directory! Here’s where it becomes potentially destructive process and I am not sure if there is any side effects to this (e.g. MD team has made some custom modification for their shipped Python), and that’s why I said proceed with caution. In my case this is just for my personal use, and in worst case I can just reinstall MD10.

To do that we need to delete or rename python37.dll , python37.zip, and PythonLib directory inside the MD installation folder , e.g ( C:\Program Files\Marvelous Designer 10 Personal ), and next we copy the entire content of our just installed standalone Python (C:\Python-3_7_9) to that directory.

Next we need to prepare a python module (e.g init.py), and put it inside the MD directory as well.

the content of the init.py module would be:

import sys
sys.path.append(r'C:\Program Files\Marvelous Designer 10 Personal\DLLs')
sys.path.append(r'C:\Program Files\Marvelous Designer 10 Personal\Lib')
sys.path.append(r'C:\Program Files\Marvelous Designer 10 Personal\Lib\site-packages')

(and you can also some other modules you want to append the sys.path to)

After that we launch the MD application, and in the python console, we need to import the init module first before being able to access PySide2. And then it should be working :)

import init

from PySide2 import QtWidgets
ui = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout(ui)
btn = QtWidgets.QPushButton("Push")
layout.addWidget(btn)
ui.show()
Horray !!

Horray !!

Hopefully that works for you as well in case you want to try it, and let me know if there’s issue that I might be able to help, or if you know a more “elegant” solution. Cheers!
































Previous
Previous

Import psa Animation File into Maya as Keyframes

Next
Next

In-game Preview of Emilia Mod - SFV