From 3e5b9bbe25bfcf9a05f6031beaec08eb97b0ad73 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 26 May 2023 16:25:45 -0400 Subject: [PATCH 01/11] MAYA-129259 - MayaUsd: drop support for Maya 2018/2019/2020 and Qt 5.6.1 & 5.12.5 * cmake/doc changes to remove old Maya (2018/2019/2020) support. --- CMakeLists.txt | 28 ++------- cmake/modules/FindMaya.cmake | 32 ++-------- doc/build.md | 24 +++---- doc/codingGuidelines.md | 3 +- lib/usd/translators/shading/CMakeLists.txt | 10 +-- test/lib/CMakeLists.txt | 2 +- test/lib/mayaUsd/fileio/CMakeLists.txt | 6 +- .../render/vp2RenderDelegate/CMakeLists.txt | 15 ++--- test/lib/usd/translators/CMakeLists.txt | 63 +++++++++---------- 9 files changed, 63 insertions(+), 120 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f36033e90f..c8149a6808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/cmake/modules/FindMaya.cmake b/cmake/modules/FindMaya.cmake index 42cb0f497d..6eed02acd7 100644 --- a/cmake/modules/FindMaya.cmake +++ b/cmake/modules/FindMaya.cmake @@ -9,8 +9,8 @@ # MAYA__FOUND Defined if has been found # MAYA__LIBRARY Path to 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 # @@ -89,8 +89,8 @@ 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 @@ -98,12 +98,6 @@ if(IS_MACOSX) "$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" ) @@ -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" ) @@ -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" ) @@ -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 diff --git a/doc/build.md b/doc/build.md index 4d21289c9f..4986ab9dc1 100644 --- a/doc/build.md +++ b/doc/build.md @@ -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)
Mojave (10.14)
Catalina (10.15)
Big Sur (11.2.x)
Monterey (12.6) | CentOS 7/8
RHEL 8.6 | -| Compiler Requirement| Maya 2019 (VS 2017)
Maya 2020 (VS 2017)
Maya 2022 (VS 2017/2019)
Maya 2023 (VS 2019)
Maya 2024 (VS 2022) | Maya 2019 (Xcode 7.3.1)
Maya 2020 (Xcode 10.2.1)
Maya 2022 (Xcode 10.2.1)
Maya 2023 (Xcode 10.2.1)
Maya 2024 (Xcode 13.4) | Maya 2019 (gcc 6.3.1)
Maya 2020 (gcc 6.3.1)
Maya 2022 (gcc 6.3.1/9.3.1)
Maya 2023 (gcc 9.3.1)
Maya 2024 (gcc 11.2.1) | +| Operating System | Windows 10/11 | High Sierra (10.13)
Mojave (10.14)
Catalina (10.15)
Big Sur (11.2.x)
Monterey (12.6) | CentOS 7/8
RHEL 8.6
Rocky 8.6 | +| Compiler Requirement| Maya 2022 (VS 2017/2019)
Maya 2023 (VS 2019)
Maya 2024 (VS 2022) | Maya 2022 (Xcode 10.2.1)
Maya 2023 (Xcode 10.2.1)
Maya 2024 (Xcode 13.4) | Maya 2022 (gcc 6.3.1/9.3.1)
Maya 2023 (gcc 9.3.1)
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
Maya 2020 = 5.12.5
Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
Maya 2024 = 5.15.2 | Maya 2019 = 5.6.1
Maya 2020 = 5.12.5
Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
Maya 2024 = 5.15.2 | Maya 2019 = 5.6.1
Maya 2020 = 5.12.5
Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
Maya 2024 = 5.15.2 | +| Qt | Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
Maya 2024 = 5.15.2 | Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
Maya 2024 = 5.15.2 | Maya 2022 = 5.15.2
Maya 2023 = 5.15.2
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. @@ -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 @@ -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 @@ -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 @@ -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: ``` diff --git a/doc/codingGuidelines.md b/doc/codingGuidelines.md index 6d95b29803..500275673d 100644 --- a/doc/codingGuidelines.md +++ b/doc/codingGuidelines.md @@ -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. diff --git a/lib/usd/translators/shading/CMakeLists.txt b/lib/usd/translators/shading/CMakeLists.txt index 97b723a4b4..3424f4243e 100644 --- a/lib/usd/translators/shading/CMakeLists.txt +++ b/lib/usd/translators/shading/CMakeLists.txt @@ -18,6 +18,8 @@ target_sources(${TARGET_NAME} usdReflectWriter.cpp usdUVTextureReader.cpp usdPrimvarReaderFloat3Reader.cpp + usdStandardSurfaceReader.cpp + usdStandardSurfaceWriter.cpp ) if (BUILD_RFM_TRANSLATORS) @@ -27,14 +29,6 @@ if (BUILD_RFM_TRANSLATORS) ) endif() -if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2020) - target_sources(${TARGET_NAME} - PRIVATE - usdStandardSurfaceReader.cpp - usdStandardSurfaceWriter.cpp - ) -endif() - # Edit as Maya requires UFE path mapping. if(CMAKE_UFE_V3_FEATURES_AVAILABLE) target_sources(${TARGET_NAME} diff --git a/test/lib/CMakeLists.txt b/test/lib/CMakeLists.txt index 6075b6cdbf..e878de94f6 100644 --- a/test/lib/CMakeLists.txt +++ b/test/lib/CMakeLists.txt @@ -6,7 +6,7 @@ set(TEST_SCRIPT_FILES testMayaUsdCacheId.py ) -if (UFE_FOUND AND MAYA_APP_VERSION VERSION_GREATER 2020) +if (UFE_FOUND) list(APPEND TEST_SCRIPT_FILES testMayaUsdDirtyScene.py testMayaUsdProxyAccessor.py diff --git a/test/lib/mayaUsd/fileio/CMakeLists.txt b/test/lib/mayaUsd/fileio/CMakeLists.txt index 9c1bc1e14a..1b33dda4a0 100644 --- a/test/lib/mayaUsd/fileio/CMakeLists.txt +++ b/test/lib/mayaUsd/fileio/CMakeLists.txt @@ -1,4 +1,5 @@ set(TEST_SCRIPT_FILES + testComponentTags.py testPrimReader.py testPrimWriter.py testExportChaser.py @@ -11,11 +12,6 @@ set(TEST_SCRIPT_FILES # will be skipped if not found (probably because BUILD_PXR_PLUGIN is off). testSchemaApiAdaptor.py ) -if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) - list(APPEND TEST_SCRIPT_FILES - testComponentTags.py - ) -endif() if(CMAKE_UFE_V3_FEATURES_AVAILABLE) list(APPEND TEST_SCRIPT_FILES diff --git a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt index a37d7ab110..ebce3053fe 100644 --- a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt +++ b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt @@ -17,11 +17,6 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) testVP2RenderDelegatePrimPath.py testVP2RenderDelegateUSDPreviewSurface.py testVP2RenderDelegateConsolidation.py - ) -endif() - -if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) - list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegatePerInstanceInheritedData.py testVP2RenderDelegateBasisCurves.py testVP2RenderDelegateDrawModes.py @@ -29,12 +24,10 @@ if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) ) endif() -if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) - if (CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND TEST_SCRIPT_FILES - testVP2RenderDelegateUsdCamera.py - ) - endif() +if (CMAKE_UFE_V2_FEATURES_AVAILABLE) + list(APPEND TEST_SCRIPT_FILES + testVP2RenderDelegateUsdCamera.py + ) endif() if (MAYA_APP_VERSION VERSION_GREATER 2022) diff --git a/test/lib/usd/translators/CMakeLists.txt b/test/lib/usd/translators/CMakeLists.txt index 91f1391cb1..9debe78e15 100644 --- a/test/lib/usd/translators/CMakeLists.txt +++ b/test/lib/usd/translators/CMakeLists.txt @@ -198,42 +198,39 @@ mayaUsd_add_test(testUsdImportChaser ) set_property(TEST testUsdImportChaser APPEND PROPERTY LABELS translators) -# Test using standardSurface, which was introduced in Maya 2020. -if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2020) - set(CUSTOM_TEST_SCRIPT_FILES - testUsdExportCustomConverter.template.py - testUsdImportCustomConverter.template.py - ) - set(PLUGIN_TYPES - Maya - USD +set(CUSTOM_TEST_SCRIPT_FILES + testUsdExportCustomConverter.template.py + testUsdImportCustomConverter.template.py +) +set(PLUGIN_TYPES + Maya + USD +) +foreach(template_script ${CUSTOM_TEST_SCRIPT_FILES}) + string(REGEX REPLACE "\\.template.py" ".py" script + "${template_script}") + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${template_script}" + "${CMAKE_CURRENT_BINARY_DIR}/${script}" + @ONLY ) - foreach(template_script ${CUSTOM_TEST_SCRIPT_FILES}) - string(REGEX REPLACE "\\.template.py" ".py" script - "${template_script}") - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/${template_script}" - "${CMAKE_CURRENT_BINARY_DIR}/${script}" - @ONLY - ) - foreach(plugin_type ${PLUGIN_TYPES}) - mayaUsd_get_unittest_target(module ${script}) - set(target "${module}-${plugin_type}") - mayaUsd_add_test(${target} - PYTHON_MODULE ${module} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ENV - "MAYA_PLUG_IN_PATH=${CMAKE_CURRENT_BINARY_DIR}/../plugin" - "${PXR_OVERRIDE_PLUGINPATH_NAME}=${CMAKE_CURRENT_BINARY_DIR}/../plugin/${plugin_type}" - "INPUT_PATH=${CMAKE_CURRENT_SOURCE_DIR}" - "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" - "USD_FORCE_DEFAULT_MATERIALS_SCOPE_NAME=1" - ) - set_property(TEST ${target} APPEND PROPERTY LABELS translators) - endforeach() + foreach(plugin_type ${PLUGIN_TYPES}) + mayaUsd_get_unittest_target(module ${script}) + set(target "${module}-${plugin_type}") + mayaUsd_add_test(${target} + PYTHON_MODULE ${module} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ENV + "MAYA_PLUG_IN_PATH=${CMAKE_CURRENT_BINARY_DIR}/../plugin" + "${PXR_OVERRIDE_PLUGINPATH_NAME}=${CMAKE_CURRENT_BINARY_DIR}/../plugin/${plugin_type}" + "INPUT_PATH=${CMAKE_CURRENT_SOURCE_DIR}" + "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" + "USD_FORCE_DEFAULT_MATERIALS_SCOPE_NAME=1" + ) + set_property(TEST ${target} APPEND PROPERTY LABELS translators) endforeach() -endif() +endforeach() # These import/export tests will work with older versions of Maya and USD. # However getting the test materials to appear in the Maya viewport will From ad060d18b9e9fba89fa121acbe011a156dc76f90 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 26 May 2023 17:19:35 -0400 Subject: [PATCH 02/11] MAYA-129259 - MayaUsd: drop support for Maya 2018/2019/2020 and Qt 5.6.1 & 5.12.5 * Code change to remove older Maya (2018/2019/2020) support. --- lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp | 4 - lib/mayaUsd/fileio/jobs/readJob.cpp | 8 -- .../shading/shadingModeDisplayColor.cpp | 10 +- .../fileio/shading/shadingModePxrRis.cpp | 5 - .../fileio/translators/translatorCurves.cpp | 5 - .../fileio/translators/translatorMesh.cpp | 49 ---------- .../fileio/translators/translatorUtil.cpp | 5 - lib/mayaUsd/fileio/utils/meshReadUtils.cpp | 4 - lib/mayaUsd/fileio/utils/meshReadUtils.h | 4 - lib/mayaUsd/fileio/utils/meshWriteUtils.cpp | 4 - lib/mayaUsd/fileio/utils/meshWriteUtils.h | 4 - lib/mayaUsd/nodes/proxyAccessor.cpp | 9 +- lib/mayaUsd/nodes/proxyShapeBase.cpp | 12 +-- lib/mayaUsd/nodes/proxyShapeBase.h | 2 - lib/mayaUsd/python/wrapOpenMaya.cpp | 20 ---- .../render/mayaToHydra/renderOverride.cpp | 6 -- .../render/mayaToHydra/renderOverride.h | 21 +--- lib/mayaUsd/render/px_vp20/utils_legacy.h | 11 --- .../render/pxrUsdMayaGL/batchRenderer.cpp | 10 +- .../render/pxrUsdMayaGL/batchRenderer.h | 21 +--- .../render/pxrUsdMayaGL/hdImagingShapeUI.h | 13 +-- .../pxrUsdMayaGL/instancerShapeAdapter.h | 15 +-- .../render/pxrUsdMayaGL/proxyShapeUI.h | 11 --- .../render/pxrUsdMayaGL/shapeAdapter.h | 18 +--- .../pxrUsdMayaGL/usdProxyShapeAdapter.h | 15 +-- .../render/vp2RenderDelegate/basisCurves.cpp | 27 +----- .../render/vp2RenderDelegate/material.cpp | 97 ------------------- .../render/vp2RenderDelegate/material.h | 2 +- .../vp2RenderDelegate/mayaPrimCommon.cpp | 10 -- lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp | 20 +--- .../vp2RenderDelegate/meshViewportCompute.h | 1 - .../render/vp2RenderDelegate/points.cpp | 16 +-- .../vp2RenderDelegate/proxyRenderDelegate.cpp | 26 +---- .../vp2RenderDelegate/proxyRenderDelegate.h | 9 +- .../vp2RenderDelegate/render_delegate.cpp | 10 +- .../vp2ShaderFragments/shaderFragments.cpp | 12 --- lib/mayaUsd/utils/converter.cpp | 15 +-- lib/mayaUsd/utils/util.cpp | 12 +-- lib/usd/hdMaya/adapters/meshAdapter.cpp | 14 --- lib/usd/hdMaya/delegates/delegate.h | 2 - lib/usd/hdMaya/delegates/proxyDelegate.cpp | 4 +- lib/usd/hdMaya/delegates/proxyDelegate.h | 2 - lib/usd/hdMaya/delegates/sceneDelegate.cpp | 2 - lib/usd/hdMaya/delegates/sceneDelegate.h | 2 - lib/usd/translators/meshReader.cpp | 4 - lib/usd/translators/meshWriter.cpp | 4 - lib/usd/ui/layerEditor/mayaCommandHook.cpp | 6 +- plugin/adsk/plugin/ProxyShape.cpp | 2 - .../lib/AL_USDMaya/AL/usdmaya/StageCache.cpp | 9 +- .../AL/usdmaya/fileio/AnimationTranslator.cpp | 10 -- .../AL_USDMaya/AL/usdmaya/fileio/Export.cpp | 5 - .../AL/usdmaya/fileio/ExportParams.h | 3 - .../AL/usdmaya/fileio/ExportTranslator.cpp | 2 - .../AL/usdmaya/fileio/ExportTranslator.h | 6 -- .../translators/TransformTranslator.cpp | 12 --- .../fileio/translators/TransformTranslator.h | 4 - .../fileio/translators/TranslatorBase.cpp | 10 +- .../fileio/translators/TranslatorContext.cpp | 10 +- .../AL_USDMaya/AL/usdmaya/nodes/Engine.cpp | 9 +- .../AL/usdmaya/nodes/LayerManager.cpp | 9 +- .../AL/usdmaya/nodes/ProxyShape.cpp | 12 +-- .../AL/usdmaya/nodes/ProxyShapeSelection.cpp | 10 +- .../lib/AL_USDMaya/AL/usdmaya/nodes/Scope.cpp | 7 -- .../lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h | 6 -- .../AL_USDMaya/AL/usdmaya/nodes/Transform.cpp | 16 +-- .../AL/usdmaya/nodes/TransformationMatrix.cpp | 10 +- .../AL/usdmaya/nodes/proxy/PrimFilter.cpp | 9 +- .../nodes/proxy/ProxyShapeMetaData.cpp | 10 +- .../proxy/ProxyShapeVariantFallbacks.cpp | 7 +- .../test_translators_TransformTranslator.cpp | 4 - plugin/al/translators/Camera.cpp | 9 +- plugin/al/translators/MayaReference.cpp | 9 +- plugin/al/translators/Mesh.cpp | 9 +- plugin/al/translators/NurbsCurve.cpp | 9 +- .../AL/usdmaya/utils/AnimationTranslator.cpp | 13 +-- .../AL/usdmaya/utils/AnimationTranslator.h | 4 - 76 files changed, 63 insertions(+), 755 deletions(-) diff --git a/lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp b/lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp index 7ebe2b9680..8afba52951 100644 --- a/lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp +++ b/lib/mayaUsd/fileio/jobs/meshDataReadJob.cpp @@ -63,8 +63,6 @@ GfMatrix4d getTransform(const UsdPrim& prim, const std::map 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 componentTags; @@ -81,8 +79,6 @@ void getComponentTags(MFnMeshData& dataCreator, const UsdGeomMesh& mesh) dataCreator.setComponentTagContents(name, content); } - -#endif } } // namespace diff --git a/lib/mayaUsd/fileio/jobs/readJob.cpp b/lib/mayaUsd/fileio/jobs/readJob.cpp index ef1d5ad072..f07ecf2cc5 100644 --- a/lib/mayaUsd/fileio/jobs/readJob.cpp +++ b/lib/mayaUsd/fileio/jobs/readJob.cpp @@ -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(); } @@ -749,11 +745,7 @@ bool UsdMaya_ReadJob::Undo() } } } -#if MAYA_API_VERSION > 20200200 mDagModifierUndo.deleteNode(it.second, false); -#else - mDagModifierUndo.deleteNode(it.second); -#endif } } } diff --git a/lib/mayaUsd/fileio/shading/shadingModeDisplayColor.cpp b/lib/mayaUsd/fileio/shading/shadingModeDisplayColor.cpp index 7c2baa6396..b69f0f22bd 100644 --- a/lib/mayaUsd/fileio/shading/shadingModeDisplayColor.cpp +++ b/lib/mayaUsd/fileio/shading/shadingModeDisplayColor.cpp @@ -46,15 +46,12 @@ #include #include #include +#include #include #include #include #include -#if MAYA_API_VERSION >= 20200000 -#include -#endif - #include PXR_NAMESPACE_OPEN_SCOPE @@ -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); @@ -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(); diff --git a/lib/mayaUsd/fileio/shading/shadingModePxrRis.cpp b/lib/mayaUsd/fileio/shading/shadingModePxrRis.cpp index c0f0f05752..30b0eb0885 100644 --- a/lib/mayaUsd/fileio/shading/shadingModePxrRis.cpp +++ b/lib/mayaUsd/fileio/shading/shadingModePxrRis.cpp @@ -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) { diff --git a/lib/mayaUsd/fileio/translators/translatorCurves.cpp b/lib/mayaUsd/fileio/translators/translatorCurves.cpp index d62f77a78b..bc8b577a14 100644 --- a/lib/mayaUsd/fileio/translators/translatorCurves.cpp +++ b/lib/mayaUsd/fileio/translators/translatorCurves.cpp @@ -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); diff --git a/lib/mayaUsd/fileio/translators/translatorMesh.cpp b/lib/mayaUsd/fileio/translators/translatorMesh.cpp index 7f18006224..5b874c3aa2 100644 --- a/lib/mayaUsd/fileio/translators/translatorMesh.cpp +++ b/lib/mayaUsd/fileio/translators/translatorMesh.cpp @@ -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( @@ -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; } diff --git a/lib/mayaUsd/fileio/translators/translatorUtil.cpp b/lib/mayaUsd/fileio/translators/translatorUtil.cpp index 19ca344236..8b80d3b5a3 100644 --- a/lib/mayaUsd/fileio/translators/translatorUtil.cpp +++ b/lib/mayaUsd/fileio/translators/translatorUtil.cpp @@ -333,12 +333,7 @@ UsdMayaTranslatorUtil::ComputeShadingNodeTypeForMayaTypeName(const TfToken& maya // 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 = 0u; 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) { diff --git a/lib/mayaUsd/fileio/utils/meshReadUtils.cpp b/lib/mayaUsd/fileio/utils/meshReadUtils.cpp index 7abe7be237..ad0797fef1 100644 --- a/lib/mayaUsd/fileio/utils/meshReadUtils.cpp +++ b/lib/mayaUsd/fileio/utils/meshReadUtils.cpp @@ -892,8 +892,6 @@ MStatus UsdMayaMeshReadUtils::assignSubDivTagsToMesh( return MS::kSuccess; } -#if MAYA_API_VERSION >= 20220000 - bool UsdMayaMeshReadUtils::getGeomSubsetInfo(const MObject& mesh, JsValue& meshRoundtripData) { MFnDependencyNode depNodeFn(mesh); @@ -1077,6 +1075,4 @@ MStatus UsdMayaMeshReadUtils::createComponentTags(const UsdGeomMesh& mesh, const return status; } -#endif - PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/fileio/utils/meshReadUtils.h b/lib/mayaUsd/fileio/utils/meshReadUtils.h index d52f49f0bd..222a17cd98 100644 --- a/lib/mayaUsd/fileio/utils/meshReadUtils.h +++ b/lib/mayaUsd/fileio/utils/meshReadUtils.h @@ -90,8 +90,6 @@ void assignInvisibleFaces(const UsdGeomMesh& mesh, const MObject& meshObj); MAYAUSD_CORE_PUBLIC MStatus assignSubDivTagsToMesh(const UsdGeomMesh&, MObject&, MFnMesh&); -#if MAYA_API_VERSION >= 20220000 - /// Gets the internal UsdGeomSubset info on the Maya \p mesh, placing it in /// \p value. Returns true if the info exists on the mesh, and false if not. MAYAUSD_CORE_PUBLIC @@ -114,8 +112,6 @@ MStatus getComponentTags( std::vector& tags, JsValue& meshRoundtripData); -#endif - } // namespace UsdMayaMeshReadUtils PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp b/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp index 90768f0d11..b20fc6dff9 100644 --- a/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp +++ b/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp @@ -1397,8 +1397,6 @@ bool UsdMayaMeshWriteUtils::getMeshColorSetData( return true; } -#if MAYA_API_VERSION >= 20220000 - MStatus UsdMayaMeshWriteUtils::exportComponentTags(UsdGeomMesh& primSchema, MObject obj) { MStatus status { MS::kSuccess }; @@ -1480,6 +1478,4 @@ MStatus UsdMayaMeshWriteUtils::exportComponentTags(UsdGeomMesh& primSchema, MObj return status; } -#endif - PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/fileio/utils/meshWriteUtils.h b/lib/mayaUsd/fileio/utils/meshWriteUtils.h index 133c4280f6..5f22bf07df 100644 --- a/lib/mayaUsd/fileio/utils/meshWriteUtils.h +++ b/lib/mayaUsd/fileio/utils/meshWriteUtils.h @@ -242,13 +242,9 @@ bool getMeshColorSetData( MFnMesh::MColorRepresentation* colorSetRep, bool* clamped); -#if MAYA_API_VERSION >= 20220000 - MAYAUSD_CORE_PUBLIC MStatus exportComponentTags(UsdGeomMesh& primSchema, MObject obj); -#endif - } // namespace UsdMayaMeshWriteUtils PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/nodes/proxyAccessor.cpp b/lib/mayaUsd/nodes/proxyAccessor.cpp index 19c237f08a..b9be31f898 100644 --- a/lib/mayaUsd/nodes/proxyAccessor.cpp +++ b/lib/mayaUsd/nodes/proxyAccessor.cpp @@ -146,14 +146,7 @@ class ComputeContext namespace { //! Profiler category for proxy accessor events -const int _accessorProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "ProxyAccessor", - "ProxyAccessor" -#else - "ProxyAccessor" -#endif -); +const int _accessorProfilerCategory = MProfiler::addCategory("ProxyAccessor", "ProxyAccessor"); static const TfToken combinedVisibilityToken("combinedVisibility"); diff --git a/lib/mayaUsd/nodes/proxyShapeBase.cpp b/lib/mayaUsd/nodes/proxyShapeBase.cpp index 2fd6caa1d9..0a20719be5 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.cpp +++ b/lib/mayaUsd/nodes/proxyShapeBase.cpp @@ -213,14 +213,8 @@ void createNewAnonSubLayerRecursive( } } //! Profiler category for proxy accessor events -const int _shapeBaseProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "ProxyShapeBase", - "ProxyShapeBase events" -#else - "ProxyShapeBase" -#endif -); +const int _shapeBaseProfilerCategory + = MProfiler::addCategory("ProxyShapeBase", "ProxyShapeBase events"); struct InComputeGuard { @@ -1671,7 +1665,6 @@ MStatus MayaUsdProxyShapeBase::setDependentsDirty(const MPlug& plug, MPlugArray& return retValue; } -#if MAYA_API_VERSION >= 20210000 /* virtual */ void MayaUsdProxyShapeBase::getCacheSetup( const MEvaluationNode& evalNode, @@ -1697,7 +1690,6 @@ void MayaUsdProxyShapeBase::configCache(const MEvaluationNode& evalNode, MCacheS schema.add(outStageDataAttr); } } -#endif UsdPrim MayaUsdProxyShapeBase::_GetUsdPrim(MDataBlock dataBlock) const { diff --git a/lib/mayaUsd/nodes/proxyShapeBase.h b/lib/mayaUsd/nodes/proxyShapeBase.h index a65460c480..1d1fb3f4d5 100644 --- a/lib/mayaUsd/nodes/proxyShapeBase.h +++ b/lib/mayaUsd/nodes/proxyShapeBase.h @@ -239,7 +239,6 @@ class MayaUsdProxyShapeBase const MEvaluationNode& evaluationNode, PostEvaluationType evalType) override; -#if MAYA_API_VERSION >= 20210000 MAYAUSD_CORE_PUBLIC void getCacheSetup( const MEvaluationNode& evalNode, @@ -249,7 +248,6 @@ class MayaUsdProxyShapeBase MAYAUSD_CORE_PUBLIC void configCache(const MEvaluationNode& evalNode, MCacheSchema& schema) const override; -#endif MAYAUSD_CORE_PUBLIC MStatus setDependentsDirty(const MPlug& plug, MPlugArray& plugArray) override; diff --git a/lib/mayaUsd/python/wrapOpenMaya.cpp b/lib/mayaUsd/python/wrapOpenMaya.cpp index 58aabf5288..3b086daa56 100644 --- a/lib/mayaUsd/python/wrapOpenMaya.cpp +++ b/lib/mayaUsd/python/wrapOpenMaya.cpp @@ -19,11 +19,8 @@ #include // Hack because MDGModifier assign operator is not public. -// For 2019, the hack is different see MDGModifier2019 in this file -#if MAYA_API_VERSION >= 20200000 #undef OPENMAYA_PRIVATE #define OPENMAYA_PRIVATE public -#endif #include #include @@ -45,23 +42,6 @@ template void copyOperator(void* dst, const MayaClass& object) *((MayaClass*)(dst)) = object; } -// Hack to have access at MDGModifier assign operator from OpenMaya 2019 -#if MAYA_API_VERSION < 20200000 -class MDGModifier2019 : public MDGModifier -{ -public: - MDGModifier2019& operator=(const MDGModifier2019& rhs) - { - MDGModifier::operator=(rhs); - return *this; - } -}; -template <> void copyOperator(void* dst, const MDGModifier& object) -{ - *((MDGModifier2019*)(dst)) = (MDGModifier2019&)object; -} -#endif - /* Should be detectable detecting maya_useNewAPI in plugin # Using the Maya Python API 2.0. diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp index 5213914180..ecf7e33b71 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp @@ -120,8 +120,6 @@ class UfeSelectionObserver : public UFE_NS::Observer #endif // WANT_UFE_BUILD -#if MAYA_API_VERSION >= 20210000 - //! \brief Get the index of the hit nearest to a given cursor point. int GetNearestHitIndex( const MHWRender::MFrameContext& frameContext, @@ -192,8 +190,6 @@ void ResolveUniqueHits_Workaround(const HdxPickHitVector& inHits, HdxPickHitVect } } -#endif - } // namespace MtohRenderOverride::MtohRenderOverride(const MtohRendererDescription& desc) @@ -980,7 +976,6 @@ bool MtohRenderOverride::nextRenderOperation() return ++_currentOperation < static_cast(_operations.size()); } -#if MAYA_API_VERSION >= 20210000 bool MtohRenderOverride::select( const MHWRender::MFrameContext& frameContext, const MHWRender::MSelectionInfo& selectInfo, @@ -1083,7 +1078,6 @@ bool MtohRenderOverride::select( return true; } -#endif void MtohRenderOverride::_ClearHydraCallback(void* data) { diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.h b/lib/mayaUsd/render/mayaToHydra/renderOverride.h index ebf84d53e8..2ecb7a9411 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.h +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.h @@ -91,14 +91,12 @@ class MtohRenderOverride : public MHWRender::MRenderOverride MHWRender::MRenderOperation* renderOperation() override; bool nextRenderOperation() override; -#if MAYA_API_VERSION >= 20210000 bool select( const MHWRender::MFrameContext& frameContext, const MHWRender::MSelectionInfo& selectInfo, bool useDepth, MSelectionList& selectionList, MPointArray& worldSpaceHitPts) override; -#endif private: typedef std::pair PanelCallbacks; @@ -165,28 +163,17 @@ class MtohRenderOverride : public MHWRender::MRenderOverride HdRenderIndex* _renderIndex = nullptr; std::unique_ptr _defaultLightDelegate = nullptr; HdxSelectionTrackerSharedPtr _selectionTracker; - HdRprimCollection _renderCollection - { - HdTokens->geometry, - HdReprSelector( -#if MAYA_APP_VERSION >= 2019 - HdReprTokens->refined -#else - HdReprTokens->smoothHull -#endif - ), - SdfPath::AbsoluteRootPath() - }; - HdRprimCollection _selectionCollection { HdReprTokens->wire, + HdRprimCollection _renderCollection { HdTokens->geometry, + HdReprSelector(HdReprTokens->refined), + SdfPath::AbsoluteRootPath() }; + HdRprimCollection _selectionCollection { HdReprTokens->wire, HdReprSelector(HdReprTokens->wire) }; -#if MAYA_API_VERSION >= 20210000 HdRprimCollection _pointSnappingCollection { HdTokens->geometry, HdReprSelector(HdReprTokens->refined, TfToken(), HdReprTokens->points), SdfPath::AbsoluteRootPath() }; -#endif GlfSimpleLight _defaultLight; diff --git a/lib/mayaUsd/render/px_vp20/utils_legacy.h b/lib/mayaUsd/render/px_vp20/utils_legacy.h index ed48aca9d3..233dd67c82 100644 --- a/lib/mayaUsd/render/px_vp20/utils_legacy.h +++ b/lib/mayaUsd/render/px_vp20/utils_legacy.h @@ -18,17 +18,6 @@ /// \file px_vp20/utils_legacy.h -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp index db0dac0870..949cc637d8 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp +++ b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp @@ -91,14 +91,8 @@ TF_DEFINE_PRIVATE_TOKENS( TF_INSTANTIATE_SINGLETON(UsdMayaGLBatchRenderer); -const int UsdMayaGLBatchRenderer::ProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "UsdMayaGLBatchRenderer", - "UsdMayaGLBatchRenderer" -#else - "UsdMayaGLBatchRenderer" -#endif -); +const int UsdMayaGLBatchRenderer::ProfilerCategory + = MProfiler::addCategory("UsdMayaGLBatchRenderer", "UsdMayaGLBatchRenderer"); /* static */ void UsdMayaGLBatchRenderer::Init() diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.h b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.h index fdade16625..ed3279db09 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.h @@ -17,22 +17,6 @@ #define PXRUSDMAYAGL_BATCH_RENDERER_H /// \file pxrUsdMayaGL/batchRenderer.h -#include -#include -#include -#include - -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include #include @@ -70,6 +54,11 @@ #include #include +#include +#include +#include +#include + PXR_NAMESPACE_OPEN_SCOPE using HgiUniquePtr = std::unique_ptr; diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeUI.h b/lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeUI.h index f3bc7689cc..4258251185 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeUI.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeUI.h @@ -17,20 +17,9 @@ #define PXRUSDMAYAGL_HD_IMAGING_SHAPE_UI_H /// \file pxrUsdMayaGL/hdImagingShapeUI.h -#include -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include +#include #include #include diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/instancerShapeAdapter.h b/lib/mayaUsd/render/pxrUsdMayaGL/instancerShapeAdapter.h index c947b49a5b..df480e9c38 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/instancerShapeAdapter.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/instancerShapeAdapter.h @@ -17,19 +17,6 @@ #define PXRUSDMAYAGL_INSTANCER_SHAPE_ADAPTER_H /// \file pxrUsdMayaGL/instancerShapeAdapter.h -#include - -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include @@ -42,6 +29,8 @@ #include +#include + PXR_NAMESPACE_OPEN_SCOPE /// Class to manage translation of native Maya instancers into diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/proxyShapeUI.h b/lib/mayaUsd/render/pxrUsdMayaGL/proxyShapeUI.h index 47b9668e19..39e83adb99 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/proxyShapeUI.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/proxyShapeUI.h @@ -18,17 +18,6 @@ /// \file pxrUsdMayaGL/proxyShapeUI.h -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/shapeAdapter.h b/lib/mayaUsd/render/pxrUsdMayaGL/shapeAdapter.h index ac2522f5a4..e35eeca6fe 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/shapeAdapter.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/shapeAdapter.h @@ -27,24 +27,12 @@ #include #include #include - -#include -#include - -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include + +#include +#include #undef Always // Defined in /usr/lib/X11/X.h (eventually included by M3dView.h) - breaks // pxr/usd/lib/usdUtils/registeredVariantSet.h #include diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/usdProxyShapeAdapter.h b/lib/mayaUsd/render/pxrUsdMayaGL/usdProxyShapeAdapter.h index 04c9293ee8..b74de32dad 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/usdProxyShapeAdapter.h +++ b/lib/mayaUsd/render/pxrUsdMayaGL/usdProxyShapeAdapter.h @@ -18,19 +18,6 @@ /// \file pxrUsdMayaGL/usdProxyShapeAdapter.h -#include - -// XXX: With Maya versions up through 2019 on Linux, M3dView.h ends up -// indirectly including an X11 header that #define's "Bool" as int: -// - includes -// - includes -// - includes -// - does: "#define Bool int" -// This can cause compilation issues if is included -// afterwards, so to fix this, we ensure that it gets included first. -// -// The X11 include appears to have been removed in Maya 2020+, so this should -// no longer be an issue with later versions. #include #include @@ -46,6 +33,8 @@ #include #include +#include + PXR_NAMESPACE_OPEN_SCOPE class UsdMayaProxyDrawOverride; diff --git a/lib/mayaUsd/render/vp2RenderDelegate/basisCurves.cpp b/lib/mayaUsd/render/vp2RenderDelegate/basisCurves.cpp index a2a6bc8fc9..03326da0ed 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/basisCurves.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/basisCurves.cpp @@ -39,11 +39,6 @@ #include #include -// Complete tessellation shader support is avaiable for basisCurves complexity levels -#if MAYA_API_VERSION >= 20210000 -#define HDVP2_ENABLE_BASISCURVES_TESSELLATION -#endif - PXR_NAMESPACE_OPEN_SCOPE namespace { @@ -547,11 +542,7 @@ void HdVP2BasisCurves::_UpdateDrawItem( const TfToken wrap = topology.GetCurveWrap(); const TfToken basis = topology.GetCurveBasis(); -#if defined(HDVP2_ENABLE_BASISCURVES_TESSELLATION) const int refineLevel = _curvesSharedData._displayStyle.refineLevel; -#else - const int refineLevel = 0; -#endif const MHWRender::MGeometry::DrawMode drawMode = renderItem->drawMode(); @@ -1132,7 +1123,6 @@ void HdVP2BasisCurves::_UpdateDrawItem( renderItem->enable(*stateToCommit._enabled); } -#if defined(HDVP2_ENABLE_BASISCURVES_TESSELLATION) // If the primitive type and stride are changed, then update them. if (stateToCommit._primitiveType != nullptr && stateToCommit._primitiveStride != nullptr) { auto primitive = *stateToCommit._primitiveType; @@ -1143,7 +1133,6 @@ void HdVP2BasisCurves::_UpdateDrawItem( && primitive != MHWRender::MGeometry::kPatch; _SetWantConsolidation(*renderItem, wantConsolidation); } -#endif ProxyRenderDelegate& drawScene = param->GetDrawScene(); @@ -1199,19 +1188,7 @@ void HdVP2BasisCurves::_UpdateDrawItem( drawScene.setExtraInstanceData( *renderItem, extraColorChannelName, *stateToCommit._instanceColors); } - } -#if MAYA_API_VERSION >= 20210000 - else if (newInstanceCount >= 1) { -#else - // In Maya 2020 and before, GPU instancing and consolidation are two separate systems that - // cannot be used by a render item at the same time. In case of single instance, we keep - // the original render item to allow consolidation with other prims. In case of multiple - // instances, we need to disable consolidation to allow GPU instancing to be used. - else if (newInstanceCount == 1) { - renderItem->setMatrix(&(*stateToCommit._instanceTransforms)[0]); - } else if (newInstanceCount > 1) { - _SetWantConsolidation(*renderItem, false); -#endif + } else if (newInstanceCount >= 1) { drawScene.setInstanceTransformArray(*renderItem, *stateToCommit._instanceTransforms); if (stateToCommit._instanceColors->length() == newInstanceCount * kNumColorChannels) { @@ -1472,9 +1449,7 @@ HdVP2BasisCurves::_CreatePatchRenderItem(const MString& name, const TfToken& rep renderItem->setSelectionMask(MSelectionMask::kSelectNurbsCurves); #endif -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeNurbsCurves); -#endif return renderItem; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp index 44f8601ac5..ea2b859255 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp @@ -3026,11 +3026,6 @@ HdVP2Material::CompiledNetwork::_CreateShaderInstance(const HdMaterialNetwork& m MHWRender::MShaderInstance* shaderInstance = nullptr; - // MShaderInstance supports multiple connections between shaders on Maya 2018.7, 2019.3, 2020 - // and above. -#if (MAYA_API_VERSION >= 20190300) \ - || ((MAYA_API_VERSION >= 20180700) && (MAYA_API_VERSION < 20190000)) - // UsdImagingMaterialAdapter has walked the shader graph and emitted nodes // and relationships in topological order to avoid forward-references, thus // we can run a reverse iteration to avoid connecting a fragment before any @@ -3103,98 +3098,6 @@ HdVP2Material::CompiledNetwork::_CreateShaderInstance(const HdMaterialNetwork& m } } -#elif MAYA_API_VERSION >= 20190000 - - // UsdImagingMaterialAdapter has walked the shader graph and emitted nodes - // and relationships in topological order to avoid forward-references, thus - // we can run a reverse iteration to avoid connecting a fragment before any - // of its downstream fragments. - const auto rend = mat.nodes.rend(); - for (auto rit = mat.nodes.rbegin(); rit != rend; rit++) { - const HdMaterialNode& node = *rit; - - const MString nodeId = node.identifier.GetText(); - const MString nodeName = node.path.GetNameToken().GetText(); - - if (shaderInstance == nullptr) { - shaderInstance = shaderMgr->getFragmentShader(nodeId, "outSurfaceFinal", true); - if (shaderInstance == nullptr) { - TF_WARN("Failed to create shader instance for %s", nodeId.asChar()); - break; - } - - continue; - } - - MStringArray outputNames, inputNames; - - std::string primvarname; - - for (const HdMaterialRelationship& rel : mat.relationships) { - if (rel.inputId == node.path) { - outputNames.append(rel.inputName.GetText()); - inputNames.append(rel.outputName.GetText()); - } - - if (_IsUsdUVTexture(node)) { - if (rel.outputId == node.path && rel.outputName == _tokens->st) { - for (const HdMaterialNode& n : mat.nodes) { - if (n.path == rel.inputId && _IsUsdPrimvarReader(n)) { - auto it = n.parameters.find(_tokens->varname); - if (it != n.parameters.end()) { - primvarname = TfStringify(it->second); - } - break; - } - } - } - } - } - - // Without multi-connection support for MShaderInstance, this code path - // can only support common patterns of UsdShade material network, i.e. - // a UsdUVTexture is connected to a single input of a USD Preview Surface. - // More generic fix is coming. - if (outputNames.length() == 1) { - MStatus status - = shaderInstance->addInputFragment(nodeId, outputNames[0], inputNames[0]); - - if (!status) { - TF_DEBUG(HDVP2_DEBUG_MATERIAL) - .Msg( - "Error %s happened when connecting shader %s\n", - status.errorString().asChar(), - node.path.GetText()); - } - - if (_IsUsdUVTexture(node)) { - const MString paramNames[] - = { "file", "fileSampler", "isColorSpaceSRGB", "fallback", "scale", "bias" }; - - for (const MString& paramName : paramNames) { - const MString resolvedName = nodeName + paramName; - shaderInstance->renameParameter(paramName, resolvedName); - } - - const MString paramName = _tokens->st.GetText(); - shaderInstance->setSemantic(paramName, "uvCoord"); - shaderInstance->setAsVarying(paramName, true); - shaderInstance->renameParameter(paramName, primvarname.c_str()); - } - } else { - TF_DEBUG(HDVP2_DEBUG_MATERIAL) - .Msg("Failed to connect shader %s\n", node.path.GetText()); - - if (outputNames.length() > 1) { - TF_DEBUG(HDVP2_DEBUG_MATERIAL) - .Msg("MShaderInstance doesn't support " - "multiple connections between shaders on the current Maya version.\n"); - } - } - } - -#endif - return shaderInstance; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.h b/lib/mayaUsd/render/vp2RenderDelegate/material.h index 40eba8c4be..e6214f05a7 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/material.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/material.h @@ -32,7 +32,7 @@ // Workaround for a material consolidation update issue in VP2. Before USD 0.20.11, a Rprim will be // recreated if its material has any change, so everything gets refreshed and the update issue gets // masked. Once the update issue is fixed in VP2 we will disable this workaround. -#if MAYA_API_VERSION >= 20210000 && MAYA_API_VERSION < 20230000 +#if MAYA_API_VERSION < 20230000 #define HDVP2_MATERIAL_CONSOLIDATION_UPDATE_WORKAROUND #endif diff --git a/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp b/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp index 3e2443b3a2..97b9d2d22c 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp @@ -133,11 +133,7 @@ void MayaUsdRPrim::_CommitMVertexBuffer(MHWRender::MVertexBuffer* const buffer, void MayaUsdRPrim::_SetWantConsolidation(MHWRender::MRenderItem& renderItem, bool state) { -#if MAYA_API_VERSION >= 20190000 renderItem.setWantConsolidation(state); -#else - renderItem.setWantSubSceneConsolidation(state); -#endif } void MayaUsdRPrim::_UpdateTransform( @@ -497,9 +493,7 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreateBoundingBoxRenderItem( renderItem->setSelectionMask(selectionMask); _InitRenderItemCommon(renderItem); -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(exclusionFlag); -#endif return renderItem; } @@ -530,9 +524,7 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreateWireframeRenderItem( #endif _InitRenderItemCommon(renderItem); -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(exclusionFlag); -#endif return renderItem; } @@ -559,9 +551,7 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreatePointsRenderItem( renderItem->setSelectionMask(selectionMasks); _InitRenderItemCommon(renderItem); -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(exclusionFlag); -#endif return renderItem; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp b/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp index a3d1f9f0eb..d0168280cf 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp @@ -2307,21 +2307,7 @@ void HdVP2Mesh::_UpdateDrawItem( *stateToCommit._instanceColors); TF_VERIFY(result == MStatus::kSuccess); } - } -#if MAYA_API_VERSION >= 20210000 - else if (newInstanceCount >= 1) { -#else - // In Maya 2020 and before, GPU instancing and consolidation are two separate - // systems that cannot be used by a render item at the same time. In case of single - // instance, we keep the original render item to allow consolidation with other - // prims. In case of multiple instances, we need to disable consolidation to allow - // GPU instancing to be used. - else if (newInstanceCount == 1) { - bool success = renderItem->setMatrix(&(*stateToCommit._instanceTransforms)[0]); - TF_VERIFY(success); - } else if (newInstanceCount > 1) { - _SetWantConsolidation(*renderItem, false); -#endif + } else if (newInstanceCount >= 1) { if (stateToCommit._instanceTransforms) { result = drawScene.setInstanceTransformArray( *renderItem, *stateToCommit._instanceTransforms); @@ -2685,9 +2671,7 @@ HdVP2DrawItem::RenderItemData& HdVP2Mesh::_CreateSmoothHullRenderItem( renderItem->setSelectionMask(MSelectionMask::kSelectMeshes); #endif -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeMeshes); -#endif #ifdef HAS_DEFAULT_MATERIAL_SUPPORT_API renderItem->setDefaultMaterialHandling(MRenderItem::SkipWhenDefaultMaterialActive); @@ -2714,9 +2698,7 @@ MHWRender::MRenderItem* HdVP2Mesh::_CreateSelectionHighlightRenderItem(const MSt renderItem->setSelectionMask(MSelectionMask()); _InitRenderItemCommon(renderItem); -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeMeshes); -#endif return renderItem; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h index ccbcebc6e7..9b8f171fa3 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h @@ -42,7 +42,6 @@ // Maya 2020 is missing API necessary for compute support // OSX doesn't have OpenGL 4.3 support necessary for compute -// USD before 20.08 doesn't include some OSD commits we rely on #if MAYA_API_VERSION >= 20210000 && !defined(OSMac_) #define HDVP2_ENABLE_GPU_COMPUTE #endif diff --git a/lib/mayaUsd/render/vp2RenderDelegate/points.cpp b/lib/mayaUsd/render/vp2RenderDelegate/points.cpp index 829d4b3296..4b50cc132e 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/points.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/points.cpp @@ -866,19 +866,7 @@ void HdVP2Points::_UpdateDrawItem( drawScene.setExtraInstanceData( *renderItem, extraColorChannelName, *stateToCommit._instanceColors); } - } -#if MAYA_API_VERSION >= 20210000 - else if (newInstanceCount >= 1) { -#else - // In Maya 2020 and before, GPU instancing and consolidation are two separate systems that - // cannot be used by a render item at the same time. In case of single instance, we keep - // the original render item to allow consolidation with other prims. In case of multiple - // instances, we need to disable consolidation to allow GPU instancing to be used. - else if (newInstanceCount == 1) { - renderItem->setMatrix(&(*stateToCommit._instanceTransforms)[0]); - } else if (newInstanceCount > 1) { - _SetWantConsolidation(*renderItem, false); -#endif + } else if (newInstanceCount >= 1) { drawScene.setInstanceTransformArray(*renderItem, *stateToCommit._instanceTransforms); if (stateToCommit._instanceColors->length() == newInstanceCount * kNumColorChannels) { @@ -1096,9 +1084,7 @@ HdVP2Points::_CreateFatPointsRenderItem(const MString& name, const TfToken& repr renderItem->setSelectionMask(MSelectionMask::kSelectParticleShapes); #endif -#if MAYA_API_VERSION >= 20220000 renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeNParticles); -#endif return renderItem; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp index fcd5672d24..199ec0b2b1 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp @@ -604,11 +604,9 @@ ProxyRenderDelegate::~ProxyRenderDelegate() //! \brief This drawing routine supports all devices (DirectX and OpenGL) MHWRender::DrawAPI ProxyRenderDelegate::supportedDrawAPIs() const { return MHWRender::kAllDevices; } -#if defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) //! \brief Enable subscene update in selection passes for deferred update of selection render //! items. bool ProxyRenderDelegate::enableUpdateForSelection() const { return true; } -#endif //! \brief Always requires update since changes are tracked by Hydraw change tracker and it will //! guarantee minimal update; only exception is if rendering through Maya-to-Hydra @@ -1094,7 +1092,6 @@ void ProxyRenderDelegate::_Execute(const MHWRender::MFrameContext& frameContext) // If update for selection is enabled, the draw data for the "points" repr // won't be prepared until point snapping is activated; otherwise the draw // data have to be prepared early for possible activation of point snapping. -#if defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) const bool inSelectionPass = (frameContext.getSelectionInfo() != nullptr); #if !defined(MAYA_NEW_POINT_SNAPPING_SUPPORT) || defined(WANT_UFE_BUILD) const bool inPointSnapping = pointSnappingActive(); @@ -1113,15 +1110,6 @@ void ProxyRenderDelegate::_Execute(const MHWRender::MFrameContext& frameContext) } #endif // defined(WANT_UFE_BUILD) -#else // !defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) - _combinedDisplayStyles[HdReprTokens->points] = _frameCounter; - - constexpr bool inSelectionPass = false; -#if !defined(MAYA_NEW_POINT_SNAPPING_SUPPORT) - constexpr bool inPointSnapping = false; -#endif -#endif // defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) - // Work around USD issue #1516. There is a significant performance overhead caused by populating // selection, so only force the populate selection to occur when we detect a change which // impacts the instance indexing. @@ -1234,11 +1222,7 @@ void ProxyRenderDelegate::update(MSubSceneContainer& container, const MFrameCont const MSelectionInfo* selectionInfo = frameContext.getSelectionInfo(); if (selectionInfo) { bool oldSnapToPoints = _snapToPoints; -#if MAYA_API_VERSION >= 20220000 _snapToPoints = selectionInfo->pointSnapping(); -#else - _snapToPoints = pointSnappingActive(); -#endif if (_snapToPoints != oldSnapToPoints) { _selectionModeChanged = true; } @@ -1404,22 +1388,16 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( topLevelInstanceIndex = instancerContext.front().second; } #else - SdfPath usdPath = GetScenePrimPath(rprimId, instanceIndex); + SdfPath usdPath = GetScenePrimPath(rprimId, instanceIndex); #endif // If update for selection is enabled, we can query the Maya selection list // adjustment, USD selection kind, and USD point instances pick mode once // per selection update to avoid the cost of executing MEL commands or // searching optionVars for each intersection. -#if defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) const TfToken& selectionKind = _selectionKind; const UsdPointInstancesPickMode& pointInstancesPickMode = _pointInstancesPickMode; const MGlobal::ListAdjustment& listAdjustment = _globalListAdjustment; -#else - const TfToken selectionKind = GetSelectionKind(); - const UsdPointInstancesPickMode pointInstancesPickMode = GetPointInstancesPickMode(); - const MGlobal::ListAdjustment listAdjustment = GetListAdjustment(); -#endif UsdPrim prim = _proxyShapeData->UsdStage()->GetPrimAtPath(usdPath); const UsdPrim topLevelPrim = _proxyShapeData->UsdStage()->GetPrimAtPath(topLevelPath); @@ -1503,7 +1481,7 @@ bool ProxyRenderDelegate::getInstancedSelectionPath( auto ufeSel = Ufe::NamedSelection::get("MayaSelectTool"); ufeSel->append(si); #else - auto globalSelection = Ufe::GlobalSelection::get(); + auto globalSelection = Ufe::GlobalSelection::get(); switch (listAdjustment) { case MGlobal::kReplaceList: diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h index 4b37e2da2e..128d0c234e 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h @@ -43,11 +43,6 @@ #include #endif -// Conditional compilation due to Maya API gap. -#if MAYA_API_VERSION >= 20200000 -#define MAYA_ENABLE_UPDATE_FOR_SELECTION -#endif - // Use the latest MPxSubSceneOverride API #ifndef OPENMAYA_MPXSUBSCENEOVERRIDE_LATEST_NAMESPACE #define OPENMAYA_MPXSUBSCENEOVERRIDE_LATEST_NAMESPACE OPENMAYA_MAJOR_NAMESPACE @@ -129,10 +124,8 @@ class ProxyRenderDelegate MAYAUSD_CORE_PUBLIC MHWRender::DrawAPI supportedDrawAPIs() const override; -#if defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) MAYAUSD_CORE_PUBLIC bool enableUpdateForSelection() const override; -#endif MAYAUSD_CORE_PUBLIC bool requiresUpdate(const MSubSceneContainer& container, const MFrameContext& frameContext) @@ -473,7 +466,7 @@ class ProxyRenderDelegate MCallbackId _mayaSelectionCallbackId { 0 }; #endif -#if defined(WANT_UFE_BUILD) && defined(MAYA_ENABLE_UPDATE_FOR_SELECTION) +#if defined(WANT_UFE_BUILD) //! Adjustment mode for global selection list: ADD, REMOVE, REPLACE, XOR MGlobal::ListAdjustment _globalListAdjustment; diff --git a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp index ef4be2989d..3dc5f9124c 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp @@ -565,14 +565,8 @@ const HdVP2BBoxGeom* sSharedBBoxGeom } // namespace -const int HdVP2RenderDelegate::sProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "HdVP2RenderDelegate", - "HdVP2RenderDelegate" -#else - "HdVP2RenderDelegate" -#endif -); +const int HdVP2RenderDelegate::sProfilerCategory + = MProfiler::addCategory("HdVP2RenderDelegate", "HdVP2RenderDelegate"); std::mutex HdVP2RenderDelegate::_renderDelegateMutex; std::atomic_int HdVP2RenderDelegate::_renderDelegateCounter; diff --git a/lib/mayaUsd/render/vp2ShaderFragments/shaderFragments.cpp b/lib/mayaUsd/render/vp2ShaderFragments/shaderFragments.cpp index ddb4c9cd57..8193fd059d 100644 --- a/lib/mayaUsd/render/vp2ShaderFragments/shaderFragments.cpp +++ b/lib/mayaUsd/render/vp2ShaderFragments/shaderFragments.cpp @@ -188,8 +188,6 @@ std::string _GetResourcePath(const std::string& resource) return path; } -#if MAYA_API_VERSION >= 20210000 - //! Structure for Automatic shader stage input parameter to register in VP2. struct AutomaticShaderStageInput { @@ -233,8 +231,6 @@ std::vector> _domainShaderInputNameMappings = { { "BasisCurvesCubicColor", "BasisCurvesCubicColorDomain" }, { "BasisCurvesLinearColor", "BasisCurvesLinearColorDomain" } }; -#endif - } // anonymous namespace namespace { @@ -555,8 +551,6 @@ MStatus HdVP2ShaderFragments::registerFragments() } #endif // not HAS_COLOR_MANAGEMENT_SUPPORT_API -#if MAYA_API_VERSION >= 20210000 - // Register automatic shader stage input parameters. for (const auto& input : _automaticShaderStageInputs) { fragmentManager->addAutomaticShaderStageInput( @@ -572,8 +566,6 @@ MStatus HdVP2ShaderFragments::registerFragments() fragmentManager->addDomainShaderInputNameMapping(mapping.first, mapping.second); } -#endif - _registrationCount++; return MS::kSuccess; @@ -602,8 +594,6 @@ MStatus HdVP2ShaderFragments::deregisterFragments() return MS::kFailure; } -#if MAYA_API_VERSION >= 20210000 - // De-register a desired domain shader fragment for each input parameter. for (const auto& mapping : _domainShaderInputNameMappings) { fragmentManager->removeDomainShaderInputNameMapping(mapping.first); @@ -614,8 +604,6 @@ MStatus HdVP2ShaderFragments::deregisterFragments() fragmentManager->removeAutomaticShaderStageInput(input._shaderStage, input._parameterName); } -#endif - // De-register the various UsdUVTexture fragments: for (const auto& txtFrag : _textureFragNames) { if (!fragmentManager->removeFragment(txtFrag.second.c_str())) { diff --git a/lib/mayaUsd/utils/converter.cpp b/lib/mayaUsd/utils/converter.cpp index 1874a9262a..74c0af256c 100644 --- a/lib/mayaUsd/utils/converter.cpp +++ b/lib/mayaUsd/utils/converter.cpp @@ -820,10 +820,8 @@ template } }; -// Missing attribute method for MDataHandle prior to Maya 2020. For now disable all -// array converters to avoid complicating interface and error handling. If needed, -// we should be able to back-port the change to an update. -#if MAYA_API_VERSION >= 20200000 +// For now disable all array converters to avoid complicating interface and +// error handling. If needed, we should be able to back-port the change to an update. //! \brief Utility class for conversion between array data handles and Usd. template struct MArrayDataHandleConvert @@ -998,7 +996,6 @@ struct MArrayPlugConvert } } }; -#endif //--------------------------------------------------------------------------------- //! \brief Storage for generated instances of converters. @@ -1081,7 +1078,6 @@ struct Converter::GenerateConverters //! \brief Utility class responsible for generating all supported array attribute converters. struct Converter::GenerateArrayPlugConverters { -#if MAYA_API_VERSION >= 20200000 template < class MAYA_Type, class USD_Type, @@ -1130,13 +1126,6 @@ struct Converter::GenerateArrayPlugConverters createArrayConverter(converters, SdfValueTypeNames->Matrix4dArray); return converters; } -#else - static ConvertStorage generate() - { - ConvertStorage converters; - return converters; - } -#endif }; namespace { diff --git a/lib/mayaUsd/utils/util.cpp b/lib/mayaUsd/utils/util.cpp index 77b353f322..c101c47543 100644 --- a/lib/mayaUsd/utils/util.cpp +++ b/lib/mayaUsd/utils/util.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -62,12 +64,6 @@ #include #include -#if MAYA_API_VERSION >= 20200000 -#include -#endif - -#include - #include #include #include @@ -852,7 +848,6 @@ bool _GetColorAndTransparencyFromStandardSurface( GfVec3f* rgb, float* alpha) { -#if MAYA_API_VERSION >= 20200000 MStatus status; MFnStandardSurfaceShader surfaceFn(shaderObj, &status); if (status == MS::kSuccess) { @@ -870,7 +865,6 @@ bool _GetColorAndTransparencyFromStandardSurface( } return true; } -#endif return false; } @@ -2326,11 +2320,9 @@ double UsdMayaUtil::ConvertMTimeUnitToDouble(const MTime::Unit& unit) case MTime::k80FPS: { ret = 80.0; } break; -#if MAYA_API_VERSION >= 20200000 case MTime::k90FPS: { ret = 90.0; } break; -#endif case MTime::k100FPS: { ret = 100.0; } break; diff --git a/lib/usd/hdMaya/adapters/meshAdapter.cpp b/lib/usd/hdMaya/adapters/meshAdapter.cpp index dca878dec3..da0bc2b5f5 100644 --- a/lib/usd/hdMaya/adapters/meshAdapter.cpp +++ b/lib/usd/hdMaya/adapters/meshAdapter.cpp @@ -233,15 +233,9 @@ class HdMayaMeshAdapter : public HdMayaShapeAdapter // TODO: Maybe we could use the flat shading of the display style? return HdMeshTopology( -#if MAYA_APP_VERSION >= 2019 (GetDelegate()->GetParams().displaySmoothMeshes || GetDisplayStyle().refineLevel > 0) ? PxOsdOpenSubdivTokens->catmullClark : PxOsdOpenSubdivTokens->none, -#else - GetDelegate()->GetParams().displaySmoothMeshes ? PxOsdOpenSubdivTokens->catmullClark - : PxOsdOpenSubdivTokens->none, -#endif - UsdGeomTokens->rightHanded, faceVertexCounts, faceVertexIndices); @@ -249,7 +243,6 @@ class HdMayaMeshAdapter : public HdMayaShapeAdapter HdDisplayStyle GetDisplayStyle() override { -#if MAYA_APP_VERSION >= 2019 MStatus status; MFnDependencyNode node(GetNode(), &status); if (ARCH_UNLIKELY(!status)) { @@ -263,14 +256,10 @@ class HdMayaMeshAdapter : public HdMayaShapeAdapter const auto smoothLevel = std::max(0, node.findPlug(MayaAttrs::mesh::smoothLevel, true).asInt()); return { smoothLevel, false, false }; -#else - return { 0, false, false }; -#endif } PxOsdSubdivTags GetSubdivTags() override { -#if MAYA_APP_VERSION >= 2019 PxOsdSubdivTags tags; if (GetDisplayStyle().refineLevel < 1) { return tags; @@ -332,9 +321,6 @@ class HdMayaMeshAdapter : public HdMayaShapeAdapter tags.SetTriangleSubdivision(UsdGeomTokens->catmullClark); return tags; -#else - return {}; -#endif } HdPrimvarDescriptorVector GetPrimvarDescriptors(HdInterpolation interpolation) override diff --git a/lib/usd/hdMaya/delegates/delegate.h b/lib/usd/hdMaya/delegates/delegate.h index 28c6a2084e..b880873be6 100644 --- a/lib/usd/hdMaya/delegates/delegate.h +++ b/lib/usd/hdMaya/delegates/delegate.h @@ -112,7 +112,6 @@ class HdMayaDelegate virtual bool SupportsUfeSelection() { return false; } #endif // WANT_UFE_BUILD -#if MAYA_API_VERSION >= 20210000 virtual void PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, @@ -120,7 +119,6 @@ class HdMayaDelegate MPointArray& worldSpaceHitPts) { } -#endif void SetLightsEnabled(const bool enabled) { _lightsEnabled = enabled; } bool GetLightsEnabled() { return _lightsEnabled; } diff --git a/lib/usd/hdMaya/delegates/proxyDelegate.cpp b/lib/usd/hdMaya/delegates/proxyDelegate.cpp index d0b528325d..841d7d0b98 100644 --- a/lib/usd/hdMaya/delegates/proxyDelegate.cpp +++ b/lib/usd/hdMaya/delegates/proxyDelegate.cpp @@ -139,7 +139,7 @@ void SetupPluginCallbacks() } #ifndef UFE_V2_FEATURES_AVAILABLE -#if (MAYA_API_VERSION >= 20210000) && WANT_UFE_BUILD +#if WANT_UFE_BUILD MGlobal::ListAdjustment GetListAdjustment() { // Keyboard modifiers can be queried from QApplication::keyboardModifiers() @@ -327,7 +327,6 @@ bool HdMayaProxyDelegate::SupportsUfeSelection() { return MayaUsd::ufe::getUsdRu #endif // WANT_UFE_BUILD -#if MAYA_API_VERSION >= 20210000 void HdMayaProxyDelegate::PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, @@ -429,6 +428,5 @@ void HdMayaProxyDelegate::PopulateSelectionList( } #endif // WANT_UFE_BUILD } -#endif // MAYA_API_VERSION >= 20210000 PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/usd/hdMaya/delegates/proxyDelegate.h b/lib/usd/hdMaya/delegates/proxyDelegate.h index a5356c7d19..566949f7cd 100644 --- a/lib/usd/hdMaya/delegates/proxyDelegate.h +++ b/lib/usd/hdMaya/delegates/proxyDelegate.h @@ -66,13 +66,11 @@ class HdMayaProxyDelegate : public HdMayaDelegate bool SupportsUfeSelection() override; #endif // WANT_UFE_BUILD -#if MAYA_API_VERSION >= 20210000 void PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, MSelectionList& selectionList, MPointArray& worldSpaceHitPts) override; -#endif }; PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/usd/hdMaya/delegates/sceneDelegate.cpp b/lib/usd/hdMaya/delegates/sceneDelegate.cpp index 63b88db6c4..59a708befe 100644 --- a/lib/usd/hdMaya/delegates/sceneDelegate.cpp +++ b/lib/usd/hdMaya/delegates/sceneDelegate.cpp @@ -739,7 +739,6 @@ void HdMayaSceneDelegate::PopulateSelectedPaths( MFn::kShape); } -#if MAYA_API_VERSION >= 20210000 void HdMayaSceneDelegate::PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, @@ -773,7 +772,6 @@ void HdMayaSceneDelegate::PopulateSelectionList( _shapeAdapters); } } -#endif HdMeshTopology HdMayaSceneDelegate::GetMeshTopology(const SdfPath& id) { diff --git a/lib/usd/hdMaya/delegates/sceneDelegate.h b/lib/usd/hdMaya/delegates/sceneDelegate.h index 8971f3512f..e7583ef7a5 100644 --- a/lib/usd/hdMaya/delegates/sceneDelegate.h +++ b/lib/usd/hdMaya/delegates/sceneDelegate.h @@ -123,14 +123,12 @@ class HdMayaSceneDelegate : public HdMayaDelegateCtx SdfPathVector& selectedSdfPaths, const HdSelectionSharedPtr& selection) override; -#if MAYA_API_VERSION >= 20210000 HDMAYA_API void PopulateSelectionList( const HdxPickHitVector& hits, const MHWRender::MSelectionInfo& selectInfo, MSelectionList& selectionList, MPointArray& worldSpaceHitPts) override; -#endif bool GetEnableMaterials() const { return _enableMaterials; } void SetEnableMaterials(bool enable) { _enableMaterials = enable; } diff --git a/lib/usd/translators/meshReader.cpp b/lib/usd/translators/meshReader.cpp index d3935330c0..ab84f7b9e3 100644 --- a/lib/usd/translators/meshReader.cpp +++ b/lib/usd/translators/meshReader.cpp @@ -131,13 +131,9 @@ bool MayaUsdPrimReaderMesh::Read(UsdMayaPrimReaderContext& context) // assign invisible faces UsdMayaMeshReadUtils::assignInvisibleFaces(mesh, meshRead.meshObject()); -#if MAYA_API_VERSION >= 20220000 - // Read componentTags UsdMayaMeshReadUtils::createComponentTags(mesh, meshRead.meshObject()); -#endif - // assign material assignMaterial(mesh, _GetArgs(), meshRead.meshObject(), &context); diff --git a/lib/usd/translators/meshWriter.cpp b/lib/usd/translators/meshWriter.cpp index b454a30201..f11f3af92f 100644 --- a/lib/usd/translators/meshWriter.cpp +++ b/lib/usd/translators/meshWriter.cpp @@ -825,14 +825,10 @@ bool PxrUsdTranslators_MeshWriter::writeMeshAttrs( _GetSparseValueWriter()); } -#if MAYA_API_VERSION >= 20220000 - if (exportArgs.exportComponentTags) { UsdMayaMeshWriteUtils::exportComponentTags(primSchema, GetMayaObject()); } -#endif - return true; } diff --git a/lib/usd/ui/layerEditor/mayaCommandHook.cpp b/lib/usd/ui/layerEditor/mayaCommandHook.cpp index 1f7d579623..b35357c3e8 100644 --- a/lib/usd/ui/layerEditor/mayaCommandHook.cpp +++ b/lib/usd/ui/layerEditor/mayaCommandHook.cpp @@ -236,11 +236,7 @@ void MayaCommandHook::selectPrimsWithSpec(UsdLayer usdLayer) script += R"PYTHON( # Ufe import ufe -try: - from maya.internal.ufeSupport import ufeSelectCmd -except ImportError: - # Maya 2019 and 2020 don't have ufeSupport plugin, so use fallback. - from ufeScripts import ufeSelectCmd +from maya.internal.ufeSupport import ufeSelectCmd # create a selection list sn = ufe.Selection() diff --git a/plugin/adsk/plugin/ProxyShape.cpp b/plugin/adsk/plugin/ProxyShape.cpp index 11c11d5a58..c0f433597c 100644 --- a/plugin/adsk/plugin/ProxyShape.cpp +++ b/plugin/adsk/plugin/ProxyShape.cpp @@ -65,9 +65,7 @@ void ProxyShape::postConstructor() } // Enable proxy accessor features for this proxy -#if MAYA_API_VERSION >= 20210000 enableProxyAccessor(); -#endif } } // namespace MAYAUSD_NS_DEF diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/StageCache.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/StageCache.cpp index 002ca3dcb0..00edeadf02 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/StageCache.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/StageCache.cpp @@ -22,14 +22,7 @@ #include namespace { -const int _stageCacheProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "StageCache", - "StageCache" -#else - "StageCache" -#endif -); +const int _stageCacheProfilerCategory = MProfiler::addCategory("StageCache", "StageCache"); } // namespace namespace AL { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp index d272c57408..16740d99d2 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/AnimationTranslator.cpp @@ -27,7 +27,6 @@ #include #include #include -#include // For MAYA_APP_VERSION namespace AL { namespace usdmaya { @@ -61,29 +60,20 @@ void AnimationTranslator::exportAnimation(const ExporterParams& params) /// maya::Dg /// usdmaya::Dg /// usdmaya::fileio::translator::Dg -#if MAYA_APP_VERSION > 2019 translators::TransformTranslator::copyAttributeValue( it->first, it->second, timeCode, params.m_mergeOffsetParentMatrix); -#else - translators::DgNodeTranslator::copyAttributeValue(it->first, it->second, timeCode); -#endif } for (auto it = startAttribScaled; it != endAttribScaled; ++it) { /// \todo This feels wrong. Split the DgNodeTranslator class into 3 ... /// maya::Dg /// usdmaya::Dg /// usdmaya::fileio::translator::Dg -#if MAYA_APP_VERSION > 2019 translators::TransformTranslator::copyAttributeValue( it->first, it->second.attr, it->second.scale, timeCode, params.m_mergeOffsetParentMatrix); -#else - translators::DgNodeTranslator::copyAttributeValue( - it->first, it->second.attr, it->second.scale, timeCode); -#endif } for (auto it = startTransformAttrib; it != endTransformAttrib; ++it) { translators::TransformTranslator::copyAttributeValue( diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Export.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Export.cpp index e5e0c2fd9f..23bfb8bdb0 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Export.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Export.cpp @@ -39,7 +39,6 @@ #include #include #include -#include // For MAYA_APP_VERSION namespace AL { namespace usdmaya { @@ -1083,13 +1082,11 @@ MStatus ExportCommand::doIt(const MArgList& args) argData.getFlagArgument("mt", 0, m_params.m_mergeTransforms), "ALUSDExport: Unable to fetch \"merge transforms\" argument"); } -#if MAYA_APP_VERSION > 2019 if (argData.isFlagSet("mom", &status)) { AL_MAYA_CHECK_ERROR( argData.getFlagArgument("mom", 0, m_params.m_mergeOffsetParentMatrix), "ALUSDExport: Unable to fetch \"merge offset parent matrix\" argument"); } -#endif if (argData.isFlagSet("nc", &status)) { bool option; argData.getFlagArgument("nc", 0, option); @@ -1248,10 +1245,8 @@ MSyntax ExportCommand::createSyntax() AL_MAYA_CHECK_ERROR2(status, errorString); status = syntax.addFlag("-mt", "-mergeTransforms", MSyntax::kBoolean); AL_MAYA_CHECK_ERROR2(status, errorString); -#if MAYA_APP_VERSION > 2019 status = syntax.addFlag("-mom", "-mergeOffsetParentMatrix", MSyntax::kBoolean); AL_MAYA_CHECK_ERROR2(status, errorString); -#endif status = syntax.addFlag("-ani", "-animation", MSyntax::kNoArg); AL_MAYA_CHECK_ERROR2(status, errorString); status = syntax.addFlag("-fr", "-frameRange", MSyntax::kDouble, MSyntax::kDouble); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportParams.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportParams.h index ad7c5ec2d5..101aac5a2b 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportParams.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportParams.h @@ -23,7 +23,6 @@ #include #include -#include // For MAYA_APP_VERSION PXR_NAMESPACE_USING_DIRECTIVE @@ -54,11 +53,9 @@ struct ExporterParams bool m_mergeTransforms = true; ///< if true, shapes will be merged into their parent transforms in the exported ///< data. If false, the transform and shape will be exported seperately -#if MAYA_APP_VERSION > 2019 bool m_mergeOffsetParentMatrix = false; ///< if true, offset parent matrix would be merged to produce local space matrix; ///< if false, offset parent matrix would be exported separately in USD. -#endif bool m_animation = false; ///< if true, animation will be exported. bool m_useTimelineRange = false; ///< if true, then the export uses Maya's timeline range. bool m_filterSample = false; ///< if true, duplicate sample of attribute will be filtered out diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.cpp index f18f667e47..ce63cf5809 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.cpp @@ -54,9 +54,7 @@ MStatus ExportTranslator::writer( params.m_dynamicAttributes = options.getBool(kDynamicAttributes); params.m_duplicateInstances = options.getBool(kDuplicateInstances); params.m_mergeTransforms = options.getBool(kMergeTransforms); -#if MAYA_APP_VERSION > 2019 params.m_mergeOffsetParentMatrix = options.getBool(kMergeOffsetParentMatrix); -#endif params.m_fileName = file.fullName(); params.m_selected = mode == MPxFileTranslator::kExportActiveAccessMode; params.m_animation = options.getBool(kAnimation); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.h index c7d0573281..c7d6d406b6 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/ExportTranslator.h @@ -20,8 +20,6 @@ #include #include -#include // For MAYA_APP_VERSION - namespace AL { namespace usdmaya { namespace fileio { @@ -62,10 +60,8 @@ static constexpr const char* const kDuplicateInstances = "Duplicate Instances"; ///< export instances option name static constexpr const char* const kMergeTransforms = "Merge Transforms"; ///< export by merging transforms and shapes option name -#if MAYA_APP_VERSION > 2019 static constexpr const char* const kMergeOffsetParentMatrix = "Merge Offset Parent Matrix"; ///< export by merging offset parent matrix -#endif static constexpr const char* const kAnimation = "Animation"; ///< export animation data option name static constexpr const char* const kUseTimelineRange = "Use Timeline Range"; ///< export using the timeline range option name @@ -109,10 +105,8 @@ static MStatus specifyOptions(AL::maya::utils::FileTranslatorOptions& options) return MS::kFailure; if (!options.addBool(kMergeTransforms, defaultValues.m_mergeTransforms)) return MS::kFailure; -#if MAYA_APP_VERSION > 2019 if (!options.addBool(kMergeOffsetParentMatrix, defaultValues.m_mergeOffsetParentMatrix)) return MS::kFailure; -#endif if (!options.addBool(kAnimation, defaultValues.m_animation)) return MS::kFailure; if (!options.addBool(kUseTimelineRange, defaultValues.m_useTimelineRange)) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp index 7b536e649c..da8d110de7 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.cpp @@ -48,7 +48,6 @@ namespace usdmaya { namespace fileio { namespace translators { -#if MAYA_APP_VERSION > 2019 //---------------------------------------------------------------------------------------------------------------------- static const GfMatrix4d g_identityMatrix(1.0); static constexpr double g_tolerance = 1e-9; @@ -194,8 +193,6 @@ bool extractOffsetMatrixComponent(const MPlug& attr, double* value) } // namespace -#endif - //---------------------------------------------------------------------------------------------------------------------- MObject TransformTranslator::m_inheritsTransform = MObject::kNullObj; MObject TransformTranslator::m_scale = MObject::kNullObj; @@ -863,7 +860,6 @@ MStatus TransformTranslator::copyAttributes( // This adds an op to the stack so we should do it after ClearXformOpOrder(): xformSchema.SetResetXformStack(!inheritsTransform); -#if MAYA_APP_VERSION > 2019 if (params.m_mergeOffsetParentMatrix && extractOffsetMatrixComponents( from, translation, rotation, rotateOrder, scale, shear)) { @@ -871,18 +867,13 @@ MStatus TransformTranslator::copyAttributes( transformAnimated |= animationCheck(animTranslator, MPlug(from, MPxTransform::offsetParentMatrix)); } else { -#endif - /// Retrieve the values directly from Maya getVec3(from, m_scale, (float*)&scale); getVec3(from, m_shear, (float*)&shear); getVec3(from, m_rotation, (float*)&rotation); getInt32(from, m_rotateOrder, rotateOrder); getVec3(from, m_translation, (double*)&translation); - -#if MAYA_APP_VERSION > 2019 } -#endif bool plugAnimated = animationCheck(animTranslator, MPlug(from, m_visible)); if (plugAnimated || visible != defaultVisible) { @@ -1030,7 +1021,6 @@ void TransformTranslator::copyAttributeValue( } } -#if MAYA_APP_VERSION > 2019 //---------------------------------------------------------------------------------------------------------------------- void TransformTranslator::copyAttributeValue( const MPlug& attr, @@ -1105,8 +1095,6 @@ void TransformTranslator::copyAttributeValue( translators::DgNodeTranslator::copyAttributeValue(attr, usdAttr, scale, timeCode); } -#endif - //---------------------------------------------------------------------------------------------------------------------- } // namespace translators } // namespace fileio diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.h index 27dc828f35..2ed36bfb72 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TransformTranslator.h @@ -24,8 +24,6 @@ #include #include -#include // For MAYA_APP_VERSION - #include namespace AL { @@ -102,7 +100,6 @@ class TransformTranslator : public DagNodeTranslator MObject& attribute, double& conversionFactor); -#if MAYA_APP_VERSION > 2019 /// \brief helper method to copy attributes from the UsdPrim to the Maya node /// \param attr the maya node to copy the data from /// \param usdAttr the UsdPrim to copy the data to @@ -128,7 +125,6 @@ class TransformTranslator : public DagNodeTranslator float scale, const UsdTimeCode& timeCode, bool mergeOffsetMatrix); -#endif private: static MStatus processMetaData(const UsdPrim& from, MObject& to, const ImporterParams& params); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorBase.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorBase.cpp index 2ed2eb5233..c6db1658a9 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorBase.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorBase.cpp @@ -26,14 +26,8 @@ #include namespace { -const int _translatorProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "TranslatorManufacture", - "TranslatorManufacture" -#else - "TranslatorManufacture" -#endif -); +const int _translatorProfilerCategory + = MProfiler::addCategory("TranslatorManufacture", "TranslatorManufacture"); } // namespace namespace AL { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp index c1ea3763d1..f9667db9af 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/translators/TranslatorContext.cpp @@ -25,14 +25,8 @@ #include namespace { -const int _translatorContextProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "TranslatorContext", - "TranslatorContext" -#else - "TranslatorContext" -#endif -); +const int _translatorContextProfilerCategory + = MProfiler::addCategory("TranslatorContext", "TranslatorContext"); bool isDescendantPath(const SdfPathSet& affectedPaths, const SdfPath& path) { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Engine.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Engine.cpp index f9ae06de14..5848e21ce8 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Engine.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Engine.cpp @@ -39,14 +39,7 @@ #include namespace { -const int _enginProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "GLEngine", - "GLEngine" -#else - "GLEngine" -#endif -); +const int _enginProfilerCategory = MProfiler::addCategory("GLEngine", "GLEngine"); } // namespace namespace AL { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/LayerManager.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/LayerManager.cpp index e22fa603fe..53b0f29c9f 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/LayerManager.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/LayerManager.cpp @@ -40,14 +40,7 @@ #include namespace { -const int _layerManagerProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "LayerManager", - "LayerManager" -#else - "LayerManager" -#endif -); +const int _layerManagerProfilerCategory = MProfiler::addCategory("LayerManager", "LayerManager"); MObjectHandle theLayerManagerHandle; diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp index 5b23150047..eb52930be2 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp @@ -74,14 +74,8 @@ typedef void ( const char* ProxyShape::s_selectionMaskName = "al_ProxyShape"; namespace { -const int _proxyShapeProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "AL_usdmaya_ProxyShape", - "AL_usdmaya_ProxyShape" -#else - "AL_usdmaya_ProxyShape" -#endif -); +const int _proxyShapeProfilerCategory + = MProfiler::addCategory("AL_usdmaya_ProxyShape", "AL_usdmaya_ProxyShape"); //---------------------------------------------------------------------------------------------------------------------- /// \brief Verify given Maya node is still valid. @@ -1499,9 +1493,7 @@ void ProxyShape::postConstructor() MPlug(thisMObject(), m_visibleInReflections).setValue(true); MPlug(thisMObject(), m_visibleInRefractions).setValue(true); -#if MAYA_API_VERSION >= 20210000 enableProxyAccessor(); -#endif } //---------------------------------------------------------------------------------------------------------------------- diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp index c28d7fa017..04fe1a2406 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp @@ -31,14 +31,8 @@ namespace usdmaya { namespace nodes { namespace { -const int _proxyShapeSelectionProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "AL_usdmaya_ProxyShape_selection", - "AL_usdmaya_ProxyShape_selection" -#else - "AL_usdmaya_ProxyShape_selection" -#endif -); +const int _proxyShapeSelectionProfilerCategory + = MProfiler::addCategory("AL_usdmaya_ProxyShape_selection", "AL_usdmaya_ProxyShape_selection"); typedef void ( *proxy_function_prototype)(void* userData, AL::usdmaya::nodes::ProxyShape* proxyInstance); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.cpp index 660abfa792..16220c2b30 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.cpp @@ -101,14 +101,7 @@ MStatus Scope::initialise() AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, rotatePivotTranslate), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, scalePivot), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, scalePivotTranslate), errorString); - // Maya 2018 (checked 2018.2 and 2018.3) has a bug where, if any loaded plugin has an - // MPxTransform subclass that has ANY attribute that connected to rotateAxis, it will - // cause the rotateAxis to evaluate INCORRECTLY, even on the BASE transform class! See - // this gist for full reproduction details: - // https://gist.github.com/elrond79/f9ddb277da3eab2948d27ddb1f84aba0 -#if MAYA_API_VERSION >= 20180600 AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, rotateAxis), errorString); -#endif AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, matrix), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, worldMatrix), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, inverseMatrix), errorString); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h index f9a343d751..049485a9a7 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Scope.h @@ -49,15 +49,9 @@ namespace nodes { /// \ingroup nodes //---------------------------------------------------------------------------------------------------------------------- -#if MAYA_API_VERSION >= 20190200 && MAYA_API_VERSION < 20200000 -class Scope - : public MPxTransform_BoundingBox - , public AL::maya::utils::NodeHelper -#else class Scope : public MPxTransform , public AL::maya::utils::NodeHelper -#endif { public: Scope(); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Transform.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Transform.cpp index 84917c4cdf..3170ed40eb 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Transform.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/Transform.cpp @@ -31,14 +31,7 @@ #include namespace { -const int _transformProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "Transform", - "Transform" -#else - "Transform" -#endif -); +const int _transformProfilerCategory = MProfiler::addCategory("Transform", "Transform"); } // namespace namespace { @@ -175,14 +168,7 @@ MStatus Transform::initialise() AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, rotatePivotTranslate), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, scalePivot), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, scalePivotTranslate), errorString); - // Maya 2018 (checked 2018.2 and 2018.3) has a bug where, if any loaded plugin has an - // MPxTransform subclass that has ANY attribute that connected to rotateAxis, it will - // cause the rotateAxis to evaluate INCORRECTLY, even on the BASE transform class! See - // this gist for full reproduction details: - // https://gist.github.com/elrond79/f9ddb277da3eab2948d27ddb1f84aba0 -#if MAYA_API_VERSION >= 20180600 AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, rotateAxis), errorString); -#endif AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, matrix), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, worldMatrix), errorString); AL_MAYA_CHECK_ERROR(attributeAffects(inAttr, inverseMatrix), errorString); diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.cpp index 1af7a2dcda..45474177d4 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.cpp @@ -31,14 +31,8 @@ #define AL_USDMAYA_XFORM_COMP_EPSILON 1e-7 namespace { -const int _transformationMatrixProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "TransformationMatrix", - "TransformationMatrix" -#else - "TransformationMatrix" -#endif -); +const int _transformationMatrixProfilerCategory + = MProfiler::addCategory("TransformationMatrix", "TransformationMatrix"); } // namespace PXR_NAMESPACE_USING_DIRECTIVE diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/PrimFilter.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/PrimFilter.cpp index a4326bd9b1..c774d31938 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/PrimFilter.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/PrimFilter.cpp @@ -20,14 +20,7 @@ #include namespace { -const int _primFilterProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "PrimFIlter", - "PrimFIlter" -#else - "PrimFIlter" -#endif -); +const int _primFilterProfilerCategory = MProfiler::addCategory("PrimFIlter", "PrimFIlter"); } // namespace namespace AL { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeMetaData.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeMetaData.cpp index d3579a3349..2f580730d6 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeMetaData.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeMetaData.cpp @@ -24,14 +24,8 @@ #include namespace { -const int _proxyShapeMetadataProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "AL_usdmaya_ProxyShape_selection", - "AL_usdmaya_ProxyShape_selection" -#else - "AL_usdmaya_ProxyShape_selection" -#endif -); +const int _proxyShapeMetadataProfilerCategory + = MProfiler::addCategory("AL_usdmaya_ProxyShape_selection", "AL_usdmaya_ProxyShape_selection"); } // namespace namespace AL { diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeVariantFallbacks.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeVariantFallbacks.cpp index e8c6e6b33e..6085855674 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeVariantFallbacks.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/proxy/ProxyShapeVariantFallbacks.cpp @@ -22,13 +22,8 @@ #include namespace { const int _proxyShapeVariantFallbacksProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 "AL_usdmaya_ProxyShape_variant_fallbacks", - "AL_usdmaya_ProxyShape_variant_fallbacks" -#else - "AL_usdmaya_ProxyShape_variant_fallbacks" -#endif -); + "AL_usdmaya_ProxyShape_variant_fallbacks"); } // namespace namespace AL { diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_TransformTranslator.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_TransformTranslator.cpp index 4f0e9a0a2e..d1e89a5b57 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_TransformTranslator.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/test_translators_TransformTranslator.cpp @@ -26,7 +26,6 @@ #include #include #include -#include // For MAYA_APP_VERSION using AL::maya::test::compareNodes; using AL::maya::test::randomAnimatedNode; @@ -501,7 +500,6 @@ TEST(translators_TranformTranslator, worldSpaceGroupsExport) ASSERT_TRUE(stage->GetPrimAtPath(SdfPath("/C/X2/Y3/cube1"))); } -#if MAYA_APP_VERSION > 2019 TEST(translators_TranformTranslator, withOffsetParentMatrix) { MFileIO::newFile(true); @@ -851,5 +849,3 @@ TEST(translators_TranformTranslator, withOffsetParentMatrix) EXPECT_NEAR(1.0, worldMatrix[3][3], 1e-5); } } - -#endif diff --git a/plugin/al/translators/Camera.cpp b/plugin/al/translators/Camera.cpp index 9cb9c9580a..defb58d717 100644 --- a/plugin/al/translators/Camera.cpp +++ b/plugin/al/translators/Camera.cpp @@ -34,14 +34,7 @@ #include namespace { -const int _cameraProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "Camera", - "Camera" -#else - "Camera" -#endif -); +const int _cameraProfilerCategory = MProfiler::addCategory("Camera", "Camera"); } // namespace namespace AL { diff --git a/plugin/al/translators/MayaReference.cpp b/plugin/al/translators/MayaReference.cpp index 91d17a974e..904d4ac281 100644 --- a/plugin/al/translators/MayaReference.cpp +++ b/plugin/al/translators/MayaReference.cpp @@ -42,14 +42,7 @@ #include namespace { -const int _mayaReferenceProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "MayaReference", - "MayaReference" -#else - "MayaReference" -#endif -); +const int _mayaReferenceProfilerCategory = MProfiler::addCategory("MayaReference", "MayaReference"); } // namespace namespace AL { diff --git a/plugin/al/translators/Mesh.cpp b/plugin/al/translators/Mesh.cpp index 31b1ff13f7..d85f501fad 100644 --- a/plugin/al/translators/Mesh.cpp +++ b/plugin/al/translators/Mesh.cpp @@ -41,14 +41,7 @@ #include namespace { -const int _meshProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "Mesh", - "Mesh" -#else - "Mesh" -#endif -); +const int _meshProfilerCategory = MProfiler::addCategory("Mesh", "Mesh"); } // namespace namespace AL { diff --git a/plugin/al/translators/NurbsCurve.cpp b/plugin/al/translators/NurbsCurve.cpp index 92ac54ba49..ebb7615150 100644 --- a/plugin/al/translators/NurbsCurve.cpp +++ b/plugin/al/translators/NurbsCurve.cpp @@ -37,14 +37,7 @@ #include namespace { -const int _nurbsCurveProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "NurbsCurve", - "NurbsCurve" -#else - "NurbsCurve" -#endif -); +const int _nurbsCurveProfilerCategory = MProfiler::addCategory("NurbsCurve", "NurbsCurve"); } // namespace namespace AL { diff --git a/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.cpp b/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.cpp index 1be7790ae2..467af04bc8 100644 --- a/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.cpp +++ b/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.cpp @@ -30,14 +30,8 @@ #include namespace { -const int _animationTranslatorProfilerCategory = MProfiler::addCategory( -#if MAYA_API_VERSION >= 20190000 - "AnimationTranslator", - "AnimationTranslator" -#else - "AnimationTranslator" -#endif -); +const int _animationTranslatorProfilerCategory + = MProfiler::addCategory("AnimationTranslator", "AnimationTranslator"); } // namespace namespace AL { @@ -286,11 +280,8 @@ MStatus AnimationCheckTransformAttributes::initialise() AL_MAYA_CHECK_ERROR(status, errorString); m_commonTransformAttributes[12] = transformNodeClass.attribute("rotateOrder", &status); AL_MAYA_CHECK_ERROR(status, errorString); - -#if MAYA_APP_VERSION > 2019 m_commonTransformAttributes[13] = transformNodeClass.attribute("offsetParentMatrix", &status); AL_MAYA_CHECK_ERROR(status, errorString); -#endif m_inheritTransformAttribute = transformNodeClass.attribute("inheritsTransform", &status); AL_MAYA_CHECK_ERROR(status, errorString); diff --git a/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.h b/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.h index d55c2c7faa..f9c9e924d7 100644 --- a/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.h +++ b/plugin/al/usdmayautils/AL/usdmaya/utils/AnimationTranslator.h @@ -310,11 +310,7 @@ class AnimationTranslator class AnimationCheckTransformAttributes { private: -#if MAYA_APP_VERSION > 2019 constexpr static int transformAttributesCount { 14 }; -#else - constexpr static int transformAttributesCount { 13 }; -#endif public: AL_USDMAYA_UTILS_PUBLIC From 97827c9afcfb48d9221eb0f3451ed797032583c5 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:02:29 -0400 Subject: [PATCH 03/11] MAYA-129259 - MayaUsd: drop support for Maya 2018/2019/2020 and Qt 5.6.1 & 5.12.5 * clang-format --- lib/mayaUsd/utils/util.cpp | 43 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/mayaUsd/utils/util.cpp b/lib/mayaUsd/utils/util.cpp index c101c47543..d271f3dda6 100644 --- a/lib/mayaUsd/utils/util.cpp +++ b/lib/mayaUsd/utils/util.cpp @@ -19,6 +19,26 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -58,34 +78,13 @@ #include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - PXR_NAMESPACE_USING_DIRECTIVE namespace { From 75370bc63ab7f54a4b2e10a017d066027e795403 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Tue, 4 Jul 2023 11:56:52 -0400 Subject: [PATCH 04/11] MAYA-109 move custom image control code --- lib/mayaUsd/resources/ae/CMakeLists.txt | 2 +- .../resources/ae/usdschemabase/ae_template.py | 175 +--------------- .../ae/usdschemabase/custom_image_control.py | 197 ++++++++++++++++++ 3 files changed, 201 insertions(+), 173 deletions(-) create mode 100644 lib/mayaUsd/resources/ae/usdschemabase/custom_image_control.py diff --git a/lib/mayaUsd/resources/ae/CMakeLists.txt b/lib/mayaUsd/resources/ae/CMakeLists.txt index 97730eabfa..ea615e1006 100644 --- a/lib/mayaUsd/resources/ae/CMakeLists.txt +++ b/lib/mayaUsd/resources/ae/CMakeLists.txt @@ -12,7 +12,7 @@ if (CMAKE_UFE_V2_FEATURES_AVAILABLE) set(MAYAUSD_AE_TEMPLATES usdschemabase) foreach(_SUBDIR ${MAYAUSD_AE_TEMPLATES}) - install(FILES ${_SUBDIR}/__init__.py ${_SUBDIR}/custom_enum_control.py ${_SUBDIR}/ae_template.py + install(FILES ${_SUBDIR}/__init__.py ${_SUBDIR}/custom_image_control.py ${_SUBDIR}/custom_enum_control.py ${_SUBDIR}/ae_template.py DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/python/ufe_ae/usd/nodes/${_SUBDIR} ) endforeach() diff --git a/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py b/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py index ab71743bf6..46937ada02 100644 --- a/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py +++ b/lib/mayaUsd/resources/ae/usdschemabase/ae_template.py @@ -13,11 +13,12 @@ # limitations under the License. # +from .custom_image_control import customImageControlCreator + import collections import fnmatch from functools import partial import re -import os.path import ufe import maya.mel as mel import maya.cmds as cmds @@ -25,7 +26,6 @@ import mayaUsd.lib as mayaUsdLib import maya.internal.common.ufe_ae.template as ufeAeTemplate from mayaUsdLibRegisterStrings import getMayaUsdLibString -import mayaUsd_USDRootFileRelative as murel try: # This helper class was only added recently to Maya. @@ -34,11 +34,6 @@ except: hasAEPopupMenu = False -try: - from PySide2 import QtCore -except: - from PySide6 import QtCore - from maya.common.ui import LayoutManager, ParentManager from maya.common.ui import setClipboardData from maya.OpenMaya import MGlobal @@ -387,164 +382,6 @@ def onReplace(self, *args): # varying, so we don't need to implement the replace. pass -def _NOL10N(text): - return text - -class ImageCustomControl(object): - filenameField = _NOL10N("UIFilenameField") - - def __init__(self, ufeAttr, prim, attrName, useNiceName): - self.ufeAttr = ufeAttr - self.prim = prim - self.attrName = attrName - self.useNiceName = useNiceName - self.controlName = None - super(ImageCustomControl, self).__init__() - - def onCreate(self, *args): - cmds.setUITemplate(_NOL10N("attributeEditorTemplate"), pst=True) - - attrUIName = mayaUsdLib.Util.prettifyName(self.attrName) if self.useNiceName else self.attrName - ufeAttr = self.ufeAttr - - createdControl = cmds.rowLayout(nc=3) - self.controlName = createdControl - with LayoutManager(createdControl): - cmds.text(label=attrUIName) - cmds.textField(ImageCustomControl.filenameField) - cmds.symbolButton(_NOL10N("browser"), image=_NOL10N("navButtonBrowse.png")) - - cmds.setUITemplate(ppt=True) - pMenu = attributes.AEPopupMenu(createdControl, ufeAttr) - - self.onReplace() - return createdControl - - def onReplace(self, *args): - ufeAttr = self.ufeAttr - controlName = self.controlName - with ParentManager(controlName): - self.updateUi(ufeAttr, controlName) - callback = lambda filename,filetype : self.assignFilename(ufeAttr, filename, filetype) - command = lambda *_a : self.filenameBrowser(callback) - cmds.button(_NOL10N("browser"), c=command, e=True) - - self.attachCallbacks(ufeAttr, controlName, None) - - def updateUi(self, attr, uiControlName): - '''Callback function to update the UI when the data model changes.''' - isLocked = attributes.isAttributeLocked(attr) - bgClr = attributes.getAttributeColorRGB(attr) - # We might get called from the text field instead of the row layout: - fieldPos = uiControlName.find(ImageCustomControl.filenameField) - if fieldPos > 0: - uiControlName = uiControlName[:fieldPos - 1] - with ParentManager(uiControlName): - cmds.textField(ImageCustomControl.filenameField, e=True, tx=attr.get(), editable=not isLocked) - if bgClr: - cmds.textField(ImageCustomControl.filenameField, e=True, backgroundColor=bgClr) - - def attachCallbacks(self, ufeAttr, uiControl, changedCommand): - # Create change callback for UFE and UI value synchronization. - filenameControl = uiControl + "|" + ImageCustomControl.filenameField - uiControlDesc = attributes.UIControlDescriptor(filenameControl, 'textField', hasDrag=False) - cb = attributes.createChangeCb(self.updateUi, ufeAttr, uiControlDesc) - with ParentManager(uiControl): - cmds.textField(ImageCustomControl.filenameField, edit=True, changeCommand=cb) - - def assignFilename(self, ufeAttr, filename, fileType): - ufeFullPath = _NOL10N('%s.%s') % (ufe.PathString.string(ufeAttr.sceneItem().path()), ufeAttr.name) - cmds.setAttr(ufeFullPath, filename) - currentDir = cmds.workspace(q=True, dir=True) - mel.eval(_NOL10N("""retainWorkingDirectory("%s")""") % currentDir) - self.updateUi(ufeAttr, self.controlName) - return True - - @staticmethod - def fromNativePath(path): - if cmds.about(nt=True): - return cmds.encodeString(path).replace(_NOL10N("\\\\"),_NOL10N("/")) - return path - - @staticmethod - def fixFileDialogSplitters(): - org = QtCore.QCoreApplication.organizationName() - app = QtCore.QCoreApplication.applicationName() - settings = QtCore.QSettings(org, app) - kFileDialogSettingsGroup = 'FileDialog' - kOptionsSplittersKey = 'optionsSplitters' - settings.beginGroup(kFileDialogSettingsGroup) - size = settings.beginReadArray(kOptionsSplittersKey) - if size < 2 or settings.value(str(1), 0) <= 0: - settings.endArray() - settings.beginWriteArray(kOptionsSplittersKey) - for i in range(2): - settings.setArrayIndex(i) - settings.setValue(str(i), 120 + 120 * i) - settings.endArray() - settings.endArray() - settings.endGroup() - - def filenameBrowser(self, callback): - workspace = cmds.workspace(q=True, fn=True) - - ImageCustomControl.fixFileDialogSplitters() - - dialogArgs = { - 'startDir' : mel.eval(_NOL10N("""setWorkingDirectory("%s", "image", "sourceImages")""") % workspace), - 'filter' : mel.eval(_NOL10N("buildImageFileFilterList()")), - 'caption' : getMayaUsdLibString('kOpenImage'), - 'createCallback' : "mayaUsd_ImageFileRelative_UICreate", - 'initCallback' : "mayaUsd_ImageFileRelative_UIInit", - 'commitCallback' : "mayaUsd_ImageFileRelative_UICommit", - 'fileTypeCallback' : "mayaUsd_ImageFileRelative_FileTypeChanged", - 'selectionCallback' : "mayaUsd_ImageFileRelative_SelectionChanged", - } - - cmd = r'''fileDialog2''' \ - r''' -caption "{caption}"''' \ - r''' -fileMode 1''' \ - r''' -fileFilter "{filter}"''' \ - r''' -selectFileFilter "All Files"''' \ - r''' -startingDirectory "{startDir}"''' \ - r''' -optionsUICreate {createCallback}''' \ - r''' -optionsUIInit {initCallback}''' \ - r''' -optionsUICommit2 {commitCallback}''' \ - r''' -fileTypeChanged {fileTypeCallback}''' \ - r''' -selectionChanged {selectionCallback}'''.format(**dialogArgs) - - ImageCustomControl.prepareRelativeDir(self.prim) - - files = mel.eval(cmd) - - if files != None and len(files) > 0: - fileName = files[0] - if ImageCustomControl.wantRelativeFileName(): - layerDirName = ImageCustomControl.getCurrentTargetLayerDir(self.prim) - fileName = mayaUsdLib.Util.getPathRelativeToDirectory(fileName, layerDirName) - callback(ImageCustomControl.fromNativePath(fileName), _NOL10N("")) - - @staticmethod - def wantRelativeFileName(): - opVarName = "mayaUsd_MakePathRelativeToEditTargetLayer" - return cmds.optionVar(exists=opVarName) and cmds.optionVar(query=opVarName) - - @staticmethod - def getCurrentTargetLayerDir(prim): - stage = prim.GetStage() - if not stage: - return None - layer = stage.GetEditTarget().GetLayer() - if not layer: - return '' - layerFileName = layer.realPath - return os.path.dirname(layerFileName) - - @staticmethod - def prepareRelativeDir(prim): - layerDirName = ImageCustomControl.getCurrentTargetLayerDir(prim) - murel.usdFileRelative.setRelativeFilePathRoot(layerDirName) - class NoticeListener(object): # Inserted as a custom control, but does not have any UI. Instead we use @@ -593,12 +430,6 @@ def arrayCustomControlCreator(aeTemplate, c): return ArrayCustomControl(ufeAttr, aeTemplate.prim, c, aeTemplate.useNiceName) else: return None - -def imageCustomControlCreate(aeTemplate, c): - if not aeTemplate.isImageAttribute(c): - return None - ufeAttr = aeTemplate.attrS.attribute(c) - return ImageCustomControl(ufeAttr, aeTemplate.prim, c, aeTemplate.useNiceName) def defaultControlCreator(aeTemplate, c): cmds.editorTemplate(addControl=[c]) @@ -804,7 +635,7 @@ def __init__(self, ufeSceneItem): except: pass - _controlCreators = [connectionsCustomControlCreator, arrayCustomControlCreator, imageCustomControlCreate, defaultControlCreator] + _controlCreators = [connectionsCustomControlCreator, arrayCustomControlCreator, customImageControlCreator, defaultControlCreator] @staticmethod def prependControlCreator(controlCreator): diff --git a/lib/mayaUsd/resources/ae/usdschemabase/custom_image_control.py b/lib/mayaUsd/resources/ae/usdschemabase/custom_image_control.py new file mode 100644 index 0000000000..7f0f1d8184 --- /dev/null +++ b/lib/mayaUsd/resources/ae/usdschemabase/custom_image_control.py @@ -0,0 +1,197 @@ +# Copyright 2023 Autodesk +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import mayaUsd.lib as mayaUsdLib +from mayaUsdLibRegisterStrings import getMayaUsdLibString +import mayaUsd_USDRootFileRelative as murel + +import maya.cmds as cmds +import maya.mel as mel +import maya.internal.ufeSupport.attributes as attributes + +from maya.common.ui import LayoutManager, ParentManager + +import ufe + +import os.path + +try: + from PySide2 import QtCore +except: + from PySide6 import QtCore + + +class ImageCustomControl(object): + filenameField = "UIFilenameField" + + def __init__(self, ufeAttr, prim, attrName, useNiceName): + self.ufeAttr = ufeAttr + self.prim = prim + self.attrName = attrName + self.useNiceName = useNiceName + self.controlName = None + super(ImageCustomControl, self).__init__() + + def onCreate(self, *args): + cmds.setUITemplate("attributeEditorTemplate", pst=True) + + attrUIName = mayaUsdLib.Util.prettifyName(self.attrName) if self.useNiceName else self.attrName + ufeAttr = self.ufeAttr + + createdControl = cmds.rowLayout(nc=3) + self.controlName = createdControl + with LayoutManager(createdControl): + cmds.text(label=attrUIName) + cmds.textField(ImageCustomControl.filenameField) + cmds.symbolButton("browser", image="navButtonBrowse.png") + + cmds.setUITemplate(ppt=True) + pMenu = attributes.AEPopupMenu(createdControl, ufeAttr) + + self.onReplace() + return createdControl + + def onReplace(self, *args): + ufeAttr = self.ufeAttr + controlName = self.controlName + with ParentManager(controlName): + self.updateUi(ufeAttr, controlName) + callback = lambda filename,filetype : self.assignFilename(ufeAttr, filename, filetype) + command = lambda *_a : self.filenameBrowser(callback) + cmds.button("browser", c=command, e=True) + + self.attachCallbacks(ufeAttr, controlName, None) + + def updateUi(self, attr, uiControlName): + '''Callback function to update the UI when the data model changes.''' + isLocked = attributes.isAttributeLocked(attr) + bgClr = attributes.getAttributeColorRGB(attr) + # We might get called from the text field instead of the row layout: + fieldPos = uiControlName.find(ImageCustomControl.filenameField) + if fieldPos > 0: + uiControlName = uiControlName[:fieldPos - 1] + with ParentManager(uiControlName): + cmds.textField(ImageCustomControl.filenameField, e=True, tx=attr.get(), editable=not isLocked) + if bgClr: + cmds.textField(ImageCustomControl.filenameField, e=True, backgroundColor=bgClr) + + def attachCallbacks(self, ufeAttr, uiControl, changedCommand): + # Create change callback for UFE and UI value synchronization. + filenameControl = uiControl + "|" + ImageCustomControl.filenameField + uiControlDesc = attributes.UIControlDescriptor(filenameControl, 'textField', hasDrag=False) + cb = attributes.createChangeCb(self.updateUi, ufeAttr, uiControlDesc) + with ParentManager(uiControl): + cmds.textField(ImageCustomControl.filenameField, edit=True, changeCommand=cb) + + def assignFilename(self, ufeAttr, filename, fileType): + ufeFullPath = '%s.%s' % (ufe.PathString.string(ufeAttr.sceneItem().path()), ufeAttr.name) + cmds.setAttr(ufeFullPath, filename) + currentDir = cmds.workspace(q=True, dir=True) + mel.eval("""retainWorkingDirectory("%s")""" % currentDir) + self.updateUi(ufeAttr, self.controlName) + return True + + @staticmethod + def fromNativePath(path): + if cmds.about(nt=True): + return cmds.encodeString(path).replace("\\\\", "/") + return path + + @staticmethod + def fixFileDialogSplitters(): + org = QtCore.QCoreApplication.organizationName() + app = QtCore.QCoreApplication.applicationName() + settings = QtCore.QSettings(org, app) + kFileDialogSettingsGroup = 'FileDialog' + kOptionsSplittersKey = 'optionsSplitters' + settings.beginGroup(kFileDialogSettingsGroup) + size = settings.beginReadArray(kOptionsSplittersKey) + if size < 2 or settings.value(str(1), 0) <= 0: + settings.endArray() + settings.beginWriteArray(kOptionsSplittersKey) + for i in range(2): + settings.setArrayIndex(i) + settings.setValue(str(i), 120 + 120 * i) + settings.endArray() + settings.endArray() + settings.endGroup() + + def filenameBrowser(self, callback): + workspace = cmds.workspace(q=True, fn=True) + + ImageCustomControl.fixFileDialogSplitters() + + dialogArgs = { + 'startDir' : mel.eval("""setWorkingDirectory("%s", "image", "sourceImages")""" % workspace), + 'filter' : mel.eval("buildImageFileFilterList()"), + 'caption' : getMayaUsdLibString('kOpenImage'), + 'createCallback' : "mayaUsd_ImageFileRelative_UICreate", + 'initCallback' : "mayaUsd_ImageFileRelative_UIInit", + 'commitCallback' : "mayaUsd_ImageFileRelative_UICommit", + 'fileTypeCallback' : "mayaUsd_ImageFileRelative_FileTypeChanged", + 'selectionCallback' : "mayaUsd_ImageFileRelative_SelectionChanged", + } + + cmd = r'''fileDialog2''' \ + r''' -caption "{caption}"''' \ + r''' -fileMode 1''' \ + r''' -fileFilter "{filter}"''' \ + r''' -selectFileFilter "All Files"''' \ + r''' -startingDirectory "{startDir}"''' \ + r''' -optionsUICreate {createCallback}''' \ + r''' -optionsUIInit {initCallback}''' \ + r''' -optionsUICommit2 {commitCallback}''' \ + r''' -fileTypeChanged {fileTypeCallback}''' \ + r''' -selectionChanged {selectionCallback}'''.format(**dialogArgs) + + ImageCustomControl.prepareRelativeDir(self.prim) + + files = mel.eval(cmd) + + if files != None and len(files) > 0: + fileName = files[0] + if ImageCustomControl.wantRelativeFileName(): + layerDirName = ImageCustomControl.getCurrentTargetLayerDir(self.prim) + fileName = mayaUsdLib.Util.getPathRelativeToDirectory(fileName, layerDirName) + callback(ImageCustomControl.fromNativePath(fileName), "") + + @staticmethod + def wantRelativeFileName(): + opVarName = "mayaUsd_MakePathRelativeToEditTargetLayer" + return cmds.optionVar(exists=opVarName) and cmds.optionVar(query=opVarName) + + @staticmethod + def getCurrentTargetLayerDir(prim): + stage = prim.GetStage() + if not stage: + return None + layer = stage.GetEditTarget().GetLayer() + if not layer: + return '' + layerFileName = layer.realPath + return os.path.dirname(layerFileName) + + @staticmethod + def prepareRelativeDir(prim): + layerDirName = ImageCustomControl.getCurrentTargetLayerDir(prim) + murel.usdFileRelative.setRelativeFilePathRoot(layerDirName) + + +def customImageControlCreator(aeTemplate, c): + if not aeTemplate.isImageAttribute(c): + return None + ufeAttr = aeTemplate.attrS.attribute(c) + return ImageCustomControl(ufeAttr, aeTemplate.prim, c, aeTemplate.useNiceName) + From 5a99dda1e5c99bdacb4b25e44961e988d954489b Mon Sep 17 00:00:00 2001 From: Jerry Gamache Date: Tue, 4 Jul 2023 13:20:19 -0400 Subject: [PATCH 05/11] LOOKDEVX-1592 - Clean up references, targets, and connections on delete Similar to what is done on Rename, we traverse the scene and clean up any reference, target, or connection that will become invalid once the prim is removed. --- lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp | 9 ++ lib/usdUfe/utils/usdUtils.cpp | 157 +++++++++++++++++++++++ lib/usdUfe/utils/usdUtils.h | 6 + test/lib/ufe/testDeleteCmd.py | 78 ++++++++++- test/testSamples/tree/treeMat.usda | 71 ++++++++++ 5 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 test/testSamples/tree/treeMat.usda diff --git a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp index 4ac69c9cc7..4c85192fe7 100644 --- a/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp +++ b/lib/mayaUsd/ufe/UsdUndoDeleteCommand.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -67,6 +68,14 @@ void UsdUndoDeleteCommand::execute() #ifdef UFE_V4_FEATURES_AVAILABLE UsdAttributes::removeAttributesConnections(_prim); #endif + // Let removeAttributesConnections be run first as it will also cleanup + // attributes that were authored only to be the destination of a connection. + if (!UsdUfe::cleanReferencedPath(_prim)) { + const std::string error = TfStringPrintf( + "Failed to cleanup references to prim \"%s\".", _prim.GetPath().GetText()); + TF_WARN("%s", error.c_str()); + throw std::runtime_error(error); + } PrimSpecFunc deleteFunc = [stage](const UsdPrim& prim, const SdfPrimSpecHandle& primSpec) -> void { PXR_NS::UsdEditContext ctx(stage, primSpec->GetLayer()); diff --git a/lib/usdUfe/utils/usdUtils.cpp b/lib/usdUfe/utils/usdUtils.cpp index 965a93b0a7..c3a3acbc64 100644 --- a/lib/usdUfe/utils/usdUtils.cpp +++ b/lib/usdUfe/utils/usdUtils.cpp @@ -107,6 +107,36 @@ void replaceInternalReferencePath( } } +void removeInternalReferencePath( + const UsdPrim& deletedPrim, + const SdfReferencesProxy& referencesList, + SdfListOpType op) +{ + // set the listProxy based on the SdfListOpType + SdfReferencesProxy::ListProxy listProxy = referencesList.GetAppendedItems(); + if (op == SdfListOpTypePrepended) { + listProxy = referencesList.GetPrependedItems(); + } else if (op == SdfListOpTypeOrdered) { + listProxy = referencesList.GetOrderedItems(); + } else if (op == SdfListOpTypeAdded) { + listProxy = referencesList.GetAddedItems(); + } else if (op == SdfListOpTypeDeleted) { + listProxy = referencesList.GetDeletedItems(); + } + + for (size_t idx = 0; idx < listProxy.size();) { + const SdfReference ref = listProxy[idx]; + if (UsdUfe::isInternalReference(ref)) { + if (deletedPrim.GetPath() == ref.GetPrimPath() + || ref.GetPrimPath().HasPrefix(deletedPrim.GetPath())) { + listProxy.Erase(idx); + continue; // Not increasing idx + } + } + ++idx; + } +} + // This template method updates the SdfPath for inherited or specialized arcs // when the path to the concrete prim they refer to has changed. // HS January 13, 2021: Find a better generic way to consolidate this method with @@ -143,6 +173,34 @@ void replacePath(const UsdPrim& oldPrim, const SdfPath& newPath, const T& proxy, } } +// This template method cleans the SdfPath for inherited or specialized arcs +// when the path to the concrete prim they refer to has becomed invalid. +// HS January 13, 2021: Find a better generic way to consolidate this method with +// removeReferenceItems +template void removePath(const UsdPrim& deletedPrim, const T& proxy, SdfListOpType op) +{ + // set the listProxy based on the SdfListOpType + typename T::ListProxy listProxy { proxy.GetAppendedItems() }; + if (op == SdfListOpTypePrepended) { + listProxy = proxy.GetPrependedItems(); + } else if (op == SdfListOpTypeOrdered) { + listProxy = proxy.GetOrderedItems(); + } else if (op == SdfListOpTypeAdded) { + listProxy = proxy.GetAddedItems(); + } else if (op == SdfListOpTypeDeleted) { + listProxy = proxy.GetDeletedItems(); + } + + for (size_t idx = 0; idx < listProxy.size();) { + const SdfPath path = listProxy[idx]; + if (deletedPrim.GetPath() == path.GetPrimPath() || path.HasPrefix(deletedPrim.GetPath())) { + listProxy.Erase(idx); + continue; // Not increasing idx + } + ++idx; + } +} + void replacePropertyPath(const UsdPrim& oldPrim, const SdfPath& newPath, UsdProperty& prop) { if (prop.Is()) { @@ -180,6 +238,58 @@ void replacePropertyPath(const UsdPrim& oldPrim, const SdfPath& newPath, UsdProp } } +void removePropertyPath(const UsdPrim& deletedPrim, UsdProperty& prop) +{ + if (prop.Is()) { + UsdAttribute attr = prop.As(); + SdfPathVector sources; + attr.GetConnections(&sources); + bool hasChanged = false; + for (size_t i = 0; i < sources.size();) { + const SdfPath& path = sources[i]; + if (deletedPrim.GetPath() == path.GetPrimPath() + || path.HasPrefix(deletedPrim.GetPath())) { + hasChanged = true; + sources.erase(sources.cbegin() + i); + continue; + } + ++i; + } + if (hasChanged) { + if (sources.empty()) { + attr.ClearConnections(); + if (!attr.HasValue()) { + prop.GetPrim().RemoveProperty(prop.GetName()); + } + } else { + attr.SetConnections(sources); + } + } + } else if (prop.Is()) { + UsdRelationship rel = prop.As(); + SdfPathVector targets; + rel.GetTargets(&targets); + bool hasChanged = false; + for (size_t i = 0; i < targets.size();) { + const SdfPath& path = targets[i]; + if (deletedPrim.GetPath() == path.GetPrimPath() + || path.HasPrefix(deletedPrim.GetPath())) { + hasChanged = true; + targets.erase(targets.cbegin() + i); + continue; + } + ++i; + } + if (hasChanged) { + if (targets.empty()) { + rel.ClearTargets(true); + } else { + rel.SetTargets(targets); + } + } + } +} + } // namespace namespace USDUFE_NS_DEF { @@ -261,6 +371,53 @@ bool updateReferencedPath(const UsdPrim& oldPrim, const SdfPath& newPath) return true; } +bool cleanReferencedPath(const UsdPrim& deletedPrim) +{ + SdfChangeBlock changeBlock; + + for (const auto& p : deletedPrim.GetStage()->Traverse()) { + + auto primSpec = getPrimSpecAtEditTarget(p); + // check different composition arcs + if (p.HasAuthoredReferences()) { + if (primSpec) { + + SdfReferencesProxy referencesList = primSpec->GetReferenceList(); + + // update append/prepend lists individually + removeInternalReferencePath(deletedPrim, referencesList, SdfListOpTypeAppended); + removeInternalReferencePath(deletedPrim, referencesList, SdfListOpTypePrepended); + } + } else if (p.HasAuthoredInherits()) { + if (primSpec) { + + SdfInheritsProxy inheritsList = primSpec->GetInheritPathList(); + + // update append/prepend lists individually + removePath(deletedPrim, inheritsList, SdfListOpTypeAppended); + removePath(deletedPrim, inheritsList, SdfListOpTypePrepended); + } + } else if (p.HasAuthoredSpecializes()) { + if (primSpec) { + SdfSpecializesProxy specializesList = primSpec->GetSpecializesList(); + + // update append/prepend lists individually + removePath( + deletedPrim, specializesList, SdfListOpTypeAppended); + removePath( + deletedPrim, specializesList, SdfListOpTypePrepended); + } + } + + // Need to repath connections and relationships: + for (auto& prop : p.GetProperties()) { + removePropertyPath(deletedPrim, prop); + } + } + + return true; +} + bool isInternalReference(const SdfReference& ref) { return ref.IsInternal(); } } // namespace USDUFE_NS_DEF diff --git a/lib/usdUfe/utils/usdUtils.h b/lib/usdUfe/utils/usdUtils.h index a99d04ef3e..95f45a2c45 100644 --- a/lib/usdUfe/utils/usdUtils.h +++ b/lib/usdUfe/utils/usdUtils.h @@ -41,6 +41,12 @@ void printCompositionQuery(const UsdPrim& prim, std::ostream& os); USDUFE_PUBLIC bool updateReferencedPath(const UsdPrim& oldPrim, const SdfPath& newPath); +//! This function automatically cleans the SdfPath for different +// composition arcs (internal references, inherits, specializes) when +// the path to the concrete prim they refer to becomes invalid. +USDUFE_PUBLIC +bool cleanReferencedPath(const UsdPrim& deletedPrim); + //! Returns true if reference is internal. USDUFE_PUBLIC bool isInternalReference(const SdfReference&); diff --git a/test/lib/ufe/testDeleteCmd.py b/test/lib/ufe/testDeleteCmd.py index 687fa7a715..9b01f0eade 100644 --- a/test/lib/ufe/testDeleteCmd.py +++ b/test/lib/ufe/testDeleteCmd.py @@ -29,7 +29,7 @@ import ufe -from pxr import Sdf +from pxr import Sdf, UsdShade import os import unittest @@ -526,6 +526,82 @@ def testDeleteAndRemoveConnections(self): self.assertFalse(surface2Prim.HasProperty('outputs:out')) self.assertFalse(surface3Prim.HasProperty('inputs:bsdf')) + def testDeleteAndRemoveReference(self): + '''Test deleting a prim and its references''' + + # open treeRef.ma scene in testSamples + mayaUtils.openTreeRefScene() + + # validate the default edit target to be the Rootlayer. + mayaPathSegment = mayaUtils.createUfePathSegment('|TreeRef_usd|TreeRef_usdShape') + stage = mayaUsd.ufe.getStage(str(mayaPathSegment)) + self.assertTrue(stage) + self.assertEqual(stage.GetEditTarget().GetLayer(), stage.GetRootLayer()) + self.assertTrue(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + # delete the greenLeaf and check the internal references were cleaned: + cmds.delete('|TreeRef_usd|TreeRef_usdShape,/TreeBase/leavesXform/greenLeaf') + self.assertFalse(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + # Ref2 has an "external" reference, but to this file. It will not be + # cleaned up because external, baut maybe it should have since the + # referenced file happens to be the root layer? + self.assertTrue(stage.GetPrimAtPath('/TreeBase/leaf_ref_2').HasAuthoredReferences()) + + # validate undo + cmds.undo() + ref1 = stage.GetPrimAtPath('/TreeBase/leaf_ref_1') + self.assertTrue(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + # validate redo + cmds.redo() + self.assertFalse(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + # Try deleting leavesXform hierarchy, which also deletes greenLeaf and + # should clean-up the reference. + cmds.undo() + cmds.delete('|TreeRef_usd|TreeRef_usdShape,/TreeBase/leavesXform') + self.assertFalse(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + # validate undo + cmds.undo() + self.assertTrue(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + # validate redo + cmds.redo() + self.assertFalse(stage.GetPrimAtPath('/TreeBase/leaf_ref_1').HasAuthoredReferences()) + + def testDeleteAndInheritMaterial(self): + '''Test deleting a material cleans up all places where it was assigned''' + + cmds.file(new=True, force=True) + testFile = testUtils.getTestScene('tree', 'treeMat.usda') + pathString,stage = mayaUtils.createProxyFromFile(testFile) + self.assertTrue(stage) + self.assertTrue(pathString) + matAPI = UsdShade.MaterialBindingAPI(stage.GetPrimAtPath('/TreeBase/leavesXform/leaves')) + + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtlFoliage/GreenMat') + + cmds.delete(pathString + ',/mtlFoliage/GreenMat') + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtl/BrownMat') + + cmds.undo() + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtlFoliage/GreenMat') + + cmds.redo() + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtl/BrownMat') + + cmds.undo() + cmds.delete(pathString + ',/mtlFoliage') + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtl/BrownMat') + + cmds.undo() + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtlFoliage/GreenMat') + + cmds.redo() + self.assertEqual(matAPI.ComputeBoundMaterial()[0].GetPrim().GetPath(), '/mtl/BrownMat') + + def testDeleteRestrictionMutedLayer(self): ''' Test delete restriction - we don't allow removal of a prim diff --git a/test/testSamples/tree/treeMat.usda b/test/testSamples/tree/treeMat.usda new file mode 100644 index 0000000000..2010cb3a68 --- /dev/null +++ b/test/testSamples/tree/treeMat.usda @@ -0,0 +1,71 @@ +#usda 1.0 +( + defaultPrim = "TreeBase" + upAxis = "Y" +) + +def Xform "TreeBase" ( + prepend apiSchemas = ["MaterialBindingAPI"] +) +{ + rel material:binding = + + def Xform "leavesXform" ( + prepend apiSchemas = ["MaterialBindingAPI"] + ) + { + rel material:binding = + double3 xformOp:translate = (0, 2.5, 0) + uniform token[] xformOpOrder = ["xformOp:translate"] + + def Sphere "leaves" + { + float3[] extent = [(-2, -2, -2), (2, 2, 2)] + color3f[] primvars:displayColor = [(0, 1, 0)] + double radius = 2 + } + } + + def Cylinder "trunk" ( + active = true + kind = "component" + ) + { + uniform token axis = "Y" + float3[] extent = [(-1, -1, -1), (1, 1, 1)] + double height = 2 + color3f[] primvars:displayColor = [(0.66, 0.33, 0)] + double radius = 0.5 + } +} + +def Scope "mtl" +{ + def Material "BrownMat" + { + token outputs:surface.connect = + + def Shader "BrownSrf" + { + uniform token info:id = "UsdPreviewSurface" + color3f inputs:diffuseColor = (0.1293, 0.0625, 0.0050000004) + token outputs:surface + } + } +} + +def Scope "mtlFoliage" +{ + def Material "GreenMat" + { + token outputs:surface.connect = + + def Shader "GreenSrf" + { + uniform token info:id = "UsdPreviewSurface" + color3f inputs:diffuseColor = (0, 1, 0) + token outputs:surface + } + } +} + From 2702f270fb693e983ac09c534ceec70b77650e09 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Fri, 30 Jun 2023 14:43:20 -0400 Subject: [PATCH 06/11] EMSUSD 243 load reference and payload without default prim - Refactor add reference and add payload commands into a common base class. - (The code were almost similar and now have even more in common.) - Add validation of the ref or payload targeted prim to catch common errors. - For example, the targeted prim must have the same type as the referencing prim. - For example: an xform inside an xform, a mesh inside a mesh. - Target the first valid root prim when no explicit prim were given and there is no default prim. - Add warnings for common errors to help the user know what went wrong. - Add a unit test for files without default prim. --- lib/usdUfe/ufe/CMakeLists.txt | 2 + lib/usdUfe/ufe/UsdUndoAddPayloadCommand.cpp | 27 +--- lib/usdUfe/ufe/UsdUndoAddPayloadCommand.h | 25 +--- .../ufe/UsdUndoAddRefOrPayloadCommand.cpp | 141 ++++++++++++++++++ .../ufe/UsdUndoAddRefOrPayloadCommand.h | 57 +++++++ lib/usdUfe/ufe/UsdUndoAddReferenceCommand.cpp | 27 +--- lib/usdUfe/ufe/UsdUndoAddReferenceCommand.h | 25 +--- test/lib/ufe/testReferenceCommands.py | 28 ++++ .../twoSpheres/sphere_no_default.usda | 19 +++ 9 files changed, 275 insertions(+), 76 deletions(-) create mode 100644 lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp create mode 100644 lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.h create mode 100644 test/testSamples/twoSpheres/sphere_no_default.usda diff --git a/lib/usdUfe/ufe/CMakeLists.txt b/lib/usdUfe/ufe/CMakeLists.txt index 4633c6cf1d..c72363a481 100644 --- a/lib/usdUfe/ufe/CMakeLists.txt +++ b/lib/usdUfe/ufe/CMakeLists.txt @@ -23,6 +23,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdUndoAddNewPrimCommand.cpp UsdUndoAddPayloadCommand.cpp UsdUndoAddReferenceCommand.cpp + UsdUndoAddRefOrPayloadCommand.cpp UsdUndoClearPayloadsCommand.cpp UsdUndoClearReferencesCommand.cpp UsdUndoCreateGroupCommand.cpp @@ -65,6 +66,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdUndoAddNewPrimCommand.h UsdUndoAddPayloadCommand.h UsdUndoAddReferenceCommand.h + UsdUndoAddRefOrPayloadCommand.h UsdUndoClearPayloadsCommand.h UsdUndoClearReferencesCommand.h UsdUndoCreateGroupCommand.h diff --git a/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.cpp b/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.cpp index 22e002c266..c2abca6dba 100644 --- a/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.cpp +++ b/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.cpp @@ -16,36 +16,23 @@ #include "UsdUndoAddPayloadCommand.h" -#include -#include - namespace USDUFE_NS_DEF { UsdUndoAddPayloadCommand::UsdUndoAddPayloadCommand( const PXR_NS::UsdPrim& prim, const std::string& filePath, bool prepend) - : _prim(prim) - , _sdfPayload() - , _filePath(filePath) - , _listPos( - prepend ? PXR_NS::UsdListPositionBackOfPrependList - : PXR_NS::UsdListPositionBackOfAppendList) + : UsdUndoAddPayloadCommand(prim, filePath, {}, prepend) { } -void UsdUndoAddPayloadCommand::executeImplementation() +UsdUndoAddPayloadCommand::UsdUndoAddPayloadCommand( + const PXR_NS::UsdPrim& prim, + const std::string& filePath, + const std::string& primPath, + bool prepend) + : UsdUndoAddRefOrPayloadCommand(prim, filePath, primPath, getListPosition(prepend), true) { - if (!_prim.IsValid()) - return; - - if (PXR_NS::TfStringEndsWith(_filePath, ".mtlx")) { - _sdfPayload = PXR_NS::SdfPayload(_filePath, PXR_NS::SdfPath("/MaterialX")); - } else { - _sdfPayload = PXR_NS::SdfPayload(_filePath); - } - PXR_NS::UsdPayloads primPayloads = _prim.GetPayloads(); - primPayloads.AddPayload(_sdfPayload, _listPos); } } // namespace USDUFE_NS_DEF diff --git a/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.h b/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.h index ea132914b6..8eb2b0ce82 100644 --- a/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.h +++ b/lib/usdUfe/ufe/UsdUndoAddPayloadCommand.h @@ -16,20 +16,12 @@ #ifndef USD_UFE_ADD_PAYLOAD_COMMAND #define USD_UFE_ADD_PAYLOAD_COMMAND -#include -#include - -#include -#include - -#include - -#include +#include namespace USDUFE_NS_DEF { //! \brief Command to add a payload to a prim. -class USDUFE_PUBLIC UsdUndoAddPayloadCommand : public UsdUndoableCommand +class USDUFE_PUBLIC UsdUndoAddPayloadCommand : public UsdUndoAddRefOrPayloadCommand { public: UsdUndoAddPayloadCommand( @@ -37,14 +29,11 @@ class USDUFE_PUBLIC UsdUndoAddPayloadCommand : public UsdUndoableCommand +#include +#include +#include +#include + +namespace USDUFE_NS_DEF { + +using namespace PXR_NS; + +static std::string validatePrimSpec(const UsdPrim& prim, const SdfPrimSpecHandle& primSpec) +{ + if (!primSpec) + return "is not valid."; + + // A common error is to reference a prim that is not the same type as the prim + // that contains the reference. Since only the type of the prim that contains + // the reference is used, the referenced prim might not show up. + // + // This happens a lot when trying to reference geometry (mesh) instead of the + // prim containing the geometry. Of vis-versa, referencing a prim inside a mesh. + const std::string& primType = prim.GetTypeName(); + const std::string& targetType = primSpec->GetTypeName(); + if (primType != targetType) + return TfStringPrintf( + "does not have the same type as the targeted prim: [%s] vs [%s].", + primType.c_str(), + targetType.c_str()); + + return ""; +} + +static PXR_NS::SdfPath +getPrimPath(const UsdPrim& prim, const std::string& filePath, const std::string& primPath) +{ + // When an explicit prim path was given, use that. + if (!primPath.empty()) + return SdfPath(primPath); + + // If no prim path were specified and we are referencing a MaterialX file + // then use the MaterialX prim as the target for the reference. + // + // TODO: should we force this even when the referenced file has a default prim? + if (TfStringEndsWith(filePath, ".mtlx")) + return SdfPath("/MaterialX"); + + // Retrieve the layer for analysis. + // + // Note: we don't print any warning if the layer cannot be found as we assume + // the load itself will also fail and print an error. + SdfLayerRefPtr layerRef = SdfLayer::FindOrOpen(filePath); + if (!layerRef) + return SdfPath(); + + // If the referenced file has a default prim, leave the prim path empty. + if (layerRef->HasDefaultPrim()) { + TfToken primName = layerRef->GetDefaultPrim(); + SdfPrimSpecHandle primSpec = layerRef->GetPrimAtPath(SdfPath(primName.GetText())); + const std::string errorMessage = validatePrimSpec(prim, primSpec); + if (!errorMessage.empty()) + TF_WARN( + (std::string("The default prim in file [%s] ") + errorMessage).c_str(), + filePath.c_str()); + return SdfPath(); + } + + // If the referenced file has no default prim, return the path to the first + // valid root prim we find. + std::string errorMessage = " is absent."; + for (const SdfPrimSpecHandle primSpec : layerRef->GetRootPrims()) { + if (!primSpec) + continue; + + errorMessage = validatePrimSpec(prim, primSpec); + if (errorMessage.empty()) + return primSpec->GetPath(); + } + + TF_WARN( + (std::string("The file [%s] does not contain a default prim and the root prim ") + + errorMessage) + .c_str(), + filePath.c_str()); + + return SdfPath(); +} + +/* static */ UsdListPosition UsdUndoAddRefOrPayloadCommand::getListPosition(bool prepend) +{ + return prepend ? UsdListPositionBackOfPrependList : UsdListPositionBackOfAppendList; +} + +UsdUndoAddRefOrPayloadCommand::UsdUndoAddRefOrPayloadCommand( + const UsdPrim& prim, + const std::string& filePath, + const std::string& primPath, + UsdListPosition listPos, + bool isPayload) + : _prim(prim) + , _filePath(filePath) + , _primPath(primPath) + , _listPos(listPos) + , _isPayload(isPayload) +{ +} + +void UsdUndoAddRefOrPayloadCommand::executeImplementation() +{ + if (!_prim.IsValid()) + return; + + SdfPath primPath = getPrimPath(_prim, _filePath, _primPath); + if (_isPayload) { + SdfPayload payload(_filePath, primPath); + UsdPayloads primPayloads = _prim.GetPayloads(); + primPayloads.AddPayload(payload, _listPos); + } else { + SdfReference ref(_filePath, primPath); + UsdReferences primRefs = _prim.GetReferences(); + primRefs.AddReference(ref, _listPos); + } +} + +} // namespace USDUFE_NS_DEF diff --git a/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.h b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.h new file mode 100644 index 0000000000..56de801151 --- /dev/null +++ b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.h @@ -0,0 +1,57 @@ +// +// Copyright 2023 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef USD_UFE_ADD_REF_OR_PAYLOAD_COMMAND +#define USD_UFE_ADD_REF_OR_PAYLOAD_COMMAND + +#include +#include + +#include +#include + +#include + +#include + +namespace USDUFE_NS_DEF { + +//! \brief Command to add a reference or payload to a prim. +class USDUFE_PUBLIC UsdUndoAddRefOrPayloadCommand : public UsdUndoableCommand +{ +public: + UsdUndoAddRefOrPayloadCommand( + const PXR_NS::UsdPrim& prim, + const std::string& filePath, + const std::string& primPath, + PXR_NS::UsdListPosition listPos, + bool isPayload); + +protected: + static PXR_NS::UsdListPosition getListPosition(bool prepend); + + void executeImplementation() override; + +private: + PXR_NS::UsdPrim _prim; + std::string _filePath; + std::string _primPath; + PXR_NS::UsdListPosition _listPos; + bool _isPayload; +}; + +} // namespace USDUFE_NS_DEF + +#endif /* USD_UFE_ADD_REF_OR_PAYLOAD_COMMAND */ diff --git a/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.cpp b/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.cpp index e968cab91b..d06bd6ce70 100644 --- a/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.cpp +++ b/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.cpp @@ -15,36 +15,23 @@ // #include "UsdUndoAddReferenceCommand.h" -#include -#include - namespace USDUFE_NS_DEF { -//! \brief Command to add a reference to a prim. UsdUndoAddReferenceCommand::UsdUndoAddReferenceCommand( const PXR_NS::UsdPrim& prim, const std::string& filePath, bool prepend) - : _prim(prim) - , _sdfRef() - , _filePath(filePath) - , _listPos( - prepend ? PXR_NS::UsdListPositionBackOfPrependList - : PXR_NS::UsdListPositionBackOfAppendList) + : UsdUndoAddReferenceCommand(prim, filePath, {}, prepend) { } -void UsdUndoAddReferenceCommand::executeImplementation() +UsdUndoAddReferenceCommand::UsdUndoAddReferenceCommand( + const PXR_NS::UsdPrim& prim, + const std::string& filePath, + const std::string& primPath, + bool prepend) + : UsdUndoAddRefOrPayloadCommand(prim, filePath, primPath, getListPosition(prepend), false) { - if (!_prim.IsValid()) - return; - - _sdfRef = PXR_NS::TfStringEndsWith(_filePath, ".mtlx") - ? PXR_NS::SdfReference(_filePath, PXR_NS::SdfPath("/MaterialX")) - : PXR_NS::SdfReference(_filePath); - - PXR_NS::UsdReferences primRefs = _prim.GetReferences(); - primRefs.AddReference(_sdfRef, _listPos); } } // namespace USDUFE_NS_DEF diff --git a/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.h b/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.h index 09b67273f0..bb81a77285 100644 --- a/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.h +++ b/lib/usdUfe/ufe/UsdUndoAddReferenceCommand.h @@ -16,20 +16,12 @@ #ifndef USD_UFE_ADD_REFERENCE_COMMAND #define USD_UFE_ADD_REFERENCE_COMMAND -#include -#include - -#include -#include - -#include - -#include +#include namespace USDUFE_NS_DEF { //! \brief Command to add a reference to a prim. -class USDUFE_PUBLIC UsdUndoAddReferenceCommand : public UsdUndoableCommand +class USDUFE_PUBLIC UsdUndoAddReferenceCommand : public UsdUndoAddRefOrPayloadCommand { public: UsdUndoAddReferenceCommand( @@ -37,14 +29,11 @@ class USDUFE_PUBLIC UsdUndoAddReferenceCommand : public UsdUndoableCommand Date: Tue, 4 Jul 2023 15:40:12 -0400 Subject: [PATCH 07/11] EMSUSD-249 Refactors relative path dialog options to be more clear --- plugin/adsk/scripts/mayaUSDRegisterStrings.py | 5 ++--- plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.py b/plugin/adsk/scripts/mayaUSDRegisterStrings.py index 1abcce1732..782b433fae 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.py +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.py @@ -35,15 +35,14 @@ def mayaUSDRegisterStrings(): register("kDiscardStageEditsReloadMsg", "Are you sure you want to reload ^1s as the stage source?\n\nAll edits on your layers (except the session layer) in ^2s will be discarded.") register("kLoadUSDFile", "Load USD File") register("kFileOptions", "File Options") + register("kRelativePathOptions", "Relative Pathing") register("kMakePathRelativeToSceneFile", "Make Path Relative to Scene File") register("kMakePathRelativeToSceneFileAnn", "Path will be relative to your Maya scene file.") register("kMakePathRelativeToEditTargetLayer", "Make Path Relative to Edit Target Layer Directory") register("kMakePathRelativeToEditTargetLayerAnn", "Enable to activate relative pathing to your current edit target layer's directory.\nIf this option is disabled, verify that your target layer is not anonymous and save it to disk.") register("kMakePathRelativeToParentLayer", "Make Path Relative to Parent Layer Directory") register("kMakePathRelativeToParentLayerAnn", "Enable to activate relative pathing to your current parent layer's directory.\nIf this option is disabled, verify that your parent layer is not anonymous and save it to disk.") - register("kUnresolvedPath", "Unresolved Path:") + register("kUnresolvedPath", "Path Preview:") register("kUnresolvedPathAnn", "This field indicates the path with the file name currently chosen in your text input. Note: This is the string that will be written out to the file in the chosen directory in order to enable portability.") - register("kResolvedPath", "Resolved Path:") - register("kResolvedPathAnn", "This field indicates the resolved path of your chosen working directory for your USD file. Note: The resolved path for the file can vary for each individual as the file is handed off.") register("kCompositionArcOptions", "Composition Arc Options") register("kPreview", "Preview") diff --git a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py index f19bcae7f6..627aadab33 100644 --- a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py +++ b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py @@ -79,23 +79,20 @@ def uiCreate(cls, parentLayout, relativeToWhat): topForm = cmds.columnLayout('actionOptionsForm', rowSpacing=5) - kFileOptionsStr = getMayaUsdString("kFileOptions") + kRelativePathOptionsStr = getMayaUsdString("kRelativePathOptions") kMakePathRelativeStr = getMayaUsdString("kMakePathRelativeTo" + relativeToWhat) kMakePathRelativeAnnStr = getMayaUsdString("kMakePathRelativeTo" + relativeToWhat + "Ann") kUnresolvedPathStr = getMayaUsdString("kUnresolvedPath") kUnresolvedPathAnnStr = getMayaUsdString("kUnresolvedPathAnn") - kResolvedPathStr = getMayaUsdString("kResolvedPath") - kResolvedPathAnnStr = getMayaUsdString("kResolvedPathAnn") optBoxMarginWidth = mel.eval('global int $gOptionBoxTemplateDescriptionMarginWidth; $gOptionBoxTemplateDescriptionMarginWidth += 0') cmds.setParent(topForm) - cmds.frameLayout(label=kFileOptionsStr, collapsable=False) + cmds.frameLayout(label=kRelativePathOptionsStr, collapsable=False) widgetColumn = cmds.columnLayout() cmds.checkBox(cls.kMakePathRelativeCheckBox, label=kMakePathRelativeStr, ann=kMakePathRelativeAnnStr) cmds.checkBox(cls.kMakePathRelativeCheckBox, edit=True, changeCommand=cls.onMakePathRelativeChanged) cmds.textFieldGrp(cls.kUnresolvedPathTextField, label=kUnresolvedPathStr, ann=kUnresolvedPathAnnStr, editable=False) - cmds.textFieldGrp(cls.kResolvedPathTextField, label=kResolvedPathStr, ann=kResolvedPathAnnStr , editable=False) cls._haveRelativePathFields = True return topForm @@ -142,7 +139,6 @@ def uiInit(cls, parentLayout, canBeRelative, relativeToWhat): showPreviewFields = cmds.file(q=True, exists=True) cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, visible=showPreviewFields) - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, visible=showPreviewFields) # Only enable fields when make relative is checked. makePathRelative = cmds.checkBox(cls.kMakePathRelativeCheckBox, query=True, value=True) @@ -220,7 +216,6 @@ def onMakePathRelativeChanged(cls, checked): return enableFields = cls._canBeRelative and checked cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, enable=enableFields, text='') - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, enable=enableFields, text='') if enableFields: cls.updateFilePathPreviewFields(checked) @@ -261,7 +256,6 @@ def updateFilePathPreviewFields(cls, makePathRelative=None): elif unresolvedPath: relativePath = mayaUsdLib.Util.getPathRelativeToMayaSceneFile(unresolvedPath) cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, text=relativePath) - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, text=unresolvedPath) @classmethod def selectionChanged(cls, parentLayout, selection): From 7912e8c3aaf7691c39f58eac7fd4b282646ed913 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Tue, 4 Jul 2023 15:57:48 -0400 Subject: [PATCH 08/11] EMSUSD-243 split warning when there is no default prim. - First we print a status message that there is no default prim and that we wwill use the first valid prim. - Afterwards, if no valid root prim is found, we print a warning about why we could not find a valid root prim. --- .../ufe/UsdUndoAddRefOrPayloadCommand.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp index e6c626ba3a..8cd67afd14 100644 --- a/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp +++ b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp @@ -28,7 +28,7 @@ using namespace PXR_NS; static std::string validatePrimSpec(const UsdPrim& prim, const SdfPrimSpecHandle& primSpec) { if (!primSpec) - return "is not valid."; + return "is not valid"; // A common error is to reference a prim that is not the same type as the prim // that contains the reference. Since only the type of the prim that contains @@ -40,7 +40,7 @@ static std::string validatePrimSpec(const UsdPrim& prim, const SdfPrimSpecHandle const std::string& targetType = primSpec->GetTypeName(); if (primType != targetType) return TfStringPrintf( - "does not have the same type as the targeted prim: [%s] vs [%s].", + "does not have the same type as the targeted prim: [%s] vs [%s]", primType.c_str(), targetType.c_str()); @@ -75,15 +75,19 @@ getPrimPath(const UsdPrim& prim, const std::string& filePath, const std::string& SdfPrimSpecHandle primSpec = layerRef->GetPrimAtPath(SdfPath(primName.GetText())); const std::string errorMessage = validatePrimSpec(prim, primSpec); if (!errorMessage.empty()) - TF_WARN( - (std::string("The default prim in file [%s] ") + errorMessage).c_str(), - filePath.c_str()); + TF_WARN("The default prim in file [%s] %s.", errorMessage.c_str(), filePath.c_str()); return SdfPath(); } // If the referenced file has no default prim, return the path to the first // valid root prim we find. - std::string errorMessage = " is absent."; + + TF_STATUS( + "The file [%s] does not contain a default prim, the first valid root prim " + "will be used.", + filePath.c_str()); + + std::string errorMessage; for (const SdfPrimSpecHandle primSpec : layerRef->GetRootPrims()) { if (!primSpec) continue; @@ -93,11 +97,11 @@ getPrimPath(const UsdPrim& prim, const std::string& filePath, const std::string& return primSpec->GetPath(); } - TF_WARN( - (std::string("The file [%s] does not contain a default prim and the root prim ") - + errorMessage) - .c_str(), - filePath.c_str()); + if (errorMessage.empty()) { + TF_WARN("Could not find any valid root prim."); + } else { + TF_WARN("Could not find a valid root prim, the root prim %s.", errorMessage.c_str()); + } return SdfPath(); } From e3b0935ca87bec746c84092883418d8edb806503 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Tue, 4 Jul 2023 16:20:49 -0400 Subject: [PATCH 09/11] EMSUSD-243 fixing warning arguments order. --- lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp index 8cd67afd14..d5c85dd0ef 100644 --- a/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp +++ b/lib/usdUfe/ufe/UsdUndoAddRefOrPayloadCommand.cpp @@ -75,7 +75,7 @@ getPrimPath(const UsdPrim& prim, const std::string& filePath, const std::string& SdfPrimSpecHandle primSpec = layerRef->GetPrimAtPath(SdfPath(primName.GetText())); const std::string errorMessage = validatePrimSpec(prim, primSpec); if (!errorMessage.empty()) - TF_WARN("The default prim in file [%s] %s.", errorMessage.c_str(), filePath.c_str()); + TF_WARN("The default prim in file [%s] %s.", filePath.c_str(), errorMessage.c_str()); return SdfPath(); } From 5e06635ed3d81915f5ee5eb37baa25fdf49a033f Mon Sep 17 00:00:00 2001 From: Aram Azhari Date: Wed, 5 Jul 2023 11:36:34 -0400 Subject: [PATCH 10/11] Removed an unused variable --- plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py index 627aadab33..f5b3d72bed 100644 --- a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py +++ b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py @@ -36,7 +36,6 @@ class usdFileRelative(object): kMakePathRelativeCheckBox = 'MakePathRelativeTo' kUnresolvedPathTextField = 'UnresolvedPath' - kResolvedPathTextField = 'ResolvedPath' # We will store whether or not the file can be made relative. Used to know when we need # to update fields. From 232d9eec82fc17341e0dad608f1f469fe451d1f3 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:44:42 -0400 Subject: [PATCH 11/11] Updating changelog for v0.24.0 --- doc/CHANGELOG.md | 141 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 2 deletions(-) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index b707632d3f..c2b6cde4a3 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,5 +1,142 @@ # Changelog +## [v0.24.0] - 2023-07-07 + +**Build:** +* Add options to UsdExport in new test [#3158](https://github.com/Autodesk/maya-usd/pull/3158) +* Use new HdMaterialBindings Schema and API [#3152](https://github.com/Autodesk/maya-usd/pull/3152) +* Qt 6: + * Update Maya USD to use MacOS Frameworks for Qt 6 instead of using loose libraries [#3150](https://github.com/Autodesk/maya-usd/pull/3150) + * Adds support to compile against Qt 6.5 [#3116](https://github.com/Autodesk/maya-usd/pull/3116) +* Add test for animated cameras and lights [#3149](https://github.com/Autodesk/maya-usd/pull/3149) +* Eliminate spaces from doc filenames [#3139](https://github.com/Autodesk/maya-usd/pull/3139) +* Add UFE selection notification tests [#3132](https://github.com/Autodesk/maya-usd/pull/3132) +* Usd Versioning: + * Remove support for USD < v21.11 [#3128](https://github.com/Autodesk/maya-usd/pull/3128) + * Use new UsdPrimDefintionAPI with latest USD [#3098](https://github.com/Autodesk/maya-usd/pull/3098) + * Update FindUSD.cmake for USD version patch [#3064](https://github.com/Autodesk/maya-usd/pull/3064) + * USD 23.5 compatibility: Fix USD version check [#3055](https://github.com/Autodesk/maya-usd/pull/3055) + * testVP2RenderDelegateDrawModes fails with USD v23.02 [#3043](https://github.com/Autodesk/maya-usd/pull/3043) + * Update for USD v23.02 [#3025](https://github.com/Autodesk/maya-usd/pull/3025) +* Fix tests to write output in testing temp dir (not source tree) [#3127](https://github.com/Autodesk/maya-usd/pull/3127) +* Adhere to coding standard and use the fully qualified namespace name [#3126](https://github.com/Autodesk/maya-usd/pull/3126) [#2976](https://github.com/Autodesk/maya-usd/pull/2976) +* Add rotation unit test [#3112](https://github.com/Autodesk/maya-usd/pull/3112) +* Add missing ARCHIVE DESTINATION [#3100](https://github.com/Autodesk/maya-usd/pull/3100) +* Fix out-of-date UsdSkel assets [#3090](https://github.com/Autodesk/maya-usd/pull/3090) +* Update include paths for Hd files that have moved [#3089](https://github.com/Autodesk/maya-usd/pull/3089) +* Material api: hasMaterial UFE version check [#3066](https://github.com/Autodesk/maya-usd/pull/3066) +* UsdLight*.cpp: fix building with non-pxr namespace [#3032](https://github.com/Autodesk/maya-usd/pull/3032) +* Ufe 4.x: + * Update FindUFE.cmake for Ufe v4.2 [#3134](https://github.com/Autodesk/maya-usd/pull/3134) + * Remove/replace all UFE_PREVIEW_VERSION_NUM [#3020](https://github.com/Autodesk/maya-usd/pull/3020) + * Update UFE_PREVIEW_VERSION_NUM for Ufe 4.1 [#3019](https://github.com/Autodesk/maya-usd/pull/3019) + * Preparation for Ufe v4.1 [#2960](https://github.com/Autodesk/maya-usd/pull/2960) +* Fix UINodeGraphNode test [#3009](https://github.com/Autodesk/maya-usd/pull/3009) +* Update imaging baselines [#2982](https://github.com/Autodesk/maya-usd/pull/2982) +* Expose MaterialX feature in build.py [#2979](https://github.com/Autodesk/maya-usd/pull/2979) + +**Translation Framework:** +* Improve roundtripping of GeomSubsets [#3135](https://github.com/Autodesk/maya-usd/pull/3135) +* Fix export roots behaviour [#3131](https://github.com/Autodesk/maya-usd/pull/3131) +* Imported displayOpacity are not interpreted correctly [#3071](https://github.com/Autodesk/maya-usd/pull/3071) +* Add metersPerUnit scaling [#2954](https://github.com/Autodesk/maya-usd/pull/2954) +* Added applyEulerFilter to import [#2942](https://github.com/Autodesk/maya-usd/pull/2942) + +**Workflow:** +* Smart Signaling: + * Reintroduce legacy smart signaling in 2024 [#3177](https://github.com/Autodesk/maya-usd/pull/3177) + * Smart signaling must emit MNodeMessages [#3015](https://github.com/Autodesk/maya-usd/pull/3015) + * Add smart signaling for renderers [#2972](https://github.com/Autodesk/maya-usd/pull/2972) +* Merge as USD edits to be specified as overs when authoring to a stronger layer [#3173](https://github.com/Autodesk/maya-usd/pull/3173) +* UsdUfe - Move UFE to its own Project [#3161](https://github.com/Autodesk/maya-usd/pull/3161) [#3145](https://github.com/Autodesk/maya-usd/pull/3145) [#3109](https://github.com/Autodesk/maya-usd/pull/3109) +* Merge default values [#3159](https://github.com/Autodesk/maya-usd/pull/3159) +* Fix context menu when in a set [#3157](https://github.com/Autodesk/maya-usd/pull/3157) +* Missing discard edits [#3154](https://github.com/Autodesk/maya-usd/pull/3154) +* New feature: "Add payload" [#3151](https://github.com/Autodesk/maya-usd/pull/3151) +* Fix for prims not being added to empty USD Stage [#3144](https://github.com/Autodesk/maya-usd/pull/3144) +* Fix layer parenting of relative layers [#3141](https://github.com/Autodesk/maya-usd/pull/3141) +* Relative path error fix [#3137](https://github.com/Autodesk/maya-usd/pull/3137) +* Quick fix for conversion of rotations [#3124](https://github.com/Autodesk/maya-usd/pull/3124) +* Frame both USD and Maya data when edited as Maya [#3123](https://github.com/Autodesk/maya-usd/pull/3123) +* Fix geom instances being at the wrong place when using mayaHydra in the viewport [#3120](https://github.com/Autodesk/maya-usd/pull/3120) +* Save all my USD files as relative on the Bulk Save dialog [#3117](https://github.com/Autodesk/maya-usd/pull/3117) +* Import Chaser doesn't receive information on how to match USD prim to DAG paths [#3114](https://github.com/Autodesk/maya-usd/pull/3114) +* Fixing pivot command [#3110](https://github.com/Autodesk/maya-usd/pull/3110) +* Set my anonymous layers as relative in Bulk Save's 'Save As' dialog [#3104](https://github.com/Autodesk/maya-usd/pull/3104) +* Implement code wrapper handler [#3102](https://github.com/Autodesk/maya-usd/pull/3102) +* Fix a bug where `UsdUINodeGraphNode::hasPosOrSize()` returned the wrong value [#3099](https://github.com/Autodesk/maya-usd/pull/3099) +* Remove duplicate for Maya Ref [#3095](https://github.com/Autodesk/maya-usd/pull/3095) +* Remove error message on deleting a stage [#3093](https://github.com/Autodesk/maya-usd/pull/3093) +* Save and restore selected stage [#3092](https://github.com/Autodesk/maya-usd/pull/3092) +* Fixes broken prim creation caused by enum change [#3087](https://github.com/Autodesk/maya-usd/pull/3087) +* Relative USD root file to appear as relative before my scene file is saved [#3083](https://github.com/Autodesk/maya-usd/pull/3083) +* Fix batch saving of layers [#3080](https://github.com/Autodesk/maya-usd/pull/3080) +* Correctly duplicate prim [#3079](https://github.com/Autodesk/maya-usd/pull/3079) +* Allow editing prims directly under the stage [#3069](https://github.com/Autodesk/maya-usd/pull/3069) +* Lookdevx: attribute enum support [#3068](https://github.com/Autodesk/maya-usd/pull/3068) +* Improve the behavior of duplication vs payload [#3065](https://github.com/Autodesk/maya-usd/pull/3065) +* Refactor material commands [#3056](https://github.com/Autodesk/maya-usd/pull/3056) +* Correct layer order in batch save dialog [#3049](https://github.com/Autodesk/maya-usd/pull/3049) +* Add command to create stages [#3045](https://github.com/Autodesk/maya-usd/pull/3045) +* Material api: hasMaterial implementation [#3042](https://github.com/Autodesk/maya-usd/pull/3042) +* Added save/restore to preserve object selection after Undoing Remove SubLayer [#3037](https://github.com/Autodesk/maya-usd/pull/3037) +* Fix crash when deleting a stage [#3031](https://github.com/Autodesk/maya-usd/pull/3031) +* Update proxy shape scene index to support interpret pick result [#3028](https://github.com/Autodesk/maya-usd/pull/3028) +* Updating tooltip to fix title on composition arcs [#3024](https://github.com/Autodesk/maya-usd/pull/3024) +* Load my USD root file as relative before I save my scene file [#3022](https://github.com/Autodesk/maya-usd/pull/3022) +* Make stage set by ID reloadable [#3010](https://github.com/Autodesk/maya-usd/pull/3010) +* Improvements for surface shader querying and handling [#3008](https://github.com/Autodesk/maya-usd/pull/3008) +* Fix error on save [#3004](https://github.com/Autodesk/maya-usd/pull/3004) +* Drag and drop a sublayer that has a relative path [#3002](https://github.com/Autodesk/maya-usd/pull/3002) +* Edit routing of composite commands [#2997](https://github.com/Autodesk/maya-usd/pull/2997) +* Recognize string properties with IsAssetIdentifier as being filename [#2994](https://github.com/Autodesk/maya-usd/pull/2994) +* Updated sub layer dialog to display the correct relative path when enabled [#2990](https://github.com/Autodesk/maya-usd/pull/2990) +* Improve preventing edits [#2986](https://github.com/Autodesk/maya-usd/pull/2986) +* Restrict namespace edits to current stage [#2977](https://github.com/Autodesk/maya-usd/pull/2977) +* Check skin cluster weights [#2971](https://github.com/Autodesk/maya-usd/pull/2971) +* Added size functions in UINodeGraphNode [#2967](https://github.com/Autodesk/maya-usd/pull/2967) +* Pulled Maya object to inherit visibility [#2964](https://github.com/Autodesk/maya-usd/pull/2964) +* Assign to component tags [#2963](https://github.com/Autodesk/maya-usd/pull/2963) +* Return nullptr from transform command instead of throwing [#2959](https://github.com/Autodesk/maya-usd/pull/2959) +* Allow material-related functions only for specific node types [#2958](https://github.com/Autodesk/maya-usd/pull/2958) +* Fix edit-target loops in proxy shape compute [#2955](https://github.com/Autodesk/maya-usd/pull/2955) +* Add edit routing for attributes [#2951](https://github.com/Autodesk/maya-usd/pull/2951) +* Fixing multiple colour sets export from Maya to USD [#2927](https://github.com/Autodesk/maya-usd/pull/2927) + +**Render:** +* Use experimental OCIO hooks for MaterialX shading [#3171](https://github.com/Autodesk/maya-usd/pull/3171) +* Implement experimental OCIO support [#3153](https://github.com/Autodesk/maya-usd/pull/3153) +* Show|Selection Highlighting in the Viewport doesn't work with USD Proxyshape [#3142](https://github.com/Autodesk/maya-usd/pull/3142) +* Prevent primInfo errors [#3085](https://github.com/Autodesk/maya-usd/pull/3085) +* Maya crashes if USD instanceable is used together with varying visibility [#3059](https://github.com/Autodesk/maya-usd/pull/3059) +* Use Hd_VertexAdjacency API directly [#3046](https://github.com/Autodesk/maya-usd/pull/3046) +* Fix broken UDIMs in VP2 and add unit test [#3044](https://github.com/Autodesk/maya-usd/pull/3044) +* Legacy MtoH: + * Separate mtoh .mod file [#3038](https://github.com/Autodesk/maya-usd/pull/3038) + * Turned off legacy mtoh build [#2989](https://github.com/Autodesk/maya-usd/pull/2989) +* Single channel should show as black and white in viewport [#2952](https://github.com/Autodesk/maya-usd/pull/2952) +* Add getter/setter for enableMaterials in HdMayaSceneDelegate [#2938](https://github.com/Autodesk/maya-usd/pull/2938) + +**Documentation:** +* Add documentation for import chaser [#3160](https://github.com/Autodesk/maya-usd/pull/3160) +* Update Readme.md to include Arbitrary Attributes to export options [#3118](https://github.com/Autodesk/maya-usd/pull/3118) +* Update EditRouting.md to add example [#3103](https://github.com/Autodesk/maya-usd/pull/3103) +* Docs on turning off edit routing [#3014](https://github.com/Autodesk/maya-usd/pull/3014) +* Updating docs with Maya 2024 [#2998](https://github.com/Autodesk/maya-usd/pull/2998) + +**Miscellaneous:** +* Fixing saving the pinned stage [#3130](https://github.com/Autodesk/maya-usd/pull/3130) +* Mark USD and MayaUSD Python bindings as safe [#3119](https://github.com/Autodesk/maya-usd/pull/3119) +* Clearer layer file names [#3073](https://github.com/Autodesk/maya-usd/pull/3073) +* Fix shiboken crash [#3057](https://github.com/Autodesk/maya-usd/pull/3057) +* Pin stage in Layer Editor [#3052](https://github.com/Autodesk/maya-usd/pull/3052) +* Fixes a stage leak from USD caches [#3035](https://github.com/Autodesk/maya-usd/pull/3035) +* Fix Attribute Editor refresh [#3034](https://github.com/Autodesk/maya-usd/pull/3034) +* Prevent right click-material assignment for physics-related nodes [#3026](https://github.com/Autodesk/maya-usd/pull/3026) +* Fix MEL warning in layer load dialog [#3011](https://github.com/Autodesk/maya-usd/pull/3011) +* Remove explicit call to sceneIndex::Populate [#2983](https://github.com/Autodesk/maya-usd/pull/2983) +* Undoing rename of prim causes prim's icon to change to def [#2965](https://github.com/Autodesk/maya-usd/pull/2965) + ## [v0.23.0] - 2023-03-29 **Build:** @@ -1399,7 +1536,7 @@ This release includes support for Python 3 (requires USD 20.05). The goal of thi * Added coding guidelines for maya-usd repository [PR #380](https://github.com/Autodesk/maya-usd/pull/380) [PR #400](https://github.com/Autodesk/maya-usd/pull/400) ## [0.1.0] - 2020-03-15 -This release adds *all* changes made to refactoring_sandbox branch, including BaseProxyShape, Maya’s Attribute Editor and Outliner support via Ufe-USD runtime plugin, VP2RenderDelegate and Maya To Hydra. Added Autodesk plugin with Import/Export workflows and initial support for stage creation. +This release adds *all* changes made to refactoring_sandbox branch, including BaseProxyShape, Maya's Attribute Editor and Outliner support via Ufe-USD runtime plugin, VP2RenderDelegate and Maya To Hydra. Added Autodesk plugin with Import/Export workflows and initial support for stage creation. Made several build improvements, including fixing regression tests execution on all supported platforms. @@ -1436,7 +1573,7 @@ Made several build improvements, including fixing regression tests execution on * Clear frameSamples set [#326](https://github.com/Autodesk/maya-usd/pull/326) * Added export UI [PR #216](https://github.com/Autodesk/maya-usd/pull/216) * Enabled import of .usdz files [PR #313](https://github.com/Autodesk/maya-usd/pull/313) -* Added “Create USD Stage” to enable proxy shape creation from Maya’s UI [PR #306](https://github.com/Autodesk/maya-usd/pull/306) [PR #317](https://github.com/Autodesk/maya-usd/pull/317) +* Added "Create USD Stage" to enable proxy shape creation from Maya's UI [PR #306](https://github.com/Autodesk/maya-usd/pull/306) [PR #317](https://github.com/Autodesk/maya-usd/pull/317) *Animal Logic plugin* * Disabled push to prim to avoid generation of overs while updating the data [PR #295](https://github.com/Autodesk/maya-usd/pull/295)