Skip to content

Commit

Permalink
Merge pull request #3165 from Autodesk/donnels/MAYA-129259/drop_suppo…
Browse files Browse the repository at this point in the history
…rt_for_Maya_2018_2019_2020

MAYA-129259 - MayaUsd: drop support for Maya 2018/2019/2020 and Qt 5.6.1 & 5.12.5
  • Loading branch information
seando-adsk authored Jul 5, 2023
2 parents 64949d9 + 97827c9 commit 28f3469
Show file tree
Hide file tree
Showing 85 changed files with 147 additions and 897 deletions.
28 changes: 4 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ option(BUILD_MAYAUSD_LIBRARY "Build Core USD libraries." ON)
option(BUILD_ADSK_PLUGIN "Build Autodesk USD plugin." ON)
option(BUILD_PXR_PLUGIN "Build the Pixar USD plugin and libraries." ON)
option(BUILD_AL_PLUGIN "Build the Animal Logic USD plugin and libraries." ON)
# Default value made dependent on maya + usd version - see below
# Convert back to a normal option if we no longer support maya-2019, or
# no longer support USD-20.11
option(BUILD_HDMAYA "Build the legacy Maya-To-Hydra plugin and scene delegate." OFF)
option(BUILD_RFM_TRANSLATORS "Build translators for RenderMan for Maya shaders." ON)
option(BUILD_TESTS "Build tests." ON)
Expand Down Expand Up @@ -86,7 +83,7 @@ endif()
#------------------------------------------------------------------------------
include(cmake/utils.cmake)
if (BUILD_MAYAUSD_LIBRARY)
find_package(Maya 2018 REQUIRED)
find_package(Maya 2022 REQUIRED)
endif()

if(APPLE AND BUILD_UB2 AND NOT MAYA_MACOSX_BUILT_WITH_UB2)
Expand Down Expand Up @@ -138,15 +135,6 @@ if (CMAKE_WANT_MATERIALX_BUILD)
endif()
include(cmake/usd.cmake)

if(DEFINED MAYA_APP_VERSION)
if (${MAYA_APP_VERSION} STRLESS "2019" AND CMAKE_WANT_UFE_BUILD)
set(CMAKE_WANT_UFE_BUILD OFF)
message(AUTHOR_WARNING "========================================================================================= \
UFE is not available in Maya${MAYA_MAJOR_VERSION}. Maya2019 and later are supported only. \
========================================================================================= ")
endif()
endif()

if(CMAKE_WANT_UFE_BUILD)
find_package(UFE QUIET)
if(UFE_FOUND)
Expand All @@ -173,18 +161,10 @@ if(DEFINED QT_LOCATION)
if(NOT DEFINED QT_VERSION)
if(BUILD_WITH_QT_6)
set(QT_VERSION "6.5")
message(STATUS "Setting Qt version to Qt ${QT_VERSION}")
else()
set(QT_VERSION "5.15") # default version Maya 2022/2023/2024
if(DEFINED MAYA_APP_VERSION)
if(${MAYA_APP_VERSION} STRLESS_EQUAL "2019")
set(QT_VERSION "5.6")
elseif(${MAYA_APP_VERSION} STRLESS_EQUAL "2020")
set(QT_VERSION "5.12")
endif()
message(STATUS "Setting Qt version to Qt ${QT_VERSION}")
endif()
else() # Maya 2022, 2023, 2024
set(QT_VERSION "5.15")
endif()
message(STATUS "Setting Qt version to Qt ${QT_VERSION}")
endif()
set(CMAKE_PREFIX_PATH "${QT_LOCATION}")
if(BUILD_WITH_QT_6)
Expand Down
32 changes: 6 additions & 26 deletions cmake/modules/FindMaya.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# MAYA_<lib>_FOUND Defined if <lib> has been found
# MAYA_<lib>_LIBRARY Path to <lib> library
# MAYA_INCLUDE_DIRS Path to the devkit's include directories
# MAYA_API_VERSION Maya version (6-8 digits)
# MAYA_APP_VERSION Maya app version (4 digits)
# MAYA_API_VERSION Maya API version (6-8 digits) - defined in MTypes.h
# MAYA_APP_VERSION Maya app version (4 digits) - either from MTypes.h or first 4 digits of MAYA_API_VERSION
# MAYA_LIGHTAPI_VERSION Maya light API version (1 or 2 or 3)
# MAYA_PREVIEW_RELEASE_VERSION Preview Release number (3 or more digits) in preview releases, 0 in official releases
#
Expand Down Expand Up @@ -89,21 +89,15 @@ endif()

