This document provides instructions for building PyQt and SIP to work with Autodesk Maya 2015 on Mac and Linux platforms. The steps include downloading PyQt and SIP source code, configuring the Qt environment variables, building and installing SIP, and then building and installing PyQt. Building PyQt requires setting up the Qt libraries, includes and mkspecs that are included with Maya 2015. Bash scripts are provided as examples to automate the build process.
This document provides instructions for building PyQt and SIP to work with Autodesk Maya 2015 on Mac and Linux platforms. The steps include downloading PyQt and SIP source code, configuring the Qt environment variables, building and installing SIP, and then building and installing PyQt. Building PyQt requires setting up the Qt libraries, includes and mkspecs that are included with Maya 2015. Bash scripts are provided as examples to automate the build process.
Written by Cyrille Fauvel Autodesk Developer Network (April 2013)
Updated by Vijaya Prakash Autodesk Developer Network (April 2014)
Additional Qt instructions available here - http://around-the-corner.typepad.com/adn/2014/04/building-sip-and-pyqt-for-maya-2015.html
Building SIP, and PyQt for Maya 2015 PyQt [http://www.riverbankcomputing.co.uk] is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt.
The following are instructions for building a copy of the PyQt modules that have been known to work with Maya.
Maya 2015 uses Qt4.8.5 which is binary compatible with the latest version of PyQt - 4.10.4 / SIP - 4.15.5 (at time of writing, April 2014). However, you do not have to use these versions if you prefer using an older version, all you need is to use a version compatible with Qt4.8.5.
Note that its important to use the Maya modified version of the Qt source code. A copy of the customized Qt 4.8.5 source is available from Autodesk's Open Source web-site (http://www.autodesk.com/lgplsource) and includes text files describing how to configure, build and install Qt for each platform supported by Maya.
However, be aware that with Maya 2015, there is no more need to build PySide as it is coming by default in Maya, nor you have to rebuild Qt itself as the main Qt tools to build PyQt are now included in the Maya distributions (I.e. qmake, moc, )
libxml, openSSL, OpenAL, python2.7, qt-4.8.5, and tbb are also coming by default in the Maya include and lib folder, so unless you have a very specific need, you would not need to rebuild any of those libraries like before. Note as well that there is a 'C:\Program Files\Autodesk\Maya2015\support\opensource' folder now which contains some of the community source.
Download SIP and PyQt source from 'http://www.riverbankcomputing.co.uk' - here I downloaded 'sip- 4.15.5' and 'PyQt-win-gpl-4.10.4'. Unzip them in one folder, then you should get something like this:
Mac
/Users/cyrille/Documents/_Maya2015Scripts/sip-4.15.5 /Users/cyrille/Documents/_Maya2015Scripts/PyQt-mac-gpl-4.10.4 '/Users/cyrille/Documents/_Maya2015Scripts' being my local folder. Now the instructions, and bash scripts to build that SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Mac OS X environment, in the Maya Documentation) Untar the /devkit/include/qt-4.8.5-include.tar.gz into /devkit/include/Qt Copy /Resources/qt.conf into /bin/qt.conf and edit it like this: [Paths] Prefix= Libraries=../MacOS Binaries=../bin Headers=../../../devkit/include/Qt Data=.. Plugins=../qt-plugins Translations=../qt-translations
Untar the qt-4.8.5-mkspecs.tar.gz into $MAYA_LOCATION/Maya.app/Contents/bin/mkspecs. Make sure the qconfig.pri looks like this:
You also need to create copy of the Qt lib files as fake .dylib files from the /MacOS directory. The script below will give you the commands to do that.
Build & Install SIP
#!/usr/bin/env bash
MAYAQTBUILD="`dirname \"$0\"`" # Relative export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized cd $MAYAQTBUILD
if [ ! -f $QMAKESPEC/qmake.conf ]; then echo "You need to install qt-4.8.5-64-mkspecs.tar.gz in $QTDIR/mkspecs !" exit fi if [ ! -f $INCDIR_QT/QtCore/qdir.h ]; then echo "You need to uncompress $MAYA_LOCATION/devkit/include/qt- 4.8.5-include.tar.gz in $INCDIR_QT !" exit fi # qt.conf - /Applications/Autodesk/maya2015/Maya.app/Contents/Resources if [ ! -f $QTDIR/bin/qt.conf ]; then echo "You need to copy $QTDIR/Resources/qt.conf in $QTDIR/bin !" exit fi
test=`grep "Data=../.." $QTDIR/bin/qt.conf` if [ ! -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Data=..'" exit fi test=`grep "Headers=../../include" $QTDIR/bin/qt.conf` if [ ! -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Headers=../../../devkit/include/Qt'" exit fi test=`grep "Libraries=../lib" $QTDIR/bin/qt.conf` if [ ! -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Libraries =../MacOS'" exit fi test=`grep "Plugins = qt-plugins" $QTDIR/bin/qt.conf` if [ ! -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Plugins=../qt- plugins'" exit fi test=`grep "Translations = qt-translations" $QTDIR/bin/qt.conf` if [ ! -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Translations=../qt-translations'" exit fi
for mod in Core Declarative Designer DesignerComponents Gui Help Multimedia Network OpenGL Script ScriptTools Sql Svg WebKit Xml XmlPatterns do if [ ! -f $QTDIR/MacOS/libQt${mod}.dylib ]; then echo "You need to copy a fake Qt$mod dylib - cp $QTDIR/MacOS/Qt$mod $QTDIR/MacOS/libQt${mod}.dylib !" #cp $QTDIR/MacOS/Qt$mod $QTDIR/MacOS/libQt${mod}.dylib exit fi done if [ ! -f $QTDIR/MacOS/libphonon.dylib ]; then echo "You need to copy a fake phonon dylib - cp $QTDIR/MacOS/phonon $QTDIR/MacOS/libphonon.dylib !" #cp $QTDIR/MacOS/phonon $QTDIR/MacOS/libphonon.dylib exit fi
'/home/cyrille/Documents/_Maya2015Scripts' being my local folder. Now the instructions, and bash scripts to build SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Linux environments (64 bit), in the Maya Documentation).
Edit your qt.conf file (/usr/autodesk/maya2015-x64/bin) like below
Untar the /include/qt-4.8.5-include.tar.gz into /include/Qt Untar the /mkspecs/qt-4.8.5-mkspecs.tar.gz into /mkspecs Make qmake, moc executables from the Maya bin directory sudo chmod aog+x /usr/autodesk/maya2015-x64/bin/moc sudo chmod aog+x /usr/autodesk/maya2015-x64/bin/qmake
Build & Install SIP
#!/usr/bin/env bash
MAYAQTBUILD="`dirname \"$0\"`" # Relative export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized cd $MAYAQTBUILD
if [ ! -f $QMAKESPEC/qmake.conf ]; then echo "You need to install qt-4.8.5-mkspecs.tar.gz in $QTDIR/mkspecs !" exit fi if [ ! -f $INCDIR_QT/QtCore/qdir.h ]; then echo "You need to uncompress $MAYA_LOCATION/include/qt-4.8.5- include.tar.gz in $INCDIR_QT !" exit fi # qt.conf - /Applications/Autodesk/maya2015/Maya.app/Contents/Resources if [ ! -f $QTDIR/bin/qt.conf ]; then echo "You need to copy $QTDIR/Resources/qt.conf in $QTDIR/bin !" exit fi
test=`grep "Headers=../include/Qt" $QTDIR/bin/qt.conf` if [ -z "$test" ]; then echo "You need to edit $QTDIR/bin/qt.conf to use 'Headers=../include/Qt'" exit fi
'D:\__sdkext\_Maya2015 Scripts' being my local folder. Now the instructions and scripts to build SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Windows environment (64bit), in the Maya Documentation)
Edit your qt.conf file (C:\Program Files\Autodesk\Maya2015\bin) like below
Unzip the /include/qt-4.8.5-include.tar.gz into /include/Qt Unzip the /mkspecs/qt-4.8.5-mkspecs.tar.gz into /mkspecs
Build & Install SIP
@echo off
set MAYAQTBUILD=%~dp0 set MAYAQTBUILD=%MAYAQTBUILD:~0,-1% if exist v:\nul subst v: /d subst v: "%MAYAQTBUILD%" v:
set SIPDIR=v:\sip-4.15.5 set MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0 if [%LIBPATH%]==[] call "%MSVC_DIR%\VC\vcvarsall" amd64
set MAYA_LOCATION=C:\Program Files\Autodesk\Maya2015 set INCLUDE=%INCLUDE%;%MAYA_LOCATION%\include\python2.7;%MAYA_LOCATION %\Python\include set LIB=%LIB%;%MAYA_LOCATION%\lib
cd %SIPDIR% "%MAYA_LOCATION%\bin\mayapy" configure.py nmake nmake install
Build & Install PyQt
@echo off
set MAYAQTBUILD=%~dp0 set MAYAQTBUILD=%MAYAQTBUILD:~0,-1% if exist v:\nul subst v: /d subst v: "%MAYAQTBUILD%" v:
set MAYA_LOCATION=C:\Program Files\Autodesk\Maya2015 if exist m:\nul subst m: /d subst m: "%MAYA_LOCATION%" set MAYA_LOCATION=m:
set QTDIR=%MAYA_LOCATION% set MSVC_VERSION=2012 set QMAKESPEC=%QTDIR%\mkspecs\win32-msvc%MSVC_VERSION% if not exist "%QMAKESPEC%\qmake.conf" ( echo "You need to uncompress %MAYA_LOCATION%\mkspecs\qt-4.8.5- 64-mkspecs.tar.gz !" goto :end ) if not exist "%MAYA_LOCATION%\include\Qt\QtCore\qdir.h" ( echo "You need to uncompress %MAYA_LOCATION%\include\qt-4.8.5- 64-include.tar.gz in %MAYA_LOCATION%\include\Qt !" goto :end ) findstr /L /C:"Headers=../include/Qt" %MAYA_LOCATION%\bin\qt.conf >nul 2>&1 if ERRORLEVEL 1 ( echo "You need to edit %MAYA_LOCATION%\bin\qt.conf to use 'Headers=../include/Qt'" goto :end )
set SIPDIR=v:\sip-4.15.5 set PYQTDIR=v:\PyQt-win-gpl-4.10.4
set MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0 if [%LIBPATH%]==[] call "%MSVC_DIR%\VC\vcvarsall" amd64
set INCLUDE=%INCLUDE%;%MAYA_LOCATION%\include\python2.7;%MAYA_LOCATION %\Python\include set LIB=%LIB%;%MAYA_LOCATION%\lib
cd %PYQTDIR% set PATH=%QTDIR%\bin;%PATH% "%MAYA_LOCATION%\bin\mayapy" configure.py LIBDIR_QT=%QTDIR%\lib INCDIR_QT=%QTDIR%\include\Qt MOC=%QTDIR%\bin\moc.exe -w --no- designer-plugin nmake nmake install
:end pause
You're done! go to the testing paragraph at the end of the article.
Testing Copy and paste this example in the Maya Script Editor (in a Python tab), and execute the code:
Installation and Configuration of IBM FileNet Information Management Software: A step-by-step guide to installing and configuring IBM FileNet ECM and Case Manager on RHEL 8.0 (English Edition)
Kubernetes: Build and Deploy Modern Applications in a Scalable Infrastructure. The Complete Guide to the Most Modern Scalable Software Infrastructure.: Docker & Kubernetes, #2
(Ebook) Maya Python for Games and Film: A Complete Reference for Maya Python and the Maya Python API by Adam Mechtley; Ryan Trowbridge ISBN 9780123785787, 0123785782 instant download