This post is an update about this great post :

https://around-the-corner.typepad.com/adn/2019/01/how-to-build-pyqt5-for-autodesk-maya-2019.html

Written by Cyrille Fauvel – Autodesk Developer Network (April 2013) 
Updated by Lanh Hong and Chengxi Li – Autodesk Developer Network (January 2019) 

 

Setting up your environment:

      1. Follow the official instruction to prepare your Environment > Autodesk Developer Documentation
      2. Download SIP and PyQt source. I downloaded ‘sip-4.19.13’ and ‘PyQt5_gpl-5.11.3’. Unzip them into one folder.
      3. Put in the same folder the script (only the script on the ‘win’ folder) available on Github
      4. Backup your qt.conf  located on  C:\Program Files\Autodesk\Maya2019\bin and replace with the following code:
        [Paths]
        Prefix=$(MAYA_LOCATION)
        Libraries=lib
        Binaries=bin
        Headers=include/Qt
        Data=.
        Plugins=qt-plugins
        Translations=qt-translations
        Qml2Imports=qml 
      5. Unzip  the package C:\Program Files\Autodesk\Maya2019\include\qt-5.6.1_vc14-include.zip in C:\Program Files\Autodesk\Maya2019\include\Qt
      6. Unzip the package C:\Program Files\Autodesk\Maya2019\include\qt-5.6.1_vc14-mkspecs.zip in C:\Program Files\Autodesk\Maya2019\mkspecs
      7. Modify the C:\Program Files\Autodesk\Maya2019\mkspecs\mkspecs\common\msvc-destop.conf. Find QMAKE_LIBS_QT_ENTRY and make sure is -lqtmain -lshell32.
      8. Rename the folder inside C:\Program Files\Autodesk\Maya2019\include\Qt\qtnfc to qtnfc.disabled
      9. Install Visual Studio 2017 Community > Download
      10. Install the Python package manager Pip by execute with mayapy.exe this py file get-pip using the command prompt as Administrator C:\Program Files\Autodesk\Maya2019\bin\mayapy.exe youPath\get-pip.py
      11. Install using pip the setuptools and enum34 with the following command
        C:\Program Files\Autodesk\Maya2019\bin\mayapy.exe -m pip install setuptools 
        C:\Program Files\Autodesk\Maya2019\bin\mayapy.exe -m pip install enum34
      12. Run the following scripts (the previous downloaded from github) lauching them with the VS2017 x64 Native Tools Command Prompt (as Administrator):
          1. setup.bat
          2. sip.bat
          3. pyqt.bat
      13. At this point you’re done! The last thing to do is to test it! SO launch Maya and try the following code :
        import sys
        from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton)
        from PyQt5.QtGui import QFont    
         
        class Example(QWidget):
            def __init__(self):
                super(Example,self).__init__()
                self.initUI()
        
            def initUI(self):
                QToolTip.setFont(QFont('SansSerif', 10))
                self.setToolTip('This is a <b>QWidget</b> widget')
                btn = QPushButton('Button', self)
                btn.setToolTip('This is a <b>QPushButton</b> widget')
                btn.resize(btn.sizeHint())
                btn.move(50, 50)
                self.setGeometry(300, 300, 300, 200)
                self.setWindowTitle('Tooltips')
                self.show()
                
        ex = Example()

       

      P.S.: Remember that you must to restore the qt.conf or you get an error when Maya try to load the plugin .

      Hope all that’s info are usefull for others.Cheers

Share Post