Building Qt for Use With 3ds Max

This topic will describe how to obtain the Autodesk-patched version of Qt required for use with 3ds Max. You can also download a pre-built package from the Autodesk Developer Network.

Prerequisites:

Building Qt

To build Qt:

  1. Unpack the Qt source package. A third-party tool such as 7zip is recommended, since Windows can sometimes corrupt these files.
  2. Remove the space from the folder name (Qt4.8.5 instead of Qt 4.8.5).
  3. Mark the unzipped directory as read/write: right click, select Properties, and clear the “Read-only” checkbox. Apply to all files and sub-folders.
  4. Remove all moc .tmp files. There are many ways to do this, for example with Cygwin you can use:

    find . -path '*/tmp/moc*' -type f -exec rm '{}' \;

    In powershell you can use:

    get-childitem .\ -include *.moc -recurse | foreach ($_) {remove-item $_.fullname}
  5. Open the Visual Studio 2015 Native Tools Command prompt. Configure the build by running:

    configure -no-qt3support -platform win32-msvc2015 -plugin-sql-sqlite -qmake 
    -qtlibinfix _Ad_ -qt-libjpeg -qt-libmng -qt-libtiff -qt-sql-sqlite -qt-zlib -vcproj 
    -developer-build -no-openssl -nomake docs -nomake examples -nomake demos  
    -nomake tests -opensource
    			 
  6. Run nmake.
  7. Copy the resulting lib directory to /binary/win_vc14/x64/lib.

Qt is now built and ready to use.

NOTE:If you want to build Qt with SSL integration, you will first need to get and build OpenSSL 1.0.1 (https://www.openssl.org/source/ ). Building OpenSSL requires Perl. This is not required if you only want to build Qt for making 3ds Max plug-ins.

To build Qt with OpenSSL, use this command line for running the configure command:

configure -I <openssl_include_path> -L <openssl_lib_path> -no-qt3support -openssl 
-platform win32-msvc2015 -plugin-sql-sqlite -qmake -qtlibinfix _Ad_ -qt-libjpeg -qt-libmng 
-qt-libtiff -qt-sql-sqlite -qt-zlib -vcproj -developer-build -nomake docs -nomake examples 
-nomake demos -nomake tests -opensource 
	

The Win64/x64 openssl build names the include directory "inc32" and the lib directory "out32dll".

Building the sunlight plug-in

To test your Qt build, try building the maxsdk\samples\systems\sunlight project:

  1. Open the maxsdk\samples solution in Visual Studio 2015.
  2. If you want to locate Qt outside of the <maxsdk> directory, edit the property sheet under maxsdk\ProjectSettings\propertySheets\3dsmax.general.project.settings.props, and change the QT-related macro definitions to point at the Qt location (below is the default location inside the <maxsdk> directory):
    <QTDIR>$(MaxSdkDir)\Qt\4.8.5\</QTDIR>
    <QtInc>$(MaxSdkDir)\Qt\4.8.5\include\</QtInc>
    <QtLib>$(MaxSdkDir)\Qt\4.8.5\binary\win_vc14\x64\lib\</QtLib>
    <QtMigrateLib>$(MaxSdkDir)\Qt\4.8.5\QtApps\qtwinmigrate\2.8\binary\win_vc14\x64\lib\</QtMigrateLib>
  3. Set the project configuration to Release.
  4. Right-click the project and select build.

Building the Qt Manager Add-in

This step is optional, but highly recommended if you plan on creating UIs in Qt.

The Qt Manager Add-in for Visual Studio makes it much easier to set up projects that use Qt, and to create UIs using the Designer. Autodesk has modified the Qt Manager for Qt 4 to work with Visual Studio 2012. Since an add-in is not yet available for Visual Studio 2015, the current workflow is:

  1. Create the 3ds Max Plug-in project in Visual Studio 2015, using the Plug-in Wizard or by hand. Save the project.
  2. Open the project in Visual Studio 2012, add the Qt project nature and settings.
  3. Create the UI in Qt Designer, and add the .ui files to the project.
  4. Create wrapper classes for the Qt widgets in the Ui, so they can be connected to parameter blocks. This will cause Visual Studio to auto-generate support files.
  5. Re-open the project in Visual Studio 2015 and continue working on it.

The Creating a Qt-based Plug-in tutorial uses this workflowt.

To use the Qt Manager, you need to obtain and build the Qt Add-in for Visual Studio 2012. Clone the source located at: https://github.com/lakiduo/QtAddin

Build the project using the instructions here: http://wiki.qt.io/QtVSAddin. Use the Qt 4.x instruction set, and the Autodesk-modified Qt libraries.