if(IS_MACOSX)
# On OSX, setting MAYA_LOCATION to either the base installation dir (ie,
# `/Application/Autodesk/maya20xx`), or the Contents folder in the Maya.app dir
# (ie, `/Application/Autodesk/maya20xx/Maya.app/Contents`) are supported.
# `/Application/Autodesk/maya202x`), or the Contents folder in the Maya.app dir
# (ie, `/Application/Autodesk/maya202x/Maya.app/Contents`) are supported.
find_path(MAYA_BASE_DIR
include/maya/MFn.h
HINTS
"${MAYA_LOCATION}/../.."
"$ENV{MAYA_LOCATION}/../.."
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"/Applications/Autodesk/maya2020"
"/Applications/Autodesk/maya2019"
"/Applications/Autodesk/maya2018"
"/Applications/Autodesk/maya2017"
"/Applications/Autodesk/maya2016.5"
"/Applications/Autodesk/maya2016"
DOC
"Maya installation root directory"
)
Expand All @@ -125,12 +119,6 @@ elseif(IS_LINUX)
HINTS
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"/usr/autodesk/maya2020-x64"
"/usr/autodesk/maya2019-x64"
"/usr/autodesk/maya2018-x64"
"/usr/autodesk/maya2017-x64"
"/usr/autodesk/maya2016.5-x64"
"/usr/autodesk/maya2016-x64"
DOC
"Maya installation root directory"
)
Expand All @@ -151,12 +139,6 @@ elseif(IS_WINDOWS)
HINTS
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"C:/Program Files/Autodesk/Maya2020"
"C:/Program Files/Autodesk/Maya2019"
"C:/Program Files/Autodesk/Maya2018"
"C:/Program Files/Autodesk/Maya2017"
"C:/Program Files/Autodesk/Maya2016.5"
"C:/Program Files/Autodesk/Maya2016"
DOC
"Maya installation root directory"
)
Expand Down Expand Up @@ -290,10 +272,8 @@ endif()

# Determine the Python version and switch between mayapy and mayapy2.
set(MAYAPY_EXE mayapy)
set(MAYA_PY_VERSION 2)
if(${MAYA_APP_VERSION} STRGREATER_EQUAL "2021")
set(MAYA_PY_VERSION 3)

