Quantcast
Channel: GetCOREInterface
Viewing all articles
Browse latest Browse all 44

Porting a C++ Plugin to 3ds Max 2022 and Installing the 3ds Max 2022 C++ Wizard

$
0
0

Even though the build tools (toolset) did not change, there were a number of changes made to the 3ds Max SDK that requires a plugin to be ported and recompiled. Because the SDK changed and has new requirements, this affects the binary compatibility.

The first one you are likely to hit, is that all plugins typically have an implementation of the ClassDesc2 (or ClassDesc, if not needing ParamBlock2 support). Minimally you will have to add a new method required by the underlying base ClassDesc, NonLocalizedClassName. Please take a moment to read the article about this aspect here, especially if you are providing localized plugins.

I also noticed that the Matrix3 class has changed. Depending on how you are using it, and your warning/error level you use in your projects, you may have to update code (or the project). The changes are documented here. In the case of the ADN Bake Radiosity example, the Matrix3 was initialed using the old constructor (which takes a BOOL and remember BOOL in 3ds Max is an int type). You will still see this syntax scattered throughout the SDK samples, and rather than fixing their code, they are using the ”MAX_SILENCE_DEPRECATED_MATRIX_BOOL_CTOR “ definition to silence the warning. In my opinion,  this is a good opportunity to cleanup your own code, though, and you will be in good shape if the SDK team decides to completely remove the deprecated constructor.

Finally, I would like to discuss Visual Studio 2019. Although 3ds Max and other Autodesk products have not moved to VS2019 (and toolset 142), you can use the IDE and be compatible with VS2017 (and toolset 141). This has been the case for a number of VS releases where you can target previous toolsets. With VS 2019, most editions also provide the VS2017 (toolset 141). There is a discussion about it here. Although they talk about binary compatibility, we advise to stick with the same toolset that 3ds Max is built with to avoid any unknowns. There is nothing worse than tracking down some weird binary incompatibility, and now that VS 2017 (toolset 141) is included with VS2019 there is no reason you cannot use latest greatest IDE and features, while sticking to the official toolset.

One note about VS 2019 and “classic” wizards like 3ds Max, there is no longer default folder structure that supports an “out-of-the-box” installation. However you can easily create the correct structure to install the 3ds Max Wizard. Also note that there was a bug (found by one of our other ADN engineers here) that was fixed, and requires to have the later builds of VS2019. See here for the details.

Here are the steps I would suggest to successfully setup the 2ds Max 2022 wizard in Visual Studio 2019:

  1. Make sure VS 2019 is updated to at least v16.5.2. You can find this in the Help -> About dialog.
  2. Create this folder structure if it is not present. Depending on other modules you have installed, this could already be present: <install folder>\msvs2019\Common7\IDE\VC\vcprojects
  3. Copy the files from the 3ds Max 2022 SDK folder. These are:
    • <install folder>\maxsdk\howto\3dsmaxPluginWizard\3dsmaxPluginWizard.ico
    • <install folder>\maxsdk\howto\3dsmaxPluginWizard\3dsmaxPluginWizard.vsdir
    • <install folder>\maxsdk\howto\3dsmaxPluginWizard\3dsmaxPluginWizard.vsz
  4. Open the 3dsmaxPluginWizard.vsz file in a text editor
    • Update the wizard engine to 16:   
      Wizard=VsWizard.VsWizardEngine.16.0
    • Add the path. Note it only worked for me to use forward slash (and before backslash was fine). In my case it was like this:
      Param="ABSOLUTE_PATH = d:/me/3dsmax/maxsdk2022/maxsdk/howto/3dsmaxPluginWizard"

After these changes, you should see the Wizard in the Visual Studio 2019 projects now. Also note that you can setup several versions of the Wizard as you want. This only requires adding pertinent information. In my case I like to make sure to use the support wizards for each version of 3ds Max. After setting up 3ds Max 2021 and 3ds Max 2022 in the Visual Studio 2019 environment, I can easily create projects for each version, using the Wizard for each specific version. Because the UI of Visual Studio 2019 has changed, it may not be obvious at first. Here’s how to find the 3ds Max C++ Wizard...

  1. After starting Visual Studio 2019, it will look like this:
    Fig01
  2. Click on “Create a new project” (as highlighted in above screenshot).
  3. Now you will see a long list of project types, and C++ is found a long way down if you have installed other types of targets. You can switch to C++, and it still will not display because the 3ds Max Wizard is a classic one, and does not provide the keywords.
  4. In the Search box at the top, search for “3ds Max” and now they will be found. See the red box highlight in below screen shot.
  5. Once you create a project, it will then display in the “Recent project templates” list. See the yellow box in the below screen shot.
    Fig02

Although these are minor things, it is worth mentioning that some of the samples (for example the ADN Bake Radiosity) it was the first time I had to actually update the code in many releases, even when toolsets were upgraded!

As such, please take extra time to properly port your plugins, and as always be diligent with testing.


Viewing all articles
Browse latest Browse all 44

Trending Articles