set(MAYA_PY_VERSION 3)
if(MAYA_APP_VERSION VERSION_EQUAL 2022)
# check to see if we have a mayapy2 executable
find_program(MAYA_PY_EXECUTABLE2
mayapy2
Expand Down
24 changes: 13 additions & 11 deletions doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ Before building the project, consult the following table to ensure you use the r

| Required | ![](images/windows.png) | ![](images/mac.png) | ![](images/linux.png) |
|:---------------------:|:-------------------------:|:------------------------------------------------------------:|:---------------------------:|
| Operating System | Windows 10 | High Sierra (10.13)<br>Mojave (10.14)<br>Catalina (10.15)<br>Big Sur (11.2.x)<br>Monterey (12.6) | CentOS 7/8<br>RHEL 8.6 |
| Compiler Requirement| Maya 2019 (VS 2017)<br>Maya 2020 (VS 2017)<br>Maya 2022 (VS 2017/2019)<br>Maya 2023 (VS 2019)<br>Maya 2024 (VS 2022) | Maya 2019 (Xcode 7.3.1)<br>Maya 2020 (Xcode 10.2.1)<br>Maya 2022 (Xcode 10.2.1)<br>Maya 2023 (Xcode 10.2.1)<br>Maya 2024 (Xcode 13.4) | Maya 2019 (gcc 6.3.1)<br>Maya 2020 (gcc 6.3.1)<br>Maya 2022 (gcc 6.3.1/9.3.1)<br>Maya 2023 (gcc 9.3.1)<br>Maya 2024 (gcc 11.2.1) |
| Operating System | Windows 10/11 | High Sierra (10.13)<br>Mojave (10.14)<br>Catalina (10.15)<br>Big Sur (11.2.x)<br>Monterey (12.6) | CentOS 7/8<br>RHEL 8.6<br>Rocky 8.6 |
| Compiler Requirement| Maya 2022 (VS 2017/2019)<br>Maya 2023 (VS 2019)<br>Maya 2024 (VS 2022) | Maya 2022 (Xcode 10.2.1)<br>Maya 2023 (Xcode 10.2.1)<br>Maya 2024 (Xcode 13.4) | Maya 2022 (gcc 6.3.1/9.3.1)<br>Maya 2023 (gcc 9.3.1)<br>Maya 2024 (gcc 11.2.1) |
| CMake Version (min/max) | 3.13 - 3.17 | 3.13 - 3.17 | 3.13 - 3.17 |
| Python | 2.7.15 or 3.7.7 or 3.9.7 | 2.7.15 or 3.7.7 or 3.9.7 | 2.7.15 or 3.7.7 or 3.9.7 |
| Python Packages | PyYAML, PySide, PyOpenGL, Jinja2 | PyYAML, PySide2, PyOpenGL, Jinja2 | PyYAML, PySide, PyOpenGL, Jinja2 |
| Build generator | Visual Studio, Ninja (Recommended) | XCode, Ninja (Recommended) | Ninja (Recommended) |
| Command processor | Visual Studio X64 2017 or 2019 command prompt | bash | bash |
| Supported Maya Version| 2019, 2020, 2022, 2023, 2024 | 2019, 2020, 2022, 2023, 2024 | 2019, 2020, 2022, 2023, 2024 |
| Supported Maya Version| 2022, 2023, 2024 | 2022, 2023, 2024 | 2022, 2023, 2024 |

| Optional | ![](images/windows.png) | ![](images/mac.png) | ![](images/linux.png) |
|:---------------------:|:-------------------------:|:------------------------------------------------------------:|:---------------------------:|
| Qt | Maya 2019 = 5.6.1<br>Maya 2020 = 5.12.5<br>Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 | Maya 2019 = 5.6.1<br>Maya 2020 = 5.12.5<br>Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 | Maya 2019 = 5.6.1<br>Maya 2020 = 5.12.5<br>Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 |
| Qt | Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 | Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 | Maya 2022 = 5.15.2<br>Maya 2023 = 5.15.2<br>Maya 2024 = 5.15.2 |

***NOTE:*** Visit the online Maya developer help document under ***Setting up your build environment*** for additional compiler requirements on different platforms.

Expand Down Expand Up @@ -54,7 +54,7 @@ To build the project with UFE support, you will need to use the headers and libr

https://www.autodesk.com/developer-network/platform-technologies/maya

***NOTE:*** UFE is only supported in Maya 2019 and later. Earlier versions of Maya should still be able to load the plug-ins but without the features enabled by UFE.
***NOTE:*** UFE is only supported in Maya 2019 and later.

#### 4. Download the source code

Expand Down Expand Up @@ -88,13 +88,13 @@ There are four arguments that must be passed to the script:

```
Linux:
➜ maya-usd python build.py --maya-location /usr/autodesk/maya2020 --pxrusd-location /usr/local/USD-Release --devkit-location /usr/local/devkitBase /usr/local/workspace
➜ maya-usd python build.py --maya-location /usr/autodesk/maya2024 --pxrusd-location /usr/local/USD-Release --devkit-location /usr/local/devkitBase /usr/local/workspace
MacOSX:
➜ maya-usd python build.py --maya-location /Applications/Autodesk/maya2020 --pxrusd-location /opt/local/USD-Release --devkit-location /opt/local/devkitBase /opt/local/workspace
➜ maya-usd python build.py --maya-location /Applications/Autodesk/maya2024 --pxrusd-location /opt/local/USD-Release --devkit-location /opt/local/devkitBase /opt/local/workspace
Windows:
c:\maya-usd> python build.py --maya-location "C:\Program Files\Autodesk\Maya2020" --pxrusd-location C:\USD-Release --devkit-location C:\devkitBase C:\workspace
c:\maya-usd> python build.py --maya-location "C:\Program Files\Autodesk\Maya2024" --pxrusd-location C:\USD-Release --devkit-location C:\devkitBase C:\workspace
```

##### Default Build Arguments
Expand Down Expand Up @@ -122,13 +122,15 @@ BUILD_MAYAUSD_LIBRARY | builds Core USD libraries.
BUILD_ADSK_PLUGIN | builds Autodesk USD plugin. | ON
BUILD_PXR_PLUGIN | builds the Pixar USD plugin and libraries. | ON
BUILD_AL_PLUGIN | builds the Animal Logic USD plugin and libraries. | ON
BUILD_HDMAYA | builds the Maya-To-Hydra plugin and scene delegate. | ON
BUILD_HDMAYA | builds the legacy Maya-To-Hydra plugin and scene delegate. | OFF
BUILD_RFM_TRANSLATORS | builds translators for RenderMan for Maya shaders. | ON
BUILD_TESTS | builds all unit tests. | ON
BUILD_STRICT_MODE | enforces all warnings as errors. | ON
BUILD_WITH_PYTHON_3 | build with python 3. | OFF
BUILD_SHARED_LIBS | build libraries as shared or static. | ON
BUILD_UB2 | build universal binary 2 (UB2) Intel64+arm64 (apple only) | OFF
CMAKE_WANT_UFE_BUILD | enables building with UFE (if found). | ON
CMAKE_WANT_MATERIALX_BUILD | enable building with MaterialX (experimental). | OFF

##### Stages

Expand Down Expand Up @@ -207,9 +209,9 @@ Test project /Users/sabrih/Desktop/workspace/build/Debug/plugin/al

It is important to use the Python version shipped with Maya and not the system version when building USD on MacOS. Note that this is primarily an issue on MacOS, where Maya's version of Python is likely to conflict with the version provided by the system.

To build USD and the Maya plug-ins on MacOS for Maya (2019, 2020, 2022, 2023, 2024), run:
To build USD and the Maya plug-ins on MacOS for Maya (2022, 2023, 2024), run:
```
/Applications/Autodesk/maya2019/Maya.app/Contents/bin/mayapy build_usd.py ~/Desktop/BUILD
/Applications/Autodesk/maya2024/Maya.app/Contents/bin/mayapy build_usd.py ~/Desktop/BUILD
```
By default, ``usdview`` is built which has a dependency on PyOpenGL. Since the Python version of Maya doesn't ship with PyOpenGL you will be prompted with the following error message:
```
Expand Down
3 changes: 2 additions & 1 deletion doc/codingGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ Headers should be included in the following order, with each section separated b
### Conditional compilation (Maya, USD, UFE version)
**Maya**
* `MAYA_API_VERSION` is the consistent macro to test Maya version (`MAYA_APP_VERSION` * 10000 + `MAJOR_VERSION` * 100 + `MINOR_VERSION`)
* `MAYA_APP_VERSION` is available only since Maya 2019 and is a simple year number, so it is not allowed.
* `MAYA_APP_VERSION` is a simple year number, so it is not allowed in C++ code. However it is set as a CMake variable and allowed in cmake files.

**UFE**
* `WANT_UFE_BUILD` equals 1 if UFE is found and it should be used for conditional compilation on codes depending on UFE.

Expand Down
4 changes: 0 additions & 4 deletions lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ GfMatrix4d getTransform(const UsdPrim& prim, const std::map<SdfPath, GfMatrix4d>

void getComponentTags(MFnMeshData& dataCreator, const UsdGeomMesh& mesh)
{
#if MAYA_API_VERSION >= 20220000

// Unclear at this time if this mesh requires roundtripping info
// for the component tags.
std::vector<UsdMayaMeshReadUtils::ComponentTagData> componentTags;
Expand All @@ -81,8 +79,6 @@ void getComponentTags(MFnMeshData& dataCreator, const UsdGeomMesh& mesh)

dataCreator.setComponentTagContents(name, content);
}

#endif
}
} // namespace

Expand Down
8 changes: 0 additions & 8 deletions lib/mayaUsd/fileio/jobs/readJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,7 @@ bool UsdMaya_ReadJob::_DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootP
prototypeNode.removeChildAt(prototypeNode.childCount() - 1);
}
}
#if MAYA_API_VERSION > 20200200
deletePrototypeMod.deleteNode(prototypeObject, false);
#else
deletePrototypeMod.deleteNode(prototypeObject);
#endif
}
prototypesLoop.loopAdvance();
}
Expand Down Expand Up @@ -749,11 +745,7 @@ bool UsdMaya_ReadJob::Undo()
}
}
}
#if MAYA_API_VERSION > 20200200
mDagModifierUndo.deleteNode(it.second, false);
#else
mDagModifierUndo.deleteNode(it.second);
#endif
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions lib/mayaUsd/fileio/shading/shadingModeDisplayColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@
#include <maya/MFnDependencyNode.h>
#include <maya/MFnLambertShader.h>
#include <maya/MFnSet.h>
#include <maya/MFnStandardSurfaceShader.h>
#include <maya/MObject.h>
#include <maya/MPlug.h>
#include <maya/MStatus.h>
#include <maya/MString.h>

#if MAYA_API_VERSION >= 20200000
#include <maya/MFnStandardSurfaceShader.h>
#endif

#include <string>

PXR_NAMESPACE_OPEN_SCOPE
Expand Down Expand Up @@ -136,7 +133,6 @@ DEFINE_SHADING_MODE_IMPORTER_WITH_JOB_ARGUMENTS(

MPlug outputPlug;
std::string surfaceNodeName;
#if MAYA_API_VERSION >= 20200000
if (preferredMaterial == UsdMayaPreferredMaterialTokens->standardSurface) {
MFnStandardSurfaceShader surfaceFn;
surfaceFn.setObject(shadingObj);
Expand All @@ -154,9 +150,7 @@ DEFINE_SHADING_MODE_IMPORTER_WITH_JOB_ARGUMENTS(
// shading engine.
outputPlug = surfaceFn.findPlug("outColor", &status);
CHECK_MSTATUS_AND_RETURN(status, MObject());
} else
#endif
if (preferredMaterial == UsdMayaPreferredMaterialTokens->usdPreviewSurface) {
} else if (preferredMaterial == UsdMayaPreferredMaterialTokens->usdPreviewSurface) {
MFnDependencyNode depNodeFn;
depNodeFn.setObject(shadingObj);
surfaceNodeName = depNodeFn.name().asChar();
Expand Down
5 changes: 0 additions & 5 deletions lib/mayaUsd/fileio/shading/shadingModePxrRis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,7 @@ _ComputeShadingNodeTypeForShaderId(const TfToken& shaderId, const UsdMayaShading

// Loop over the compoundClassifications, though I believe
// compoundClassifications will always have size 0 or 1.
#if MAYA_API_VERSION >= 20190000
for (const MString& compoundClassification : compoundClassifications) {
#else
for (unsigned int i = 0; i < compoundClassifications.length(); ++i) {
const MString& compoundClassification = compoundClassifications[i];
#endif
const std::string compoundClassificationStr(compoundClassification.asChar());
for (const std::string& classification : TfStringSplit(compoundClassificationStr, ":")) {
for (const auto& classPrefixAndType : _classificationsToTypes) {
Expand Down
5 changes: 0 additions & 5 deletions lib/mayaUsd/fileio/translators/translatorCurves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ bool convertToBezier(MFnNurbsCurve& nurbsCurveFn, MObject& mayaNodeTransformObj,
// Remove the nurbs and converter:
MDGModifier& dagm = MayaUsd::MDGModifierUndoItem::create("Nurbs curve deletion");
dagm.deleteNode(convFn.object());
#if MAYA_API_VERSION >= 20200300
dagm.deleteNode(nurbsCurveFn.object(), false);
#else
dagm.deleteNode(nurbsCurveFn.object());
#endif

dagm.doIt();
// replace deleted nurbs node with bezier node
nurbsCurveFn.setObject(curveObj);
Expand Down
49 changes: 0 additions & 49 deletions lib/mayaUsd/fileio/translators/translatorMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,8 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode(
const MFnDagNode dagNodeFn(mayaObj, &status);
CHECK_MSTATUS(status);

#if MAYA_API_VERSION >= 20220000
status = MGlobal::selectByName(dagNodeFn.fullPathName().asChar());
CHECK_MSTATUS(status);
#endif

// Create the point based deformer node for this prim.
const std::string pointBasedDeformerNodeName = TfStringPrintf(
Expand Down Expand Up @@ -452,53 +450,6 @@ MStatus TranslatorMeshRead::setPointBasedDeformerForMayaNode(
status = dgMod.doIt();
CHECK_MSTATUS(status);

// The deformer command changed in Maya 2022 to no longer add a tweak,
// so only modify the tweak when in Maya 2020 or earlier.
#if MAYA_API_VERSION < 20220000

// Add the Maya object to the point based deformer node's set.
const MFnGeometryFilter geomFilterFn(m_pointBasedDeformerNode, &status);
CHECK_MSTATUS(status);

MObject deformerSet = geomFilterFn.deformerSet(&status);
CHECK_MSTATUS(status);

MFnSet setFn(deformerSet, &status);
CHECK_MSTATUS(status);

status = setFn.addMember(mayaObj);
CHECK_MSTATUS(status);

// When we created the point based deformer, Maya will have automatically
// created a tweak deformer and put it *before* the point based deformer in
// the deformer chain. We don't want that, since any component edits made
// interactively in Maya will appear to have no effect since they'll be
// overridden by the point based deformer. Instead, we want the tweak to go
// *after* the point based deformer. To do this, we need to dig for the
// name of the tweak deformer node that Maya created to be able to pass it
// to the reorderDeformers command.

// XXX: This seems to be the "most sane" way of finding the tweak deformer
// node's name...
const std::string findTweakCmd = TfStringPrintf(
"from maya import cmds; [x for x in cmds.listHistory(\'%s\') if cmds.nodeType(x) == "
"\'tweak\'][0]",
dagNodeFn.fullPathName().asChar());

MString tweakDeformerNodeName;
status = MGlobal::executePythonCommand(findTweakCmd.c_str(), tweakDeformerNodeName);
CHECK_MSTATUS(status);

// Do the reordering.
const std::string reorderDeformersCmd = TfStringPrintf(
"from maya import cmds; cmds.reorderDeformers(\'%s\', \'%s\', \'%s\')",
tweakDeformerNodeName.asChar(),
m_newPointBasedDeformerName.asChar(),
dagNodeFn.fullPathName().asChar());
status = MGlobal::executePythonCommand(reorderDeformersCmd.c_str());
CHECK_MSTATUS(status);
#endif

return status;
}

Expand Down
Loading

0 comments on commit 28f3469

Please sign in to comment.