From 1b9bc00379fa1560e6c4a2cf13156ec533358689 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 26 May 2023 15:00:50 -0400 Subject: [PATCH 1/3] MAYA-129258 - MayaUsd: remove support for USD < v21.11 * cmake changes to remove old USD versions --- CMakeLists.txt | 2 +- cmake/compiler_config.cmake | 17 ++------ cmake/modules/FindUSD.cmake | 39 +++++-------------- doc/build.md | 8 ++-- lib/mayaUsd/resources/icons/CMakeLists.txt | 20 +--------- lib/mayaUsd/ufe/CMakeLists.txt | 15 +------ lib/usd/translators/CMakeLists.txt | 9 +---- lib/usd/translators/shading/CMakeLists.txt | 7 +--- lib/usdUfe/ufe/CMakeLists.txt | 15 +------ test/lib/mayaUsd/fileio/CMakeLists.txt | 2 +- .../render/vp2RenderDelegate/CMakeLists.txt | 14 +------ test/lib/usd/plugin/CMakeLists.txt | 13 +------ test/lib/usd/translators/CMakeLists.txt | 24 ++++++------ 13 files changed, 41 insertions(+), 144 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70484cf72e..5372f31271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,7 @@ message(STATUS " Python_EXECUTABLE = ${Python_EXECUTABLE}") include(cmake/jinja.cmake) -find_package(USD 0.20.05 REQUIRED) +find_package(USD 0.21.11 REQUIRED) if (CMAKE_WANT_MATERIALX_BUILD) # Requires at least USD 21.08 for hdMtlx module and USD must have been built with MaterialX: if(NOT TARGET hdMtlx) diff --git a/cmake/compiler_config.cmake b/cmake/compiler_config.cmake index 36a698a095..c04436d53e 100644 --- a/cmake/compiler_config.cmake +++ b/cmake/compiler_config.cmake @@ -85,19 +85,10 @@ set(CMAKE_CXX_EXTENSIONS OFF) function(mayaUsd_compile_config TARGET) # required compiler feature - # Require C++14 if we're either building for Maya 2019 or later, or if we're building against - # USD 20.05 or later. Otherwise require C++11. - if ((MAYA_APP_VERSION VERSION_GREATER_EQUAL 2019) OR (PXR_VERSION VERSION_GREATER_EQUAL 2005)) - target_compile_features(${TARGET} - PRIVATE - cxx_std_14 - ) - else() - target_compile_features(${TARGET} - PRIVATE - cxx_std_11 - ) - endif() + target_compile_features(${TARGET} + PRIVATE + cxx_std_14 + ) if(IS_GNU OR IS_CLANG) target_compile_options(${TARGET} PRIVATE diff --git a/cmake/modules/FindUSD.cmake b/cmake/modules/FindUSD.cmake index 2335275a29..33281f9caa 100644 --- a/cmake/modules/FindUSD.cmake +++ b/cmake/modules/FindUSD.cmake @@ -47,24 +47,14 @@ get_filename_component(PXR_USD_LOCATION "${USD_CONFIG_FILE}" DIRECTORY) include(${USD_CONFIG_FILE}) -if(DEFINED PXR_VERSION) - # Starting in core USD 21.05, pxrConfig.cmake provides the various USD - # version numbers as CMake variables, in which case PXR_VERSION should have - # been defined, along with the major, minor, and patch version numbers, so - # there is no need to extract them from the pxr/pxr.h header file anymore. - # The only thing we need to do is assemble the USD_VERSION version string. - set(USD_VERSION ${PXR_MAJOR_VERSION}.${PXR_MINOR_VERSION}.${PXR_PATCH_VERSION}) -elseif(USD_INCLUDE_DIR AND EXISTS "${USD_INCLUDE_DIR}/pxr/pxr.h") - foreach(_usd_comp MAJOR MINOR PATCH) - file(STRINGS - "${USD_INCLUDE_DIR}/pxr/pxr.h" - _usd_tmp - REGEX "#define PXR_${_usd_comp}_VERSION .*$") - string(REGEX MATCHALL "[0-9]+" USD_${_usd_comp}_VERSION ${_usd_tmp}) - endforeach() - set(USD_VERSION ${USD_MAJOR_VERSION}.${USD_MINOR_VERSION}.${USD_PATCH_VERSION}) - math(EXPR PXR_VERSION "${USD_MAJOR_VERSION} * 10000 + ${USD_MINOR_VERSION} * 100 + ${USD_PATCH_VERSION}") +if(NOT DEFINED PXR_VERSION) + message(FATAL_ERROR "Expected PXR_VERSION defined in pxrConfig.cmake") endif() +# Starting in core USD 21.05, pxrConfig.cmake provides the various USD +# version numbers as CMake variables, in which case PXR_VERSION should have +# been defined, along with the major, minor, and patch version numbers. +# The only thing we need to do is assemble the USD_VERSION version string. +set(USD_VERSION ${PXR_MAJOR_VERSION}.${PXR_MINOR_VERSION}.${PXR_PATCH_VERSION}) # Set special Autodesk USD version. We use this to communicate whether or not # there are extra patches on-top of the normal USD build. @@ -81,22 +71,13 @@ if (USD_VERSION VERSION_LESS "0.23.02") endif() endif() -# Note that on Windows with USD <= 0.19.11, USD_LIB_PREFIX should be left at -# default (or set to empty string), even if PXR_LIB_PREFIX was specified when -# building core USD, due to a bug. - -# On all other platforms / versions, it should match the PXR_LIB_PREFIX used +# USD_LIB_PREFIX should match the PXR_LIB_PREFIX used # for building USD (and shouldn't need to be touched if PXR_LIB_PREFIX was not # used / left at it's default value). Starting with USD 21.11, the default # value for PXR_LIB_PREFIX was changed to include "usd_". -if (USD_VERSION VERSION_GREATER_EQUAL "0.21.11") - set(USD_LIB_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}usd_" - CACHE STRING "Prefix of USD libraries; generally matches the PXR_LIB_PREFIX used when building core USD") -else() - set(USD_LIB_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX} - CACHE STRING "Prefix of USD libraries; generally matches the PXR_LIB_PREFIX used when building core USD") -endif() +set(USD_LIB_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}usd_" + CACHE STRING "Prefix of USD libraries; generally matches the PXR_LIB_PREFIX used when building core USD") if (WIN32) # ".lib" on Windows diff --git a/doc/build.md b/doc/build.md index 9b600e23a3..4d21289c9f 100644 --- a/doc/build.md +++ b/doc/build.md @@ -27,11 +27,11 @@ Before building the project, consult the following table to ensure you use the r #### 2. Download and Build Pixar USD -See Pixar's official github page for instructions on how to build USD: https://github.com/PixarAnimationStudios/USD . Pixar has recently removed support for building Maya USD libraries/plug-ins in their github repository and ```build_usd.py```. When building the maya-usd project, it is important the recommended ```Pixar USD``` commitID or tag from the table below are used: +See Pixar's official github page for instructions on how to build USD: https://github.com/PixarAnimationStudios/USD . Pixar has removed support for building Maya USD libraries/plug-ins in their github repository and ```build_usd.py```. When building the maya-usd project, it is important the recommended ```Pixar USD``` commitID or tag from the table below are used: -| | ![](images/pxr.png) | -|:------------: |:---------------: | -| CommitID/Tags | release: [v21.02](https://github.com/PixarAnimationStudios/USD/releases/tag/v21.02) or [v21.05](https://github.com/PixarAnimationStudios/USD/releases/tag/v21.05) or [v21.08](https://github.com/PixarAnimationStudios/USD/releases/tag/v21.08) or [v21.11](https://github.com/PixarAnimationStudios/USD/releases/tag/v21.11) or [v22.05b](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.05b) or [v22.08](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.08) or [v22.11](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.11)
dev: [97d2ba3 (tag v23.02)](https://github.com/PixarAnimationStudios/USD/commit/97d2ba37cc8749b147694d0dd5f9e7127e1b6919) | +| | ![](images/pxr.png) | USD version used in Maya | +|:------------: |:---------------: |:------------------------:| +| CommitID/Tags | release: [v21.11](https://github.com/PixarAnimationStudios/USD/releases/tag/v21.11) or [v22.05b](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.05b) or [v22.08](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.08) or [v22.11](https://github.com/PixarAnimationStudios/USD/releases/tag/v22.11)
dev: [97d2ba3 (tag v23.02)](https://github.com/PixarAnimationStudios/USD/commit/97d2ba37cc8749b147694d0dd5f9e7127e1b6919) | Maya 2022 = v21.11
Maya 2023 = v21.11
Maya 2024 = v22.11 | For additional information on building Pixar USD, see the ***Additional Build Instruction*** section below. diff --git a/lib/mayaUsd/resources/icons/CMakeLists.txt b/lib/mayaUsd/resources/icons/CMakeLists.txt index 5b2b084f4c..aed6854030 100644 --- a/lib/mayaUsd/resources/icons/CMakeLists.txt +++ b/lib/mayaUsd/resources/icons/CMakeLists.txt @@ -29,29 +29,13 @@ if (CMAKE_UFE_V2_FEATURES_AVAILABLE) Sphere UsdGeomCurves UsdGeomXformable + UsdLuxBoundableLightBase + UsdLuxNonboundableLightBase UsdTyped Volume Material Shader ) - if (PXR_VERSION GREATER_EQUAL 2111) - list(APPEND OUTLINER_ICONS - UsdLuxBoundableLightBase - UsdLuxNonboundableLightBase - ) - else() - # In 21.11 UsdLuxLight was removed and replaced with UsdLuxBoundableLightBase. - # So for the older versions we install the icon with the old name instead. - install(FILES "out_USD_UsdLuxBoundableLightBase_100.png" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/icons" - RENAME "out_USD_UsdLuxLight.png") - install(FILES "out_USD_UsdLuxBoundableLightBase_150.png" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/icons" - RENAME "out_USD_UsdLuxLight_150.png") - install(FILES "out_USD_UsdLuxBoundableLightBase_200.png" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/icons" - RENAME "out_USD_UsdLuxLight_200.png") - endif() foreach(ICON_BASE ${OUTLINER_ICONS}) # The _100.png files need to be installed without the _100. This is the # base icon name that is used. Maya will automatically choose the _150/_200 diff --git a/lib/mayaUsd/ufe/CMakeLists.txt b/lib/mayaUsd/ufe/CMakeLists.txt index 6f66b5c409..f35637df52 100644 --- a/lib/mayaUsd/ufe/CMakeLists.txt +++ b/lib/mayaUsd/ufe/CMakeLists.txt @@ -56,6 +56,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdTransform3dUndoableCommands.cpp UsdUIInfoHandler.cpp UsdUIUfeObserver.cpp + UsdUndoMaterialCommands.cpp UsdUndoVisibleCommand.cpp XformOpUtils.cpp ) @@ -161,13 +162,6 @@ if(CMAKE_UFE_V4_FEATURES_AVAILABLE) ) endif() -if(PXR_VERSION GREATER_EQUAL 2108 AND CMAKE_UFE_V2_FEATURES_AVAILABLE) - target_sources(${PROJECT_NAME} - PRIVATE - UsdUndoMaterialCommands.cpp - ) -endif() - set(HEADERS Global.h ProxyShapeHandler.h @@ -222,6 +216,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdTransform3dUndoableCommands.h UsdUIInfoHandler.h UsdUIUfeObserver.h + UsdUndoMaterialCommands.h UsdUndoVisibleCommand.h XformOpUtils.h ) @@ -287,12 +282,6 @@ if(CMAKE_UFE_V4_FEATURES_AVAILABLE) ) endif() -if(PXR_VERSION GREATER_EQUAL 2108 AND CMAKE_UFE_V2_FEATURES_AVAILABLE) - list(APPEND HEADERS - UsdUndoMaterialCommands.h - ) -endif() - # ----------------------------------------------------------------------------- # promote headers # ----------------------------------------------------------------------------- diff --git a/lib/usd/translators/CMakeLists.txt b/lib/usd/translators/CMakeLists.txt index 4b9a6d7896..95a0824c77 100644 --- a/lib/usd/translators/CMakeLists.txt +++ b/lib/usd/translators/CMakeLists.txt @@ -22,6 +22,7 @@ target_sources(${TARGET_NAME} lightReader.cpp lightRfMReader.cpp lightRfMWriter.cpp + lightRfMWriter_PxrMeshLight.cpp lightWriter.cpp locatorWriter.cpp materialReader.cpp @@ -49,14 +50,6 @@ if(CMAKE_UFE_V3_FEATURES_AVAILABLE) ) endif() -# MeshLightAPI Schema export requires USD 21.11 -if(PXR_VERSION GREATER_EQUAL 2111) - target_sources(${TARGET_NAME} - PRIVATE - lightRfMWriter_PxrMeshLight.cpp - ) -endif() - add_subdirectory(shading) # ----------------------------------------------------------------------------- diff --git a/lib/usd/translators/shading/CMakeLists.txt b/lib/usd/translators/shading/CMakeLists.txt index d19ffa1409..97b723a4b4 100644 --- a/lib/usd/translators/shading/CMakeLists.txt +++ b/lib/usd/translators/shading/CMakeLists.txt @@ -43,12 +43,7 @@ if(CMAKE_UFE_V3_FEATURES_AVAILABLE) ) endif() -# These import/export classes will work with older versions of Maya and USD if -# you plan to render in usdView or other MaterialX-aware renderers. However, -# getting these materials to appear in the Maya viewport when creating a USD -# stage will definitely require a recent Maya preview release combined with -# a bleeding edge USD with version > 21.05 -if (MAYA_APP_VERSION VERSION_GREATER 2022 AND PXR_VERSION VERSION_GREATER 2102) +if (MAYA_APP_VERSION VERSION_GREATER 2022) target_sources(${TARGET_NAME} PRIVATE mtlxBaseReader.cpp diff --git a/lib/usdUfe/ufe/CMakeLists.txt b/lib/usdUfe/ufe/CMakeLists.txt index e3f3450bbf..7854a5a3f6 100644 --- a/lib/usdUfe/ufe/CMakeLists.txt +++ b/lib/usdUfe/ufe/CMakeLists.txt @@ -66,6 +66,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdUndoInsertChildCommand.cpp UsdUndoReorderCommand.cpp UsdUndoSetKindCommand.cpp + #UsdUndoMaterialCommands.cpp #UsdUndoVisibleCommand.cpp #XformOpUtils.cpp ) @@ -199,13 +200,6 @@ endif() # endif() #endif() -#if(PXR_VERSION GREATER_EQUAL 2108 AND CMAKE_UFE_V2_FEATURES_AVAILABLE) -# target_sources(${PROJECT_NAME} -# PRIVATE -# #UsdUndoMaterialCommands.cpp -# ) -#endif() - set(HEADERS Global.h #ProxyShapeHandler.h @@ -271,6 +265,7 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) UsdUndoInsertChildCommand.h UsdUndoReorderCommand.h UsdUndoSetKindCommand.h + #UsdUndoMaterialCommands.h #UsdUndoVisibleCommand.h #XformOpUtils.h ) @@ -371,12 +366,6 @@ endif() # endif() #endif() -#if(PXR_VERSION GREATER_EQUAL 2108 AND CMAKE_UFE_V2_FEATURES_AVAILABLE) -# list(APPEND HEADERS -# #UsdUndoMaterialCommands.h -# ) -#endif() - # ----------------------------------------------------------------------------- # promote headers # ----------------------------------------------------------------------------- diff --git a/test/lib/mayaUsd/fileio/CMakeLists.txt b/test/lib/mayaUsd/fileio/CMakeLists.txt index 49c99309dc..b63603e9ad 100644 --- a/test/lib/mayaUsd/fileio/CMakeLists.txt +++ b/test/lib/mayaUsd/fileio/CMakeLists.txt @@ -35,7 +35,7 @@ if(UFE_TRIE_NODE_HAS_CHILDREN_COMPONENTS_ACCESSOR) endif() # requires MaterialX support -if (MAYA_APP_VERSION VERSION_GREATER 2022 AND PXR_VERSION VERSION_GREATER 2102) +if (MAYA_APP_VERSION VERSION_GREATER 2022) list(APPEND TEST_SCRIPT_FILES testShaderReader.py testShaderWriter.py diff --git a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt index 0dbcdc64e4..a37d7ab110 100644 --- a/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt +++ b/test/lib/mayaUsd/render/vp2RenderDelegate/CMakeLists.txt @@ -12,13 +12,6 @@ if(CMAKE_UFE_V2_FEATURES_AVAILABLE) list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegateDuplicateProxy.py testVP2RenderDelegateInteractiveWorkflows.py - ) -endif() - -if (CMAKE_UFE_V2_FEATURES_AVAILABLE AND PXR_VERSION GREATER_EQUAL 2008) - # The point instance selection tests requires UsdImaging API version 14 or - # later, which is only provided by core USD 20.08 or later. - list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegatePointInstanceSelection.py testVP2RenderDelegatePointInstancesPickMode.py testVP2RenderDelegatePrimPath.py @@ -31,14 +24,9 @@ if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) list(APPEND TEST_SCRIPT_FILES testVP2RenderDelegatePerInstanceInheritedData.py testVP2RenderDelegateBasisCurves.py + testVP2RenderDelegateDrawModes.py testVP2RenderDelegatePoints.py ) - - if (PXR_VERSION GREATER_EQUAL 2105) - list(APPEND TEST_SCRIPT_FILES - testVP2RenderDelegateDrawModes.py - ) - endif() endif() if (MAYA_APP_VERSION VERSION_GREATER_EQUAL 2022) diff --git a/test/lib/usd/plugin/CMakeLists.txt b/test/lib/usd/plugin/CMakeLists.txt index afa34c29fd..0a87b18560 100644 --- a/test/lib/usd/plugin/CMakeLists.txt +++ b/test/lib/usd/plugin/CMakeLists.txt @@ -212,16 +212,10 @@ add_library(${TARGET_NAME} SHARED) # ----------------------------------------------------------------------------- target_sources(${TARGET_NAME} PRIVATE + bulletAdaptor.cpp plugin.cpp nullApiExporter.cpp ) -# Requires physics API introduced in 2108 -if (PXR_VERSION VERSION_GREATER 2105) -target_sources(${TARGET_NAME} - PRIVATE - bulletAdaptor.cpp -) -endif() mayaUsd_compile_config(${TARGET_NAME}) # ----------------------------------------------------------------------------- @@ -238,13 +232,8 @@ target_compile_definitions(${TARGET_NAME} target_link_libraries(${TARGET_NAME} PRIVATE mayaUsd -) -if (PXR_VERSION VERSION_GREATER 2105) -target_link_libraries(${TARGET_NAME} - PRIVATE usdPhysics ) -endif() # ----------------------------------------------------------------------------- # run-time search paths diff --git a/test/lib/usd/translators/CMakeLists.txt b/test/lib/usd/translators/CMakeLists.txt index d85cea25ac..91f1391cb1 100644 --- a/test/lib/usd/translators/CMakeLists.txt +++ b/test/lib/usd/translators/CMakeLists.txt @@ -238,7 +238,7 @@ endif() # 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 # require a recent Maya preview release combined with a bleeding edge USD -if (MAYA_APP_VERSION VERSION_GREATER 2022 AND PXR_VERSION VERSION_GREATER 2102) +if (MAYA_APP_VERSION VERSION_GREATER 2022) set(MTLX_TEST_SCRIPT_FILES testUsdExportMaterialX.py testUsdImportMaterialX.py @@ -274,18 +274,16 @@ mayaUsd_add_test(testUsdMayaListShadingModesCommand set_property(TEST testUsdMayaListShadingModesCommand APPEND PROPERTY LABELS translators) # Requires Physics API to test some exporters: -if (PXR_VERSION VERSION_GREATER 2105) - # Once of the tests in this file requires UsdMaya (from the Pixar plugin). That test - # will be skipped if not found (probably because BUILD_PXR_PLUGIN is off). - mayaUsd_add_test(testUsdExportSchemaApi - PYTHON_MODULE testUsdExportSchemaApi - 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/nullApiExporter" - ) - set_property(TEST testUsdExportSchemaApi APPEND PROPERTY LABELS translators) -endif() +# One of the tests in this file requires UsdMaya (from the Pixar plugin). That test +# will be skipped if not found (probably because BUILD_PXR_PLUGIN is off). +mayaUsd_add_test(testUsdExportSchemaApi + PYTHON_MODULE testUsdExportSchemaApi + 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/nullApiExporter" +) +set_property(TEST testUsdExportSchemaApi APPEND PROPERTY LABELS translators) mayaUsd_add_test(testUsdImportExportSiteSpecificConfig PYTHON_MODULE testUsdImportExportSiteSpecificConfig From e9b67d6967ccc73e84526beadf6f6bdae2a68f5c Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 26 May 2023 15:06:47 -0400 Subject: [PATCH 2/3] MAYA-129258 - MayaUsd: remove support for USD < v21.11 * Code changes to remove USD versions < 21.11 --- lib/mayaUsd/fileio/jobs/readJob.cpp | 13 +- .../fileio/translators/translatorLight.cpp | 46 +------ .../fileio/translators/translatorLight.h | 12 +- .../fileio/translators/translatorRfMLight.cpp | 69 +--------- .../translatorRfMLight_deprecated.cpp | 121 +----------------- .../render/mayaToHydra/renderGlobals.cpp | 23 ---- .../render/mayaToHydra/renderGlobals.h | 3 - .../render/mayaToHydra/renderOverride.cpp | 7 - .../render/mayaToHydra/renderOverride.h | 5 - lib/mayaUsd/render/mayaToHydra/utils.cpp | 15 +-- lib/mayaUsd/render/px_vp20/glslProgram.cpp | 6 - lib/mayaUsd/render/px_vp20/utils.cpp | 6 - .../render/pxrUsdMayaGL/batchRenderer.cpp | 9 -- .../render/vp2RenderDelegate/material.cpp | 5 - .../render/vp2RenderDelegate/material.h | 4 - .../vp2RenderDelegate/mayaPrimCommon.cpp | 14 +- .../vp2RenderDelegate/meshViewportCompute.cpp | 9 +- .../vp2RenderDelegate/meshViewportCompute.h | 6 - .../vp2RenderDelegate/proxyRenderDelegate.cpp | 5 - .../vp2RenderDelegate/proxyRenderDelegate.h | 13 -- .../vp2RenderDelegate/render_delegate.cpp | 20 --- .../vp2RenderDelegate/render_delegate.h | 4 - lib/mayaUsd/ufe/UsdLight.cpp | 26 ++-- lib/mayaUsd/ufe/UsdLightHandler.cpp | 16 +-- lib/mayaUsd/ufe/XformOpUtils.cpp | 9 -- .../hdMaya/adapters/aiSkydomeLightAdapter.cpp | 14 -- lib/usd/hdMaya/adapters/cameraAdapter.cpp | 115 ----------------- lib/usd/hdMaya/adapters/materialAdapter.cpp | 64 --------- lib/usd/hdMaya/adapters/materialAdapter.h | 9 -- .../hdMaya/delegates/delegateDebugCodes.cpp | 13 -- lib/usd/hdMaya/delegates/delegateDebugCodes.h | 12 -- lib/usd/hdMaya/delegates/sceneDelegate.cpp | 62 --------- lib/usd/hdMaya/delegates/sceneDelegate.h | 8 -- lib/usd/hdMaya/utils.cpp | 109 ---------------- lib/usd/hdMaya/utils.h | 32 ----- lib/usd/translators/lightRfMWriter.cpp | 7 - lib/usd/translators/lightWriter.cpp | 20 --- lib/usdUfe/ufe/UsdSceneItem.cpp | 9 -- .../AL_USDMaya/AL/usdmaya/PluginRegister.h | 10 +- .../AL_USDMaya/AL/usdmaya/fileio/Import.cpp | 13 +- .../AL/usdmaya/fileio/TransformIterator.cpp | 11 +- .../fileio/export_import_instancing.cpp | 4 - 42 files changed, 34 insertions(+), 944 deletions(-) diff --git a/lib/mayaUsd/fileio/jobs/readJob.cpp b/lib/mayaUsd/fileio/jobs/readJob.cpp index 05510ecb8b..1577115b71 100644 --- a/lib/mayaUsd/fileio/jobs/readJob.cpp +++ b/lib/mayaUsd/fileio/jobs/readJob.cpp @@ -540,12 +540,7 @@ void UsdMaya_ReadJob::_DoImportInstanceIt( if (!primIt.IsPostVisit()) { return; } - const UsdPrim prototype = -#if PXR_VERSION < 2011 - prim.GetMaster(); -#else - prim.GetPrototype(); -#endif + const UsdPrim prototype = prim.GetPrototype(); if (!prototype) { return; } @@ -650,11 +645,7 @@ bool UsdMaya_ReadJob::_DoImport(UsdPrimRange& rootRange, const UsdPrim& usdRootP UsdMayaPrimReaderContext readCtx(&mNewNodeRegistry); readCtx.SetTimeSampleMultiplier(mTimeSampleMultiplier); -#if PXR_VERSION < 2011 - auto prototypes = usdRootPrim.GetStage()->GetMasters(); -#else - auto prototypes = usdRootPrim.GetStage()->GetPrototypes(); -#endif + auto prototypes = usdRootPrim.GetStage()->GetPrototypes(); const int loopSize = prototypes.size(); MayaUsd::ProgressBarLoopScope prototypesLoop(loopSize); for (const auto& prototype : prototypes) { diff --git a/lib/mayaUsd/fileio/translators/translatorLight.cpp b/lib/mayaUsd/fileio/translators/translatorLight.cpp index fb5de2a76e..0a9c7b2f43 100644 --- a/lib/mayaUsd/fileio/translators/translatorLight.cpp +++ b/lib/mayaUsd/fileio/translators/translatorLight.cpp @@ -36,11 +36,7 @@ #include #include #include -#if PXR_VERSION < 2111 -#include -#else #include -#endif #include #include #include @@ -85,12 +81,8 @@ TF_DEFINE_PRIVATE_TOKENS( // Export the "common" light attributes from MFnLights to UsdLuxLightAPI bool UsdMayaTranslatorLight::WriteLightAttrs( - const UsdTimeCode& usdTime, -#if PXR_VERSION < 2111 - const UsdLuxLight& usdLight, -#else - const UsdLuxLightAPI& usdLight, -#endif + const UsdTimeCode& usdTime, + const UsdLuxLightAPI& usdLight, MFnLight& mayaLight, UsdUtilsSparseValueWriter* valueWriter) { @@ -148,11 +140,7 @@ bool UsdMayaTranslatorLight::WriteLightAttrs( // accessors, as we need to support animations. Instead we're getting // the Maya plugs from MFnDependencyNode static bool _ReadLightAttrs( -#if PXR_VERSION < 2111 - const UsdLuxLight& lightSchema, -#else - const UsdLuxLightAPI& lightSchema, -#endif + const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn, const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext& context) @@ -229,11 +217,7 @@ bool UsdMayaTranslatorLight::WriteDirectionalLightAttrs( // Import the specialized MFnDirectionalLight attributes static bool _ReadDirectionalLight( -#if PXR_VERSION < 2111 - const UsdLuxLight& lightSchema, -#else - const UsdLuxLightAPI& lightSchema, -#endif + const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn, const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext& context) @@ -274,11 +258,7 @@ bool UsdMayaTranslatorLight::WritePointLightAttrs( // Import the specialized MFnPointLight attributes static bool _ReadPointLight( -#if PXR_VERSION < 2111 - const UsdLuxLight& lightSchema, -#else - const UsdLuxLightAPI& lightSchema, -#endif + const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn, const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext& context) @@ -346,11 +326,7 @@ bool UsdMayaTranslatorLight::WriteSpotLightAttrs( // Import the specialized MFnSpotLight attributes static bool _ReadSpotLight( -#if PXR_VERSION < 2111 - const UsdLuxLight& lightSchema, -#else - const UsdLuxLightAPI& lightSchema, -#endif + const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn, const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext& context) @@ -429,11 +405,7 @@ bool UsdMayaTranslatorLight::WriteAreaLightAttrs( /// Read the parameters from UsdLuxRectLight into a Maya area light static bool _ReadAreaLight( -#if PXR_VERSION < 2111 - const UsdLuxLight& lightSchema, -#else - const UsdLuxLightAPI& lightSchema, -#endif + const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn, const UsdMayaPrimReaderArgs& args, UsdMayaPrimReaderContext& context) @@ -462,11 +434,7 @@ bool UsdMayaTranslatorLight::Read( if (!usdPrim) { return false; } -#if PXR_VERSION < 2111 - const UsdLuxLight lightSchema(usdPrim); -#else const UsdLuxLightAPI lightSchema(usdPrim); -#endif if (!lightSchema) { TF_RUNTIME_ERROR( "Failed to read UsdLuxLightAPI prim for light %s", usdPrim.GetPath().GetText()); diff --git a/lib/mayaUsd/fileio/translators/translatorLight.h b/lib/mayaUsd/fileio/translators/translatorLight.h index 22911637cd..3a2f857375 100644 --- a/lib/mayaUsd/fileio/translators/translatorLight.h +++ b/lib/mayaUsd/fileio/translators/translatorLight.h @@ -25,11 +25,7 @@ #include #include -#if PXR_VERSION < 2111 -#include -#else #include -#endif #include #include @@ -48,12 +44,8 @@ struct UsdMayaTranslatorLight /// Return true if all the parameters were exported properly. MAYAUSD_CORE_PUBLIC static bool WriteLightAttrs( - const UsdTimeCode& usdTime, -#if PXR_VERSION < 2111 - const UsdLuxLight& usdLight, -#else - const UsdLuxLightAPI& usdLight, -#endif + const UsdTimeCode& usdTime, + const UsdLuxLightAPI& usdLight, MFnLight& mayaLight, UsdUtilsSparseValueWriter* valueWriter = nullptr); diff --git a/lib/mayaUsd/fileio/translators/translatorRfMLight.cpp b/lib/mayaUsd/fileio/translators/translatorRfMLight.cpp index 68a79b3e51..70c2b49426 100644 --- a/lib/mayaUsd/fileio/translators/translatorRfMLight.cpp +++ b/lib/mayaUsd/fileio/translators/translatorRfMLight.cpp @@ -38,12 +38,8 @@ #include #include #include -#if PXR_VERSION < 2111 -#include -#else #include #include -#endif #include #include #include @@ -92,21 +88,12 @@ static constexpr bool _USE_SDR_TO_TRANSLATE = #endif void _ReadShaderAttributesFromUsdPrim_deprecated( -#if PXR_VERSION < 2111 - const UsdLuxLight lightSchema, -#else const UsdLuxLightAPI lightSchema, -#endif - MFnDependencyNode& depFn); + MFnDependencyNode& depFn); void _WriteShaderAttributesToUsdPrim_deprecated( const MFnDependencyNode& depFn, -#if PXR_VERSION < 2111 - UsdLuxLight& lightSchema -#else - UsdLuxLightAPI& lightSchema -#endif -); + UsdLuxLightAPI& lightSchema); static bool _ReportError(const std::string& msg, const SdfPath& primPath = SdfPath()) { @@ -124,45 +111,6 @@ static TfToken _GetMayaLightTypeToken(const MFnDependencyNode& depFn) return TfToken(mayaLightTypeName.asChar()); } -#if PXR_VERSION < 2111 -static UsdLuxLight _DefineUsdLuxLightForMayaLight( - const MFnDependencyNode& depFn, - const TfToken& mayaLightTypeToken, - UsdMayaPrimWriterContext* context) -{ - UsdLuxLight lightSchema; - - UsdStageRefPtr stage = context->GetUsdStage(); - const SdfPath& authorPath = context->GetAuthorPath(); - - if (mayaLightTypeToken == _tokens->AovLightMayaTypeName) { - lightSchema = UsdLuxLight(stage->DefinePrim(authorPath, _tokens->AovLightMayaTypeName)); - } else if (mayaLightTypeToken == _tokens->CylinderLightMayaTypeName) { - lightSchema = UsdLuxCylinderLight::Define(stage, authorPath); - } else if (mayaLightTypeToken == _tokens->DiskLightMayaTypeName) { - lightSchema = UsdLuxDiskLight::Define(stage, authorPath); - } else if (mayaLightTypeToken == _tokens->DistantLightMayaTypeName) { - lightSchema = UsdLuxDistantLight::Define(stage, authorPath); - } else if (mayaLightTypeToken == _tokens->DomeLightMayaTypeName) { - lightSchema = UsdLuxDomeLight::Define(stage, authorPath); - } else if (mayaLightTypeToken == _tokens->EnvDayLightMayaTypeName) { - lightSchema = UsdLuxLight(stage->DefinePrim(authorPath, _tokens->EnvDayLightMayaTypeName)); -#if PXR_VERSION < 2209 - } else if (mayaLightTypeToken == _tokens->MeshLightMayaTypeName) { - // In 22.09, MeshLight is exported as a MeshLightAPI schema - lightSchema = UsdLuxGeometryLight::Define(stage, authorPath); -#endif - } else if (mayaLightTypeToken == _tokens->RectLightMayaTypeName) { - lightSchema = UsdLuxRectLight::Define(stage, authorPath); - } else if (mayaLightTypeToken == _tokens->SphereLightMayaTypeName) { - lightSchema = UsdLuxSphereLight::Define(stage, authorPath); - } else { - _ReportError("Could not determine UsdLux schema for Maya light", authorPath); - } - - return lightSchema; -} -#else static UsdLuxLightAPI _DefineUsdLuxLightForMayaLight( const MFnDependencyNode& depFn, const TfToken& mayaLightTypeToken, @@ -201,7 +149,6 @@ static UsdLuxLightAPI _DefineUsdLuxLightForMayaLight( return lightSchema; } -#endif /* static */ bool UsdMayaTranslatorRfMLight::Write( @@ -223,11 +170,7 @@ bool UsdMayaTranslatorRfMLight::Write( return false; } -#if PXR_VERSION < 2111 - UsdLuxLight lightSchema = _DefineUsdLuxLightForMayaLight(depFn, mayaLightTypeToken, context); -#else UsdLuxLightAPI lightSchema = _DefineUsdLuxLightForMayaLight(depFn, mayaLightTypeToken, context); -#endif if (!lightSchema) { return _ReportError("Failed to create UsdLuxLightAPI prim", authorPath); } @@ -242,11 +185,7 @@ bool UsdMayaTranslatorRfMLight::Write( return true; } -#if PXR_VERSION < 2111 -static TfToken _GetMayaTypeTokenForUsdLuxLight(const UsdLuxLight& lightSchema) -#else static TfToken _GetMayaTypeTokenForUsdLuxLight(const UsdLuxLightAPI& lightSchema) -#endif { const UsdPrim& lightPrim = lightSchema.GetPrim(); @@ -291,11 +230,7 @@ bool UsdMayaTranslatorRfMLight::Read( return false; } -#if PXR_VERSION < 2111 - const UsdLuxLight lightSchema(usdPrim); -#else const UsdLuxLightAPI lightSchema(usdPrim); -#endif if (!lightSchema) { return _ReportError("Failed to read UsdLuxLightAPI prim", usdPrim.GetPath()); } diff --git a/lib/mayaUsd/fileio/translators/translatorRfMLight_deprecated.cpp b/lib/mayaUsd/fileio/translators/translatorRfMLight_deprecated.cpp index ba6e41e48c..13413c81c3 100644 --- a/lib/mayaUsd/fileio/translators/translatorRfMLight_deprecated.cpp +++ b/lib/mayaUsd/fileio/translators/translatorRfMLight_deprecated.cpp @@ -29,11 +29,7 @@ #include #include #include -#if PXR_VERSION < 2111 -#include -#else #include -#endif #include #include #include @@ -156,11 +152,7 @@ static UsdAttribute _SetLightPrimAttr( // INTENSITY -#if PXR_VERSION < 2111 -static bool _WriteLightIntensity(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightIntensity(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightIntensityPlug = depFn.findPlug(_tokens->IntensityPlugName.GetText(), &status); @@ -179,11 +171,7 @@ static bool _WriteLightIntensity(const MFnDependencyNode& depFn, UsdLuxLightAPI& return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightIntensity(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightIntensity(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightIntensityPlug = depFn.findPlug(_tokens->IntensityPlugName.GetText(), &status); @@ -201,11 +189,7 @@ static bool _ReadLightIntensity(const UsdLuxLightAPI& lightSchema, MFnDependency // EXPOSURE -#if PXR_VERSION < 2111 -static bool _WriteLightExposure(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightExposure(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightExposurePlug = depFn.findPlug(_tokens->ExposurePlugName.GetText(), &status); @@ -224,11 +208,7 @@ static bool _WriteLightExposure(const MFnDependencyNode& depFn, UsdLuxLightAPI& return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightExposure(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightExposure(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightExposurePlug = depFn.findPlug(_tokens->ExposurePlugName.GetText(), &status); @@ -246,11 +226,7 @@ static bool _ReadLightExposure(const UsdLuxLightAPI& lightSchema, MFnDependencyN // DIFFUSE -#if PXR_VERSION < 2111 -static bool _WriteLightDiffuse(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightDiffuse(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightDiffusePlug @@ -270,11 +246,7 @@ static bool _WriteLightDiffuse(const MFnDependencyNode& depFn, UsdLuxLightAPI& l return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightDiffuse(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightDiffuse(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightDiffusePlug = depFn.findPlug(_tokens->DiffuseAmountPlugName.GetText(), &status); @@ -292,11 +264,7 @@ static bool _ReadLightDiffuse(const UsdLuxLightAPI& lightSchema, MFnDependencyNo // SPECULAR -#if PXR_VERSION < 2111 -static bool _WriteLightSpecular(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightSpecular(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightSpecularPlug @@ -316,11 +284,7 @@ static bool _WriteLightSpecular(const MFnDependencyNode& depFn, UsdLuxLightAPI& return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightSpecular(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightSpecular(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightSpecularPlug = depFn.findPlug(_tokens->SpecularAmountPlugName.GetText(), &status); @@ -338,11 +302,7 @@ static bool _ReadLightSpecular(const UsdLuxLightAPI& lightSchema, MFnDependencyN // NORMALIZE POWER -#if PXR_VERSION < 2111 -static bool _WriteLightNormalizePower(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightNormalizePower(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightNormalizePowerPlug @@ -362,11 +322,7 @@ static bool _WriteLightNormalizePower(const MFnDependencyNode& depFn, UsdLuxLigh return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightNormalizePower(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightNormalizePower(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightNormalizePowerPlug @@ -385,11 +341,7 @@ static bool _ReadLightNormalizePower(const UsdLuxLightAPI& lightSchema, MFnDepen // COLOR -#if PXR_VERSION < 2111 -static bool _WriteLightColor(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightColor(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightColorPlug = depFn.findPlug(_tokens->ColorPlugName.GetText(), &status); @@ -406,11 +358,7 @@ static bool _WriteLightColor(const MFnDependencyNode& depFn, UsdLuxLightAPI& lig return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightColor(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightColor(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightColorPlug = depFn.findPlug(_tokens->ColorPlugName.GetText(), &status); @@ -431,11 +379,7 @@ static bool _ReadLightColor(const UsdLuxLightAPI& lightSchema, MFnDependencyNode // TEMPERATURE -#if PXR_VERSION < 2111 -static bool _WriteLightTemperature(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightTemperature(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { MStatus status; const MPlug lightEnableTemperaturePlug @@ -468,11 +412,7 @@ static bool _WriteLightTemperature(const MFnDependencyNode& depFn, UsdLuxLightAP return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightTemperature(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightTemperature(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { MStatus status; MPlug lightEnableTemperaturePlug @@ -507,11 +447,7 @@ static bool _ReadLightTemperature(const UsdLuxLightAPI& lightSchema, MFnDependen // DISTANT LIGHT ANGLE -#if PXR_VERSION < 2111 -static bool _WriteDistantLightAngle(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteDistantLightAngle(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { UsdLuxDistantLight distantLightSchema(lightSchema); if (!distantLightSchema) { @@ -536,11 +472,7 @@ static bool _WriteDistantLightAngle(const MFnDependencyNode& depFn, UsdLuxLightA return true; } -#if PXR_VERSION < 2111 -static bool _ReadDistantLightAngle(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadDistantLightAngle(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { const UsdLuxDistantLight distantLightSchema(lightSchema); if (!distantLightSchema) { @@ -563,11 +495,7 @@ static bool _ReadDistantLightAngle(const UsdLuxLightAPI& lightSchema, MFnDepende // LIGHT TEXTURE FILE -#if PXR_VERSION < 2111 -static bool _WriteLightTextureFile(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightTextureFile(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { UsdLuxRectLight rectLightSchema(lightSchema); UsdLuxDomeLight domeLightSchema(lightSchema); @@ -602,11 +530,7 @@ static bool _WriteLightTextureFile(const MFnDependencyNode& depFn, UsdLuxLightAP return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightTextureFile(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightTextureFile(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { const UsdLuxRectLight rectLightSchema(lightSchema); const UsdLuxDomeLight domeLightSchema(lightSchema); @@ -634,11 +558,7 @@ static bool _ReadLightTextureFile(const UsdLuxLightAPI& lightSchema, MFnDependen } // AOV LIGHT -#if PXR_VERSION < 2111 -static bool _WriteAovLight(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteAovLight(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { // Early out UsdPrim lightPrim = lightSchema.GetPrim(); @@ -838,11 +758,7 @@ static bool _WriteAovLight(const MFnDependencyNode& depFn, UsdLuxLightAPI& light return true; } -#if PXR_VERSION < 2111 -static bool _ReadAovLight(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadAovLight(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { // Early out const UsdPrim& lightPrim = lightSchema.GetPrim(); @@ -969,11 +885,7 @@ static bool _ReadAovLight(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& } // ENVDAY LIGHT -#if PXR_VERSION < 2111 -static bool _WriteEnvDayLight(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteEnvDayLight(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { // Early out UsdPrim lightPrim = lightSchema.GetPrim(); @@ -1263,11 +1175,7 @@ static bool _WriteEnvDayLight(const MFnDependencyNode& depFn, UsdLuxLightAPI& li return true; } -#if PXR_VERSION < 2111 -static bool _ReadEnvDayLight(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadEnvDayLight(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { const UsdPrim& lightPrim = lightSchema.GetPrim(); static const TfType& usdSchemaBase = TfType::FindByName(_tokens->UsdSchemaBase); @@ -1447,11 +1355,7 @@ static bool _ReadEnvDayLight(const UsdLuxLightAPI& lightSchema, MFnDependencyNod // SHAPING API -#if PXR_VERSION < 2111 -static bool _WriteLightShapingAPI(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightShapingAPI(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { UsdLuxShapingAPI shapingAPI = UsdMayaTranslatorUtil::GetAPISchemaForAuthoring(lightSchema.GetPrim()); @@ -1579,11 +1483,7 @@ static bool _WriteLightShapingAPI(const MFnDependencyNode& depFn, UsdLuxLightAPI return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightShapingAPI(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightShapingAPI(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { const UsdLuxShapingAPI shapingAPI(lightSchema); if (!shapingAPI) { @@ -1693,11 +1593,7 @@ static bool _ReadLightShapingAPI(const UsdLuxLightAPI& lightSchema, MFnDependenc // SHADOW API -#if PXR_VERSION < 2111 -static bool _WriteLightShadowAPI(const MFnDependencyNode& depFn, UsdLuxLight& lightSchema) -#else static bool _WriteLightShadowAPI(const MFnDependencyNode& depFn, UsdLuxLightAPI& lightSchema) -#endif { UsdLuxShadowAPI shadowAPI = UsdMayaTranslatorUtil::GetAPISchemaForAuthoring(lightSchema.GetPrim()); @@ -1799,11 +1695,7 @@ static bool _WriteLightShadowAPI(const MFnDependencyNode& depFn, UsdLuxLightAPI& return true; } -#if PXR_VERSION < 2111 -static bool _ReadLightShadowAPI(const UsdLuxLight& lightSchema, MFnDependencyNode& depFn) -#else static bool _ReadLightShadowAPI(const UsdLuxLightAPI& lightSchema, MFnDependencyNode& depFn) -#endif { const UsdLuxShadowAPI shadowAPI(lightSchema); if (!shadowAPI) { @@ -1895,12 +1787,8 @@ static bool _ReadLightShadowAPI(const UsdLuxLightAPI& lightSchema, MFnDependency } void _ReadShaderAttributesFromUsdPrim_deprecated( -#if PXR_VERSION < 2111 - const UsdLuxLight lightSchema, -#else const UsdLuxLightAPI lightSchema, -#endif - MFnDependencyNode& depFn) + MFnDependencyNode& depFn) { _ReadLightIntensity(lightSchema, depFn); _ReadLightExposure(lightSchema, depFn); @@ -1929,12 +1817,7 @@ void _ReadShaderAttributesFromUsdPrim_deprecated( void _WriteShaderAttributesToUsdPrim_deprecated( const MFnDependencyNode& depFn, -#if PXR_VERSION < 2111 - UsdLuxLight& lightSchema -#else - UsdLuxLightAPI& lightSchema -#endif -) + UsdLuxLightAPI& lightSchema) { _WriteLightIntensity(depFn, lightSchema); _WriteLightExposure(depFn, lightSchema); diff --git a/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp b/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp index e736a30101..423ac929dd 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp @@ -87,12 +87,6 @@ global proc mtohRenderOverride_AddMTOHAttributes(int $fromAE) { mtohRenderOverride_AddAttribute("mtoh", "Highlight outline (in pixels, 0 to disable)", "mtohSelectionOutline", $fromAE); )mel" #endif -#if PXR_VERSION <= 2005 - R"mel( - mtohRenderOverride_AddAttribute("mtoh", "Enable color quantization", "mtohColorQuantization", $fromAE); -)mel" -#endif - R"mel( } @@ -895,15 +889,6 @@ MObject MtohRenderGlobals::CreateAttributes(const GlobalParams& params) _CreateFloatAttribute( node, filter.mayaString(), defGlobals.outlineSelectionWidth, userDefaults); } -#endif -#if PXR_VERSION <= 2005 - if (filter(_tokens->mtohColorQuantization)) { - _CreateBoolAttribute( - node, filter.mayaString(), defGlobals.enableColorQuantization, userDefaults); - if (filter.attributeFilter()) { - return mayaObject; - } - } #endif // TODO: Move this to an external function and add support for more types, // and improve code quality/reuse. @@ -1091,14 +1076,6 @@ MtohRenderGlobals::GetInstance(const GlobalParams& params, bool storeUserSetting } } #endif -#if PXR_VERSION <= 2005 - if (filter(_tokens->mtohColorQuantization)) { - _GetAttribute(node, filter.mayaString(), globals.enableColorQuantization, storeUserSetting); - if (filter.attributeFilter()) { - return globals; - } - } -#endif // TODO: Move this to an external function and add support for more types, // and improve code quality/reuse. diff --git a/lib/mayaUsd/render/mayaToHydra/renderGlobals.h b/lib/mayaUsd/render/mayaToHydra/renderGlobals.h index ba78f668b3..5d6c61c836 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderGlobals.h +++ b/lib/mayaUsd/render/mayaToHydra/renderGlobals.h @@ -100,9 +100,6 @@ class MtohRenderGlobals #if PXR_VERSION >= 2005 float outlineSelectionWidth = 4.f; #endif -#if PXR_VERSION <= 2005 - float enableColorQuantization = false; -#endif }; PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp index 71446a32a8..87cb869c86 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp @@ -657,10 +657,6 @@ MStatus MtohRenderOverride::Render(const MHWRender::MDrawContext& drawContext) } else _taskController->SetSelectionEnableOutline(false); #endif -#if PXR_VERSION <= 2005 - _taskController->SetColorizeQuantizationEnabled(_globals.enableColorQuantization); -#endif - _taskController->SetCollection(_renderCollection); if (_isUsingHdSt) { // TODO: Is there a way to improve this? Quite silly. @@ -729,9 +725,6 @@ void MtohRenderOverride::_InitHydraResources() _initializationAttempted = true; -#if PXR_VERSION < 2102 - GlfGlewInit(); -#endif GlfContextCaps::InitInstance(); _rendererPlugin = HdRendererPluginRegistry::GetInstance().GetRendererPlugin(_rendererDesc.rendererName); diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.h b/lib/mayaUsd/render/mayaToHydra/renderOverride.h index 0081bd47c7..ebf84d53e8 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.h +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.h @@ -16,11 +16,6 @@ #ifndef MTOH_VIEW_OVERRIDE_H #define MTOH_VIEW_OVERRIDE_H -#include -#if PXR_VERSION < 2102 -#include -#endif - #include #include #include diff --git a/lib/mayaUsd/render/mayaToHydra/utils.cpp b/lib/mayaUsd/render/mayaToHydra/utils.cpp index e3cebf62bc..de9ede7d0e 100644 --- a/lib/mayaUsd/render/mayaToHydra/utils.cpp +++ b/lib/mayaUsd/render/mayaToHydra/utils.cpp @@ -14,17 +14,6 @@ // limitations under the License. // -// GLEW must be included early (for core USD < 21.02), but we need pxr.h first -// so that PXR_VERSION has the correct value. -// We also disable clang-format for this block, since otherwise v10.0.0 fails -// to recognize that "utils.h" is the related header. -// clang-format off -#include -#if PXR_VERSION < 2102 -#include -#endif -// clang-format on - #include "utils.h" #include "renderGlobals.h" @@ -34,6 +23,7 @@ #include #include #include + #include PXR_NAMESPACE_OPEN_SCOPE @@ -64,9 +54,6 @@ MtohInitializeRenderPlugins() // XXX: As of 22.02, this needs to be called for Storm if (pluginDesc.id == MtohTokens->HdStormRendererPlugin) { -#if PXR_VERSION < 2102 - GlfGlewInit(); -#endif GlfContextCaps::InitInstance(); } diff --git a/lib/mayaUsd/render/px_vp20/glslProgram.cpp b/lib/mayaUsd/render/px_vp20/glslProgram.cpp index afe90a06f2..5673b38d77 100644 --- a/lib/mayaUsd/render/px_vp20/glslProgram.cpp +++ b/lib/mayaUsd/render/px_vp20/glslProgram.cpp @@ -14,13 +14,7 @@ // limitations under the License. // -// GL loading library needs to be included before any other OpenGL headers. -#include -#if PXR_VERSION < 2102 -#include -#else #include -#endif #include "glslProgram.h" diff --git a/lib/mayaUsd/render/px_vp20/utils.cpp b/lib/mayaUsd/render/px_vp20/utils.cpp index cc094d804b..ca3336c1b6 100644 --- a/lib/mayaUsd/render/px_vp20/utils.cpp +++ b/lib/mayaUsd/render/px_vp20/utils.cpp @@ -14,13 +14,7 @@ // limitations under the License. // -// GL loading library needs to be included before any other OpenGL headers. -#include -#if PXR_VERSION < 2102 -#include -#else #include -#endif #include "utils.h" diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp index 113d6ef600..cea0a4f564 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp +++ b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp @@ -14,13 +14,7 @@ // limitations under the License. // -// GL loading library needs to be included before any other OpenGL headers. -#include -#if PXR_VERSION < 2102 -#include -#else #include -#endif #include "batchRenderer.h" @@ -109,9 +103,6 @@ const int UsdMayaGLBatchRenderer::ProfilerCategory = MProfiler::addCategory( /* static */ void UsdMayaGLBatchRenderer::Init() { -#if PXR_VERSION < 2102 - GlfGlewInit(); -#endif GlfContextCaps::InitInstance(); GetInstance(); diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp index 81b29eb745..ff6a886758 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp @@ -74,11 +74,6 @@ #include #endif -#if PXR_VERSION <= 2008 -// Needed for GL_HALF_FLOAT. -#include -#endif - #include #include diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.h b/lib/mayaUsd/render/vp2RenderDelegate/material.h index 1628023dc0..9ecf3f5b59 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/material.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/material.h @@ -95,10 +95,6 @@ class HdVP2Material final : public HdMaterial HdDirtyBits GetInitialDirtyBitsMask() const override; -#if PXR_VERSION < 2011 - void Reload() override {}; -#endif - //! Get the surface shader instance. MHWRender::MShaderInstance* GetSurfaceShader(const TfToken& reprToken, bool backfaceCull = false) const; diff --git a/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp b/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp index 98d0b01d06..3e2443b3a2 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp @@ -913,12 +913,7 @@ void MayaUsdRPrim::_SyncSharedData( // in the shared data structure based on current Hydra data _RenderTag() = renderTag; #else - if (*dirtyBits - & (HdChangeTracker::DirtyRenderTag -#ifdef ENABLE_RENDERTAG_VISIBILITY_WORKAROUND - | HdChangeTracker::DirtyVisibility -#endif - )) { + if (*dirtyBits & (HdChangeTracker::DirtyRenderTag)) { _RenderTag() = renderTag; } #endif @@ -958,12 +953,7 @@ bool MayaUsdRPrim::_SyncCommon( HdRenderIndex& renderIndex = delegate->GetRenderIndex(); if (!drawScene.DrawRenderTag(renderIndex.GetRenderTag(id))) { _HideAllDrawItems(curRepr); - *dirtyBits &= ~( - HdChangeTracker::DirtyRenderTag -#ifdef ENABLE_RENDERTAG_VISIBILITY_WORKAROUND - | HdChangeTracker::DirtyVisibility -#endif - ); + *dirtyBits &= ~(HdChangeTracker::DirtyRenderTag); return false; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.cpp b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.cpp index 495e829933..71ae790004 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.cpp @@ -770,14 +770,7 @@ bool MeshViewportCompute::hasOpenGL() return nullptr != glBindBufferBase; } -void MeshViewportCompute::initializeOpenGL() -{ -#if PXR_VERSION < 2102 - GlfGlewInit(); -#else - GarchGLApiLoad(); -#endif -} +void MeshViewportCompute::initializeOpenGL() { GarchGLApiLoad(); } void MeshViewportCompute::compileNormalsProgram() { diff --git a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h index 3a84792cd3..ccbcebc6e7 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/meshViewportCompute.h @@ -16,8 +16,6 @@ #ifndef HD_VP2_MESHVIEWPORTCOMPUTE #define HD_VP2_MESHVIEWPORTCOMPUTE -#include // for PXR_VERSION - #include // for MAYA_API_VERSION /* @@ -86,11 +84,7 @@ // clang-format wants to re-order these two includes but they must be done in this order or // the code will not compile. // clang-format off -#if PXR_VERSION < 2102 -#include // needs to be included before anything else includes gl.h -#else #include -#endif #include // this includes gl.h and no GL loader. //clang-format on #endif diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp index 6a3a63c253..b6ec254958 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp @@ -1894,11 +1894,6 @@ void ProxyRenderDelegate::_UpdateRenderTags() // changed since the last time we set the render tags so we know if there is a change // to an individual rprim or not. bool rprimRenderTagChanged = !_changeVersions.renderTagValid(changeTracker); -#ifdef ENABLE_RENDERTAG_VISIBILITY_WORKAROUND - rprimRenderTagChanged - = rprimRenderTagChanged || !_changeVersions.visibilityValid(changeTracker); -#endif - bool renderPurposeChanged = false; bool proxyPurposeChanged = false; bool guidePurposeChanged = false; diff --git a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h index 68410a1af9..4b37e2da2e 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.h @@ -48,19 +48,6 @@ #define MAYA_ENABLE_UPDATE_FOR_SELECTION #endif -#if PXR_VERSION < 2008 -#define ENABLE_RENDERTAG_VISIBILITY_WORKAROUND -/* In USD v20.05 and earlier when the purpose of an rprim changes the visibility gets dirtied, - and that doesn't update the render tag version. - - Pixar is in the process of fixing this one as noted in: - https://groups.google.com/forum/#!topic/usd-interest/9pzFbtCEY-Y - - Logged as: - https://github.com/PixarAnimationStudios/USD/issues/1243 -*/ -#endif - // Use the latest MPxSubSceneOverride API #ifndef OPENMAYA_MPXSUBSCENEOVERRIDE_LATEST_NAMESPACE #define OPENMAYA_MPXSUBSCENEOVERRIDE_LATEST_NAMESPACE OPENMAYA_MAJOR_NAMESPACE diff --git a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp index 677b4ff95f..ef4be2989d 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.cpp @@ -948,25 +948,6 @@ TfTokenVector HdVP2RenderDelegate::GetShaderSourceTypes() const #endif } -#if PXR_VERSION < 2105 - -TfToken HdVP2RenderDelegate::GetMaterialNetworkSelector() const -{ -#ifdef WANT_MATERIALX_BUILD - MHWRender::MRenderer* theRenderer = MHWRender::MRenderer::theRenderer(); - if (theRenderer && theRenderer->drawAPI() == MHWRender::kOpenGLCoreProfile - && !TfGetEnvSetting(MAYAUSD_VP2_USE_ONLY_PREVIEWSURFACE)) { - return HdVP2Tokens->mtlx; - } else { - return HdVP2Tokens->glslfx; - } -#else - return HdVP2Tokens->glslfx; -#endif -} - -#else // PXR_VERSION < 2105 - TfTokenVector HdVP2RenderDelegate::GetMaterialRenderContexts() const { #ifdef WANT_MATERIALX_BUILD @@ -981,7 +962,6 @@ TfTokenVector HdVP2RenderDelegate::GetMaterialRenderContexts() const return { HdVP2Tokens->glslfx }; #endif } -#endif // PXR_VERSION < 2105 /*! \brief Returns a node name made as a child of delegate's id. */ diff --git a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.h b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.h index d677a9b02c..92a31ded69 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.h +++ b/lib/mayaUsd/render/vp2RenderDelegate/render_delegate.h @@ -123,11 +123,7 @@ class HdVP2RenderDelegate final : public HdRenderDelegate TfToken GetMaterialBindingPurpose() const override; TfTokenVector GetShaderSourceTypes() const override; -#if PXR_VERSION < 2105 - TfToken GetMaterialNetworkSelector() const override; -#else TfTokenVector GetMaterialRenderContexts() const override; -#endif bool IsPrimvarFilteringNeeded() const override { return true; } diff --git a/lib/mayaUsd/ufe/UsdLight.cpp b/lib/mayaUsd/ufe/UsdLight.cpp index e24bf34fb4..90d984eef0 100644 --- a/lib/mayaUsd/ufe/UsdLight.cpp +++ b/lib/mayaUsd/ufe/UsdLight.cpp @@ -21,11 +21,7 @@ #include #include -#if PXR_VERSION < 2111 -#include -#else #include -#endif #include #include #include @@ -88,12 +84,6 @@ UsdLight::Ptr UsdLight::create(const UsdSceneItem::Ptr& item) return std::make_shared(item); } -#if PXR_VERSION < 2111 -using UsdLuxLightCommon = UsdLuxLight; -#else -using UsdLuxLightCommon = UsdLuxLightAPI; -#endif - //------------------------------------------------------------------------------ // Ufe::Light overrides //------------------------------------------------------------------------------ @@ -121,7 +111,7 @@ Ufe::Light::Type UsdLight::type() const float getLightIntensity(const UsdPrim& prim) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetIntensityAttr(); float val = 0.f; @@ -131,7 +121,7 @@ float getLightIntensity(const UsdPrim& prim) void setLightIntensity(const UsdPrim& prim, float attrVal) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetIntensityAttr(); lightAttribute.Set(attrVal); @@ -151,7 +141,7 @@ float UsdLight::intensity() const { return getLightIntensity(prim()); } Ufe::Color3f getLightColor(const UsdPrim& prim) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetColorAttr(); GfVec3f val(0.f, 0.f, 0.f); @@ -161,7 +151,7 @@ Ufe::Color3f getLightColor(const UsdPrim& prim) void setLightColor(const UsdPrim& prim, const Ufe::Color3f& attrVal) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetColorAttr(); lightAttribute.Set(GfVec3f(attrVal.r(), attrVal.g(), attrVal.b())); @@ -246,7 +236,7 @@ Ufe::Color3f UsdLight::shadowColor() const { return getLightShadowColor(prim()); float getLightDiffuse(const UsdPrim& prim) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetDiffuseAttr(); float val = 0.f; @@ -256,7 +246,7 @@ float getLightDiffuse(const UsdPrim& prim) void setLightDiffuse(const UsdPrim& prim, float attrVal) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetDiffuseAttr(); lightAttribute.Set(attrVal); @@ -276,7 +266,7 @@ float UsdLight::diffuse() const { return getLightDiffuse(prim()); } float getLightSpecular(const UsdPrim& prim) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetSpecularAttr(); float val = 0.f; @@ -286,7 +276,7 @@ float getLightSpecular(const UsdPrim& prim) void setLightSpecular(const UsdPrim& prim, float attrVal) { - const UsdLuxLightCommon lightSchema(prim); + const UsdLuxLightAPI lightSchema(prim); const PXR_NS::UsdAttribute lightAttribute = lightSchema.GetSpecularAttr(); lightAttribute.Set(attrVal); diff --git a/lib/mayaUsd/ufe/UsdLightHandler.cpp b/lib/mayaUsd/ufe/UsdLightHandler.cpp index e967359643..a83182bb91 100644 --- a/lib/mayaUsd/ufe/UsdLightHandler.cpp +++ b/lib/mayaUsd/ufe/UsdLightHandler.cpp @@ -17,23 +17,13 @@ #include "UsdLight.h" -#if PXR_VERSION < 2111 -#include -#else -#include -#endif - #include +#include + namespace MAYAUSD_NS_DEF { namespace ufe { -#if PXR_VERSION < 2111 -using UsdLuxLightCommon = PXR_NS::UsdLuxLight; -#else -using UsdLuxLightCommon = PXR_NS::UsdLuxLightAPI; -#endif - UsdLightHandler::UsdLightHandler() : Ufe::LightHandler() { @@ -52,7 +42,7 @@ Ufe::Light::Ptr UsdLightHandler::light(const Ufe::SceneItem::Ptr& item) const // Test if this item is a light. If not, then we cannot create a light // interface for it, which is a valid case (such as for a mesh node type). - UsdLuxLightCommon lightSchema(usdItem->prim()); + PXR_NS::UsdLuxLightAPI lightSchema(usdItem->prim()); if (!lightSchema) return nullptr; diff --git a/lib/mayaUsd/ufe/XformOpUtils.cpp b/lib/mayaUsd/ufe/XformOpUtils.cpp index 335ecd4b97..15ff40b040 100644 --- a/lib/mayaUsd/ufe/XformOpUtils.cpp +++ b/lib/mayaUsd/ufe/XformOpUtils.cpp @@ -63,16 +63,7 @@ computeLocalTransformWithOp(const UsdPrim& prim, const UsdGeomXformOp& op, const bool unused; auto ops = xformable.GetOrderedXformOps(&unused); - // The UsdGeomXformOp::operator==() was only added in v20.05, so - // prior to that we need to find using a predicate. In USD - // they define equality to be the same underlying UsdAttribute. -#if PXR_VERSION < 2005 - auto find_XFormOp = [op](const UsdGeomXformOp& x) { return x.GetAttr() == op.GetAttr(); }; - auto i = std::find_if(ops.begin(), ops.end(), find_XFormOp); -#else auto i = std::find(ops.begin(), ops.end(), op); -#endif - if (i == ops.end()) { TF_FATAL_ERROR("Matrix op %s not found in transform ops.", op.GetOpName().GetText()); } diff --git a/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp b/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp index 53b6a5c451..c4117d4249 100644 --- a/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp +++ b/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp @@ -97,20 +97,6 @@ class HdMayaAiSkyDomeLightAdapter : public HdMayaLightAdapter file.findPlug(MayaAttrs::file::fileTextureName, true).asString().asChar())); } else if (paramName == HdLightTokens->enableColorTemperature) { return VtValue(false); -#if PXR_VERSION < 2011 - } else if (paramName == HdLightTokens->textureResource) { - auto fileObj = GetConnectedFileNode(GetNode(), HdMayaAdapterTokens->color); - // TODO: Return a default, white texture? - // Ideally we would want to return a custom texture resource based - // on the color, but not sure how easy that would be. - if (fileObj == MObject::kNullObj) { - return {}; - } - return VtValue { GetFileTextureResource( - fileObj, - GetFileTexturePath(MFnDependencyNode(fileObj)), - GetDelegate()->GetParams().textureMemoryPerTexture) }; -#endif // PXR_VERSION < 2011 } return {}; } diff --git a/lib/usd/hdMaya/adapters/cameraAdapter.cpp b/lib/usd/hdMaya/adapters/cameraAdapter.cpp index b02befd4a7..927c2e7b91 100644 --- a/lib/usd/hdMaya/adapters/cameraAdapter.cpp +++ b/lib/usd/hdMaya/adapters/cameraAdapter.cpp @@ -72,11 +72,6 @@ void HdMayaCameraAdapter::Populate() void HdMayaCameraAdapter::MarkDirty(HdDirtyBits dirtyBits) { if (_isPopulated && dirtyBits != 0) { -#if PXR_VERSION < 2102 - if (dirtyBits & HdChangeTracker::DirtyTransform) { - dirtyBits |= HdCamera::DirtyViewMatrix; - } -#endif dirtyBits = dirtyBits & HdCamera::AllDirty; GetDelegate()->GetChangeTracker().MarkSprimDirty(GetID(), dirtyBits); } @@ -110,11 +105,7 @@ void HdMayaCameraAdapter::CreateCallbacks() dag, +[](MObject& transformNode, MDagMessage::MatrixModifiedFlags& modified, void* clientData) { auto* adapter = reinterpret_cast(clientData); -#if PXR_VERSION < 2102 - adapter->MarkDirty(HdCamera::DirtyViewMatrix); -#else adapter->MarkDirty(HdCamera::DirtyTransform); -#endif adapter->InvalidateTransform(); }, reinterpret_cast(this), @@ -186,100 +177,6 @@ VtValue HdMayaCameraAdapter::GetCameraParamValue(const TfToken& paramName) aspectRatio, apertureX, apertureY, offsetX, offsetY, true, false, true); }; -#if PXR_VERSION < 2102 - - auto projectionMatrix - = [&](const MFnCamera& camera, bool isOrtho, const GfVec4d* viewport) -> GfMatrix4d { - double left, right, bottom, top, cameraNear = camera.nearClippingPlane(), - cameraFar = camera.farClippingPlane(), - cameraFarMinusNear = cameraFar - cameraNear, - aspectRatio = viewport - ? (((*viewport)[2] - (*viewport)[0]) / ((*viewport)[3] - (*viewport)[1])) - : camera.aspectRatio(); - - status = camera.getViewingFrustum(aspectRatio, left, right, bottom, top, true, false, true); - - if (isOrtho) { - // Skip over extraneous double-precision math in the common symmetric case - if (right == -left && top == -bottom) - return GfMatrix4d( - 1.0 / right, - 0, - 0, - 0, - 0, - 1.0 / top, - 0, - 0, - 0, - 0, - -2.0 / cameraFarMinusNear, - 0, - 0, - 0, - -(cameraFar + cameraNear) / cameraFarMinusNear, - 1); - - return GfMatrix4d( - 2.0 / (right - left), - 0, - 0, - 0, - 0, - 2.0 / (top - bottom), - 0, - 0, - 0, - 0, - -2.0 / cameraFarMinusNear, - 0, - -(right + left) / (right - left), - -(top + bottom) / (top - bottom), - -(cameraFar + cameraNear) / cameraFarMinusNear, - 1); - } - - // Skip over extraneous double-precision math in the common symmetric case - if (right == -left && top == -bottom) - return GfMatrix4d( - cameraNear / right, - 0, - 0, - 0, - 0, - cameraNear / top, - 0, - 0, - 0, - 0, - -(cameraFar + cameraNear) / cameraFarMinusNear, - -1, - 0, - 0, - (-2.0 * cameraFar * cameraNear) / cameraFarMinusNear, - 0); - - return GfMatrix4d( - (2.0 * cameraNear) / (right - left), - 0, - 0, - 0, - 0, - (2.0 * cameraNear) / (top - bottom), - 0, - 0, - (right + left) / (right - left), - (top + bottom) / (top - bottom), - -(cameraFar + cameraNear) / cameraFarMinusNear, - -1, - 0, - 0, - (2.0 * cameraNear * -cameraFar) / cameraFarMinusNear, - 0); - }; - -#endif - auto hadError = [&](MStatus& status) -> bool { if (ARCH_LIKELY(status)) return false; @@ -299,18 +196,6 @@ VtValue HdMayaCameraAdapter::GetCameraParamValue(const TfToken& paramName) return {}; } -#if PXR_VERSION < 2102 - if (paramName == HdCameraTokens->projectionMatrix) { - const auto projMatrix = projectionMatrix(camera, isOrtho, _viewport.get()); - if (hadError(status)) - return {}; - return VtValue(projMatrix); - } - if (paramName == HdCameraTokens->worldToViewMatrix) { - return VtValue(GetTransform().GetInverse()); - } -#endif - if (paramName == HdCameraTokens->shutterOpen) { // No motion samples, instantaneous shutter if (!GetDelegate()->GetParams().motionSamplesEnabled()) diff --git a/lib/usd/hdMaya/adapters/materialAdapter.cpp b/lib/usd/hdMaya/adapters/materialAdapter.cpp index 4f460b8674..ccf3d030bf 100644 --- a/lib/usd/hdMaya/adapters/materialAdapter.cpp +++ b/lib/usd/hdMaya/adapters/materialAdapter.cpp @@ -34,10 +34,6 @@ #include #include -#if PXR_VERSION < 2011 -#include -#endif // PXR_VERSION < 2011 - PXR_NAMESPACE_OPEN_SCOPE namespace { @@ -91,20 +87,6 @@ void HdMayaMaterialAdapter::Populate() _isPopulated = true; } -#if PXR_VERSION < 2011 - -HdTextureResource::ID HdMayaMaterialAdapter::GetTextureResourceID(const TfToken& paramName) -{ - return {}; -} - -HdTextureResourceSharedPtr HdMayaMaterialAdapter::GetTextureResource(const SdfPath& textureShaderId) -{ - return {}; -} - -#endif // PXR_VERSION < 2011 - VtValue HdMayaMaterialAdapter::GetMaterialResource() { TF_DEBUG(HDMAYA_ADAPTER_MATERIALS).Msg("HdMayaMaterialAdapter::GetMaterialResource()\n"); @@ -214,30 +196,6 @@ class HdMayaShadingEngineAdapter : public HdMayaMaterialAdapter } } -#if PXR_VERSION < 2011 - - HdTextureResourceSharedPtr GetTextureResource(const SdfPath& textureShaderId) override - { - TF_DEBUG(HDMAYA_ADAPTER_MATERIALS) - .Msg( - "HdMayaShadingEngineAdapter::GetTextureResource(%s): %s\n", - textureShaderId.GetText(), - GetID().GetText()); - if (GetDelegate()->IsHdSt()) { - auto* mObjPtr = TfMapLookupPtr(_materialPathToMobj, textureShaderId); - if (!mObjPtr || (*mObjPtr) == MObject::kNullObj) { - return {}; - } - return GetFileTextureResource( - *mObjPtr, - GetFileTexturePath(MFnDependencyNode(*mObjPtr)), - GetDelegate()->GetParams().textureMemoryPerTexture); - } - return {}; - } - -#endif // PXR_VERSION < 2011 - void _CreateSurfaceMaterialCallback() { _CacheNodeAndTypes(); @@ -252,21 +210,6 @@ class HdMayaShadingEngineAdapter : public HdMayaMaterialAdapter } } -#if PXR_VERSION < 2011 - - inline HdTextureResource::ID - _GetTextureResourceID(const MObject& fileObj, const TfToken& filePath) - { - auto hash = filePath.Hash(); - const auto wrapping = GetFileTextureWrappingParams(fileObj); - MayaUsd::hash_combine(hash, GetDelegate()->GetParams().textureMemoryPerTexture); - MayaUsd::hash_combine(hash, std::get<0>(wrapping)); - MayaUsd::hash_combine(hash, std::get<1>(wrapping)); - return HdTextureResource::ID(hash); - } - -#endif // PXR_VERSION < 2011 - VtValue GetMaterialResource() override { TF_DEBUG(HDMAYA_ADAPTER_MATERIALS) @@ -321,13 +264,6 @@ class HdMayaShadingEngineAdapter : public HdMayaMaterialAdapter TfToken _surfaceShaderType; // So they live long enough -#if PXR_VERSION < 2011 - - std::unordered_map - _textureResourceHandles; - -#endif // PXR_VERSION < 2011 - MCallbackId _surfaceShaderCallback; #ifdef HDMAYA_OIT_ENABLED bool _isTranslucent = false; diff --git a/lib/usd/hdMaya/adapters/materialAdapter.h b/lib/usd/hdMaya/adapters/materialAdapter.h index 088f9690fe..92803e94aa 100644 --- a/lib/usd/hdMaya/adapters/materialAdapter.h +++ b/lib/usd/hdMaya/adapters/materialAdapter.h @@ -43,15 +43,6 @@ class HdMayaMaterialAdapter : public HdMayaAdapter HDMAYA_API void Populate() override; -#if PXR_VERSION < 2011 - - HDMAYA_API - virtual HdTextureResourceSharedPtr GetTextureResource(const SdfPath& textureShaderId); - HDMAYA_API - virtual HdTextureResource::ID GetTextureResourceID(const TfToken& paramName); - -#endif // PXR_VERSION < 2011 - HDMAYA_API virtual VtValue GetMaterialResource(); diff --git a/lib/usd/hdMaya/delegates/delegateDebugCodes.cpp b/lib/usd/hdMaya/delegates/delegateDebugCodes.cpp index dda0428d65..449b163185 100644 --- a/lib/usd/hdMaya/delegates/delegateDebugCodes.cpp +++ b/lib/usd/hdMaya/delegates/delegateDebugCodes.cpp @@ -113,19 +113,6 @@ TF_REGISTRY_FUNCTION(TfDebug) TF_DEBUG_ENVIRONMENT_SYMBOL( HDMAYA_DELEGATE_SELECTION, "Print information about hdMaya delegate selection."); - -#if PXR_VERSION < 2011 - - TF_DEBUG_ENVIRONMENT_SYMBOL( - HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE, - "Print information about 'GetTextureResource' calls to the delegates."); - - TF_DEBUG_ENVIRONMENT_SYMBOL( - HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE_ID, - "Print information about 'GetTextureResourceID' calls to the " - "delegates."); - -#endif // PXR_VERSION < 2011 } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/usd/hdMaya/delegates/delegateDebugCodes.h b/lib/usd/hdMaya/delegates/delegateDebugCodes.h index 734c97cc56..da406cb5cf 100644 --- a/lib/usd/hdMaya/delegates/delegateDebugCodes.h +++ b/lib/usd/hdMaya/delegates/delegateDebugCodes.h @@ -49,18 +49,6 @@ TF_DEBUG_CODES( HDMAYA_DELEGATE_SELECTION); // clang-format on -// Debug codes for Hydra API that was deprecated with USD 20.11. -// These are declared in a separate block to avoid using a preprocessor -// directive inside the TF_DEBUG_CODES() macro invocation, which breaks -// compilation on Windows. -#if PXR_VERSION < 2011 -// clang-format off -TF_DEBUG_CODES( - HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE, - HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE_ID); -// clang-format on -#endif // PXR_VERSION < 2011 - PXR_NAMESPACE_CLOSE_SCOPE #endif // HDMAYA_DELEGATE_DEBUG_CODES_H diff --git a/lib/usd/hdMaya/delegates/sceneDelegate.cpp b/lib/usd/hdMaya/delegates/sceneDelegate.cpp index f3cad9df4b..63b88db6c4 100644 --- a/lib/usd/hdMaya/delegates/sceneDelegate.cpp +++ b/lib/usd/hdMaya/delegates/sceneDelegate.cpp @@ -133,17 +133,6 @@ inline bool _RemoveAdapter(const SdfPath& id, F f, M0& m0, M&... m) template inline R _GetDefaultValue() { return {}; } -#if PXR_VERSION < 2011 - -// Default return value for HdTextureResource::ID, if not found, should be -// -1, not {} - which would be 0 -template <> inline HdTextureResource::ID _GetDefaultValue() -{ - return HdTextureResource::ID(-1); -} - -#endif // PXR_VERSION < 2011 - // This will be nicer to use with automatic parameter deduction for lambdas in // C++14. template inline R _GetValue(const SdfPath&, F) @@ -1118,57 +1107,6 @@ VtValue HdMayaSceneDelegate::GetMaterialResource(const SdfPath& id) return ret.IsEmpty() ? HdMayaMaterialAdapter::GetPreviewMaterialResource(id) : ret; } -#if PXR_VERSION < 2011 - -HdTextureResource::ID HdMayaSceneDelegate::GetTextureResourceID(const SdfPath& textureId) -{ - TF_DEBUG(HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE_ID) - .Msg("HdMayaSceneDelegate::GetTextureResourceID(%s)\n", textureId.GetText()); - return _GetValue( - textureId.GetPrimPath(), - [&textureId](HdMayaMaterialAdapter* a) -> HdTextureResource::ID { - return a->GetTextureResourceID(textureId.GetNameToken()); - }, - _materialAdapters); -} - -HdTextureResourceSharedPtr HdMayaSceneDelegate::GetTextureResource(const SdfPath& textureId) -{ - TF_DEBUG(HDMAYA_DELEGATE_GET_TEXTURE_RESOURCE) - .Msg("HdMayaSceneDelegate::GetTextureResource(%s)\n", textureId.GetText()); - - auto* adapterPtr = TfMapLookupPtr(_materialAdapters, textureId); - - if (!adapterPtr) { - // For texture nodes we may have only inserted an adapter for the material - // not for the texture itself. - // - // UsdShade has the rule that a UsdShade node must be nested inside the - // UsdMaterial scope. We traverse the parent paths to find the material. - // - // Example for texture prim: - // /Materials/Woody/BootMaterial/UsdShadeNodeGraph/Tex - // We want to find Sprim: - // /Materials/Woody/BootMaterial - - // While-loop to account for nesting of UsdNodeGraphs and DrawMode - // adapter with prototypes. - SdfPath parentPath = textureId; - while (!adapterPtr && !parentPath.IsRootPrimPath()) { - parentPath = parentPath.GetParentPath(); - adapterPtr = TfMapLookupPtr(_materialAdapters, parentPath); - } - } - - if (adapterPtr) { - return adapterPtr->get()->GetTextureResource(textureId); - } - - return nullptr; -} - -#endif // PXR_VERSION < 2011 - bool HdMayaSceneDelegate::_CreateMaterial(const SdfPath& id, const MObject& obj) { TF_DEBUG(HDMAYA_ADAPTER_MATERIALS) diff --git a/lib/usd/hdMaya/delegates/sceneDelegate.h b/lib/usd/hdMaya/delegates/sceneDelegate.h index 181e1d0499..8971f3512f 100644 --- a/lib/usd/hdMaya/delegates/sceneDelegate.h +++ b/lib/usd/hdMaya/delegates/sceneDelegate.h @@ -236,14 +236,6 @@ class HdMayaSceneDelegate : public HdMayaDelegateCtx HDMAYA_API VtValue GetMaterialResource(const SdfPath& id) override; -#if PXR_VERSION < 2011 - HDMAYA_API - HdTextureResource::ID GetTextureResourceID(const SdfPath& textureId) override; - - HDMAYA_API - HdTextureResourceSharedPtr GetTextureResource(const SdfPath& textureId) override; -#endif // PXR_VERSION < 2011 - private: template AdapterPtr Create( diff --git a/lib/usd/hdMaya/utils.cpp b/lib/usd/hdMaya/utils.cpp index d855d9258d..13fe7bb68f 100644 --- a/lib/usd/hdMaya/utils.cpp +++ b/lib/usd/hdMaya/utils.cpp @@ -23,51 +23,8 @@ #include #include -#if PXR_VERSION < 2011 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#endif - PXR_NAMESPACE_OPEN_SCOPE -#if PXR_VERSION < 2011 - -namespace { - -class UdimTextureFactory : public GlfTextureFactoryBase -{ -public: - virtual GlfTextureRefPtr - New(TfToken const& texturePath, - GlfImage::ImageOriginLocation originLocation = GlfImage::OriginLowerLeft) const override - { - const GlfContextCaps& caps = GlfContextCaps::GetInstance(); - return GlfUdimTexture::New( - texturePath, - originLocation, - UsdImaging_GetUdimTiles(texturePath, caps.maxArrayTextureLayers)); - } - - virtual GlfTextureRefPtr - New(TfTokenVector const& texturePaths, - GlfImage::ImageOriginLocation originLocation = GlfImage::OriginLowerLeft) const override - { - return nullptr; - } -}; - -} // namespace - -#endif // PXR_VERSION < 2011 - MObject GetConnectedFileNode(const MObject& obj, const TfToken& paramName) { MStatus status; @@ -112,70 +69,4 @@ TfToken GetFileTexturePath(const MFnDependencyNode& fileNode) } } -#if PXR_VERSION < 2011 - -std::tuple GetFileTextureWrappingParams(const MObject& fileObj) -{ - const std::tuple def { HdWrapClamp, HdWrapClamp }; - MStatus status; - MFnDependencyNode fileNode(fileObj, &status); - if (!status) { - return def; - } - - auto getWrap = [&fileNode](MObject& wrapAttr, MObject& mirrorAttr) { - if (fileNode.findPlug(wrapAttr, true).asBool()) { - if (fileNode.findPlug(mirrorAttr, true).asBool()) { - return HdWrapMirror; - } else { - return HdWrapRepeat; - } - } else { - return HdWrapClamp; - } - }; - return std::tuple { getWrap(MayaAttrs::file::wrapU, MayaAttrs::file::mirrorU), - getWrap(MayaAttrs::file::wrapV, MayaAttrs::file::mirrorV) }; -} - -HdTextureResourceSharedPtr -GetFileTextureResource(const MObject& fileObj, const TfToken& filePath, int maxTextureMemory) -{ - if (filePath.IsEmpty()) { - return {}; - } - auto textureType = HdTextureType::Uv; - if (GlfIsSupportedUdimTexture(filePath)) { - textureType = HdTextureType::Udim; - } - if (textureType != HdTextureType::Udim && !TfPathExists(filePath)) { - return {}; - } - // TODO: handle origin - const auto origin = GlfImage::OriginLowerLeft; - GlfTextureHandleRefPtr texture = nullptr; - if (textureType == HdTextureType::Udim) { - UdimTextureFactory factory; - texture = GlfTextureRegistry::GetInstance().GetTextureHandle(filePath, origin, &factory); - } else { - texture = GlfTextureRegistry::GetInstance().GetTextureHandle(filePath, origin); - } - - const auto wrapping = GetFileTextureWrappingParams(fileObj); - - // We can't really mimic texture wrapping and mirroring settings - // from the uv placement node, so we don't touch those for now. - return HdTextureResourceSharedPtr(new HdStSimpleTextureResource( - texture, - textureType, - std::get<0>(wrapping), - std::get<1>(wrapping), - HdWrapClamp, - HdMinFilterLinearMipmapLinear, - HdMagFilterLinear, - maxTextureMemory)); -} - -#endif // PXR_VERSION < 2011 - PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/usd/hdMaya/utils.h b/lib/usd/hdMaya/utils.h index d9032ebb3e..8b830bc613 100644 --- a/lib/usd/hdMaya/utils.h +++ b/lib/usd/hdMaya/utils.h @@ -37,13 +37,6 @@ #include #include -#if PXR_VERSION < 2011 -#include -#include - -#include -#endif // PXR_VERSION < 2011 - PXR_NAMESPACE_OPEN_SCOPE /// \brief Converts a Maya matrix to a double precision GfMatrix. @@ -96,31 +89,6 @@ MObject GetConnectedFileNode(const MFnDependencyNode& node, const TfToken& param HDMAYA_API TfToken GetFileTexturePath(const MFnDependencyNode& fileNode); -#if PXR_VERSION < 2011 - -/// \brief Returns the texture resource from a "file" shader node. -/// \param fileObj "file" shader object. -/// \param filePath Path to the texture file held by "file" shader node. -/// \param maxTextureMemory Maximum texture memory in bytes available for -/// loading the texture. If the texture requires more memory -/// than \p maxTextureMemory, higher mip-map levels are discarded until the -/// memory required is less than \p maxTextureMemory. -/// \return Pointer to the Hydra Texture resource. -HDMAYA_API -HdTextureResourceSharedPtr GetFileTextureResource( - const MObject& fileObj, - const TfToken& filePath, - int maxTextureMemory = 4 * 1024 * 1024); - -/// \brief Returns the texture wrapping parameters from a "file" shader node. -/// \param fileObj "file" shader object. -/// \return A `std::tuple` holding the wrapping parameters -/// for s and t axis. -HDMAYA_API -std::tuple GetFileTextureWrappingParams(const MObject& fileObj); - -#endif // PXR_VERSION < 2011 - /// \brief Runs a function on all recursive descendents of a selection list /// May optionally filter by node type. The items in the list are also included /// in the set of items that are iterated over (assuming they pass the filter). diff --git a/lib/usd/translators/lightRfMWriter.cpp b/lib/usd/translators/lightRfMWriter.cpp index a18b125012..35ac03b6d3 100644 --- a/lib/usd/translators/lightRfMWriter.cpp +++ b/lib/usd/translators/lightRfMWriter.cpp @@ -54,14 +54,7 @@ PXRUSDMAYA_DEFINE_WRITER(PxrRectLight, args, context) return UsdMayaTranslatorRfMLight::Write(args, context); } -#if PXR_VERSION < 2111 -PXRUSDMAYA_DEFINE_WRITER(PxrMeshLight, args, context) -{ - return UsdMayaTranslatorRfMLight::Write(args, context); -} -#else // see lightRfMWriter_PxrMeshLight.cpp for PxrMeshLight. -#endif PXRUSDMAYA_DEFINE_WRITER(PxrSphereLight, args, context) { diff --git a/lib/usd/translators/lightWriter.cpp b/lib/usd/translators/lightWriter.cpp index b6c49a3511..ca6bacba5b 100644 --- a/lib/usd/translators/lightWriter.cpp +++ b/lib/usd/translators/lightWriter.cpp @@ -20,11 +20,7 @@ #include #include -#if PXR_VERSION < 2111 -#include -#else #include -#endif #include #include @@ -73,12 +69,8 @@ void PxrUsdTranslators_DirectionalLightWriter::Write(const UsdTimeCode& usdTime) } // First write the base light attributes -#if PXR_VERSION < 2111 - UsdMayaTranslatorLight::WriteLightAttrs(usdTime, primSchema, lightFn, _GetSparseValueWriter()); -#else UsdMayaTranslatorLight::WriteLightAttrs( usdTime, primSchema.LightAPI(), lightFn, _GetSparseValueWriter()); -#endif // Then write the specialized attributes for directional lights UsdMayaTranslatorLight::WriteDirectionalLightAttrs( usdTime, primSchema, lightFn, _GetSparseValueWriter()); @@ -126,12 +118,8 @@ void PxrUsdTranslators_PointLightWriter::Write(const UsdTimeCode& usdTime) } // First write the base light attributes -#if PXR_VERSION < 2111 - UsdMayaTranslatorLight::WriteLightAttrs(usdTime, primSchema, lightFn, _GetSparseValueWriter()); -#else UsdMayaTranslatorLight::WriteLightAttrs( usdTime, primSchema.LightAPI(), lightFn, _GetSparseValueWriter()); -#endif // Then write the specialized attributes for point lights UsdMayaTranslatorLight::WritePointLightAttrs( usdTime, primSchema, lightFn, _GetSparseValueWriter()); @@ -178,12 +166,8 @@ void PxrUsdTranslators_SpotLightWriter::Write(const UsdTimeCode& usdTime) return; } // First write the base light attributes -#if PXR_VERSION < 2111 - UsdMayaTranslatorLight::WriteLightAttrs(usdTime, primSchema, lightFn, _GetSparseValueWriter()); -#else UsdMayaTranslatorLight::WriteLightAttrs( usdTime, primSchema.LightAPI(), lightFn, _GetSparseValueWriter()); -#endif // Then write the specialized attributes for spot lights UsdMayaTranslatorLight::WriteSpotLightAttrs( usdTime, primSchema, lightFn, _GetSparseValueWriter()); @@ -231,12 +215,8 @@ void PxrUsdTranslators_AreaLightWriter::Write(const UsdTimeCode& usdTime) } // First write the base light attributes -#if PXR_VERSION < 2111 - UsdMayaTranslatorLight::WriteLightAttrs(usdTime, primSchema, lightFn, _GetSparseValueWriter()); -#else UsdMayaTranslatorLight::WriteLightAttrs( usdTime, primSchema.LightAPI(), lightFn, _GetSparseValueWriter()); -#endif // Then write the specialized attributes for spot lights UsdMayaTranslatorLight::WriteAreaLightAttrs( usdTime, primSchema, lightFn, _GetSparseValueWriter()); diff --git a/lib/usdUfe/ufe/UsdSceneItem.cpp b/lib/usdUfe/ufe/UsdSceneItem.cpp index a480231528..9cc08370dc 100644 --- a/lib/usdUfe/ufe/UsdSceneItem.cpp +++ b/lib/usdUfe/ufe/UsdSceneItem.cpp @@ -17,11 +17,7 @@ #include #include -#if PXR_VERSION < 2008 -#include -#else #include -#endif #include PXR_NAMESPACE_USING_DIRECTIVE @@ -55,13 +51,8 @@ std::vector UsdSceneItem::ancestorNodeTypes() const if (!fPrim) return strAncestorTypes; -#if PXR_VERSION < 2008 - static const TfType schemaBaseType = TfType::Find(); - const TfType schemaType = schemaBaseType.FindDerivedByName(fPrim.GetTypeName().GetString()); -#else // Get the actual schema type from the prim definition. const TfType& schemaType = fPrim.GetPrimTypeInfo().GetSchemaType(); -#endif if (!schemaType) { // No schema type, return empty ancestor types. return strAncestorTypes; diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h index cd1ebfe402..7ab524edfb 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/PluginRegister.h @@ -14,12 +14,8 @@ // limitations under the License. // #pragma once -#include -#if PXR_VERSION < 2102 -#include -#else + #include -#endif #include "AL/maya/utils/CommandGuiHelper.h" #include "AL/maya/utils/MenuBuilder.h" @@ -174,11 +170,7 @@ global proc AL_usdmaya_meshAnimImport() //---------------------------------------------------------------------------------------------------------------------- template MStatus registerPlugin(AFnPlugin& plugin) { -#if PXR_VERSION < 2102 - GlfGlewInit(); -#else GarchGLApiLoad(); -#endif // We may be in a non-gui maya... if so, // GlfContextCaps::InitInstance() will error diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp index 1400aee449..f0f304e1f4 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp @@ -155,13 +155,8 @@ void Import::doImport() for (; !it.done(); it.next()) { const UsdPrim& prim = it.prim(); if (prim.IsInstance()) { - UsdPrim prototypePrim = -#if PXR_VERSION < 2011 - prim.GetMaster(); -#else - prim.GetPrototype(); -#endif - auto iter = prototypeMap.find(prototypePrim.GetPath()); + UsdPrim prototypePrim = prim.GetPrototype(); + auto iter = prototypeMap.find(prototypePrim.GetPath()); if (iter == prototypeMap.end()) { MObject mayaObject = createParentTransform(prim, it, manufacture); MFnDagNode fnInstance(mayaObject); @@ -235,11 +230,7 @@ MObject Import::createShape( bool parentUnmerged) { MObject shapeObj; -#if PXR_VERSION < 2011 - if (prim.IsInMaster()) { -#else if (prim.IsInPrototype()) { -#endif const SdfPath& primPath = prim.GetPrimPath(); if (m_instanceObjects.find(primPath) != m_instanceObjects.end()) { shapeObj = m_instanceObjects[primPath]; diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/TransformIterator.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/TransformIterator.cpp index d59217c5b2..412dcf2e72 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/TransformIterator.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/TransformIterator.cpp @@ -100,12 +100,7 @@ bool TransformIterator::next() StackRef& r = *(m_primStack.end() - 1); if (r.m_prim.IsInstance() && !m_stopOnInstance) { if (!m_stopOnInstance) { - UsdPrim prototype = -#if PXR_VERSION < 2011 - r.m_prim.GetMaster(); -#else - r.m_prim.GetPrototype(); -#endif + UsdPrim prototype = r.m_prim.GetPrototype(); m_primStack.push_back(StackRef(prototype)); m_visitedPrototypePrimPaths.insert(prototype.GetPath()); StackRef& p = *(m_primStack.end() - 2); @@ -184,11 +179,7 @@ UsdPrim TransformIterator::parentPrim() const UsdPrim parentPrim = m_stage->GetPseudoRoot(); if (m_primStack.size() > 1) { parentPrim = (m_primStack.end() - 2)->m_prim; -#if PXR_VERSION < 2011 - if (parentPrim.IsMaster()) { -#else if (parentPrim.IsPrototype()) { -#endif if (m_primStack.size() > 2) { parentPrim = (m_primStack.end() - 3)->m_prim; } diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_import_instancing.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_import_instancing.cpp index 7e83f4a6f3..fa95e16642 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_import_instancing.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_import_instancing.cpp @@ -71,11 +71,7 @@ TEST(export_import_instancing, usd_instancing_roundtrip) usdXform.GetLocalTransformation(&usdTransform, &resetsXformStack); EXPECT_DOUBLE_EQ(usdTransform[3][0], 5.0); -#if PXR_VERSION < 2011 - UsdPrim prototypePrim = prim.GetMaster(); -#else UsdPrim prototypePrim = prim.GetPrototype(); -#endif EXPECT_TRUE(prototypePrim.IsValid()); UsdPrim prototypePrimChild = prototypePrim.GetChild(TfToken("pSphereShape1")); EXPECT_TRUE(prototypePrimChild.IsValid() && prototypePrimChild.IsA()); From 0ea25de47be45a1c0ff64248745963c1ea94b7cb Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 26 May 2023 15:32:17 -0400 Subject: [PATCH 3/3] MAYA-129258 - MayaUsd: remove support for USD < v21.11 * USD version is always at least 21.11 now. --- .../fileio/shading/shadingModeUseRegistry.cpp | 13 -- lib/mayaUsd/fileio/utils/meshWriteUtils.cpp | 5 - lib/mayaUsd/fileio/utils/shadingUtil.cpp | 80 +---------- lib/mayaUsd/fileio/utils/writeUtil.cpp | 2 - lib/mayaUsd/fileio/writeJobContext.cpp | 4 - .../render/mayaToHydra/renderGlobals.cpp | 11 +- .../render/mayaToHydra/renderGlobals.h | 4 +- .../render/mayaToHydra/renderOverride.cpp | 18 +-- .../render/pxrUsdMayaGL/batchRenderer.cpp | 4 - .../render/pxrUsdMayaGL/sceneDelegate.cpp | 8 -- .../render/vp2RenderDelegate/material.cpp | 136 +----------------- .../render/vp2RenderDelegate/material.h | 2 +- lib/mayaUsd/ufe/StagesSubject.cpp | 14 +- lib/mayaUsd/ufe/UsdContextOps.cpp | 46 +----- lib/mayaUsd/ufe/UsdContextOps.h | 4 - .../ufe/UsdPointInstanceModifierBase.h | 6 +- .../hdMaya/adapters/aiSkydomeLightAdapter.cpp | 4 - lib/usd/hdMaya/adapters/cameraAdapter.cpp | 3 - lib/usd/hdMaya/adapters/spotLightAdapter.cpp | 12 -- lib/usd/schemas/ALMayaReference.cpp | 8 -- lib/usd/schemas/ALMayaReference.h | 15 -- lib/usd/schemas/MayaReference.cpp | 8 -- lib/usd/schemas/MayaReference.h | 15 -- .../shading/usdUVTextureReader.cpp | 5 - lib/usd/translators/skelReader.cpp | 10 -- lib/usdUfe/ufe/UsdSceneItem.cpp | 11 -- lib/usdUfe/utils/usdUtils.cpp | 9 +- .../AL/usdmaya/fileio/export_misc.cpp | 6 - .../AL/usd/schemas/maya/FrameRange.cpp | 5 - .../schemas/AL/usd/schemas/maya/FrameRange.h | 15 -- .../schemas/AL/usd/schemas/maya/ModelAPI.cpp | 5 - .../al/schemas/AL/usd/schemas/maya/ModelAPI.h | 15 -- .../schemas/mayatest/ExamplePolyCubeNode.h | 15 -- 33 files changed, 16 insertions(+), 502 deletions(-) diff --git a/lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp b/lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp index d4d3ab5bea..ae6ea4ead5 100644 --- a/lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp +++ b/lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp @@ -446,11 +446,7 @@ class UseRegistryShadingModeImporter // renderContext is not found. Therefore we need to test first that the // render context output we are looking for really exists: if (shadeMaterial.GetSurfaceOutput(renderContext)) { -#if PXR_VERSION > 2105 UsdShadeShader surfaceShader = shadeMaterial.ComputeSurfaceSource({ renderContext }); -#else - UsdShadeShader surfaceShader = shadeMaterial.ComputeSurfaceSource(renderContext); -#endif if (surfaceShader) { const TfToken surfaceShaderPlugName = _context->GetSurfaceShaderPlugName(); if (!surfaceShaderPlugName.IsEmpty()) { @@ -460,11 +456,7 @@ class UseRegistryShadingModeImporter } if (shadeMaterial.GetVolumeOutput(renderContext)) { -#if PXR_VERSION > 2105 UsdShadeShader volumeShader = shadeMaterial.ComputeVolumeSource({ renderContext }); -#else - UsdShadeShader volumeShader = shadeMaterial.ComputeVolumeSource(renderContext); -#endif if (volumeShader) { const TfToken volumeShaderPlugName = _context->GetVolumeShaderPlugName(); if (!volumeShaderPlugName.IsEmpty()) { @@ -474,13 +466,8 @@ class UseRegistryShadingModeImporter } if (shadeMaterial.GetDisplacementOutput(renderContext)) { -#if PXR_VERSION > 2105 UsdShadeShader displacementShader = shadeMaterial.ComputeDisplacementSource({ renderContext }); -#else - UsdShadeShader displacementShader - = shadeMaterial.ComputeDisplacementSource(renderContext); -#endif if (displacementShader) { const TfToken displacementShaderPlugName = _context->GetDisplacementShaderPlugName(); diff --git a/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp b/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp index 4e3f6cff1a..d7f9e2039c 100644 --- a/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp +++ b/lib/mayaUsd/fileio/utils/meshWriteUtils.cpp @@ -901,12 +901,7 @@ bool UsdMayaMeshWriteUtils::getMeshUVSetData( uvArray->clear(); uvArray->reserve(static_cast(uArray.length())); for (unsigned int uvId = 0u; uvId < uArray.length(); ++uvId) { -#if PXR_VERSION >= 2011 uvArray->emplace_back(uArray[uvId], vArray[uvId]); -#else - GfVec2f value(uArray[uvId], vArray[uvId]); - uvArray->push_back(value); -#endif } // Now iterate through all the face vertices and fill in the faceVarying diff --git a/lib/mayaUsd/fileio/utils/shadingUtil.cpp b/lib/mayaUsd/fileio/utils/shadingUtil.cpp index 4ca728920c..477cacc074 100644 --- a/lib/mayaUsd/fileio/utils/shadingUtil.cpp +++ b/lib/mayaUsd/fileio/utils/shadingUtil.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -30,12 +31,6 @@ #include #include -#if PXR_VERSION >= 2102 -#include -#else -#include -#endif - #include #include @@ -269,7 +264,6 @@ void UsdMayaShadingUtil::ResolveUsdTextureFileName( } } -#if PXR_VERSION >= 2102 int UsdMayaShadingUtil::GetNumberOfChannels(const std::string& fileTextureName) { // Using Hio because the Maya texture node does not provide the information: @@ -283,75 +277,3 @@ int UsdMayaShadingUtil::GetNumberOfChannels(const std::string& fileTextureName) return HioGetComponentCount(imageFormat); } -#elif PXR_VERSION >= 2011 -int UsdMayaShadingUtil::GetNumberOfChannels(const std::string& fileTextureName) -{ - GlfImageSharedPtr image = GlfImage::OpenForReading(fileTextureName.c_str()); - - if (!image) { - return 4; - } - - // Inlined HioGetComponentCount from USD 21.02: - switch (image->GetHioFormat()) { - case HioFormatUNorm8: - case HioFormatSNorm8: - case HioFormatFloat16: - case HioFormatFloat32: - case HioFormatDouble64: - case HioFormatUInt16: - case HioFormatInt16: - case HioFormatUInt32: - case HioFormatInt32: - case HioFormatUNorm8srgb: return 1; - case HioFormatUNorm8Vec2: - case HioFormatSNorm8Vec2: - case HioFormatFloat16Vec2: - case HioFormatFloat32Vec2: - case HioFormatDouble64Vec2: - case HioFormatUInt16Vec2: - case HioFormatInt16Vec2: - case HioFormatUInt32Vec2: - case HioFormatInt32Vec2: - case HioFormatUNorm8Vec2srgb: return 2; - case HioFormatUNorm8Vec3: - case HioFormatSNorm8Vec3: - case HioFormatFloat16Vec3: - case HioFormatFloat32Vec3: - case HioFormatDouble64Vec3: - case HioFormatUInt16Vec3: - case HioFormatInt16Vec3: - case HioFormatUInt32Vec3: - case HioFormatInt32Vec3: - case HioFormatUNorm8Vec3srgb: - case HioFormatBC6FloatVec3: - case HioFormatBC6UFloatVec3: return 3; - default: return 4; - } -} -#else // 20.08 -// Not including the OpenGL headers just for 3 constants, especially since this code -// is going to be retired soon. - -// From glcorearb.h: -#define GL_RED 0x1903 -#define GL_RG 0x8227 -#define GL_RGB 0x1907 - -int UsdMayaShadingUtil::GetNumberOfChannels(const std::string& fileTextureName) -{ - // Using Glf because the Maya texture node does not provide the information: - GlfImageSharedPtr image = GlfImage::OpenForReading(fileTextureName.c_str()); - - if (!image) { - return 4; - } - - switch (image->GetFormat()) { - case GL_RED: return 1; - case GL_RG: return 2; - case GL_RGB: return 3; - default: return 4; - } -} -#endif diff --git a/lib/mayaUsd/fileio/utils/writeUtil.cpp b/lib/mayaUsd/fileio/utils/writeUtil.cpp index 82f2869839..d80f224d38 100644 --- a/lib/mayaUsd/fileio/utils/writeUtil.cpp +++ b/lib/mayaUsd/fileio/utils/writeUtil.cpp @@ -805,9 +805,7 @@ bool UsdMayaWriteUtil::WriteAPISchemaAttributesToPrim( for (const TfToken& schemaName : adaptor.GetAppliedSchemas()) { if (const UsdMayaSchemaAdaptorPtr schemaAdaptor = adaptor.GetSchemaByName(schemaName)) { -#if PXR_VERSION > 2005 prim.AddAppliedSchema(schemaName); -#endif if (schemaAdaptor->CopyToPrim(prim, usdTime, valueWriter)) { continue; } diff --git a/lib/mayaUsd/fileio/writeJobContext.cpp b/lib/mayaUsd/fileio/writeJobContext.cpp index e44b8a5e57..626b6feda5 100644 --- a/lib/mayaUsd/fileio/writeJobContext.cpp +++ b/lib/mayaUsd/fileio/writeJobContext.cpp @@ -416,11 +416,7 @@ bool UsdMayaWriteJobContext::_OpenFile(const std::string& filename, bool append) } else { SdfLayer::FileFormatArguments args; args[UsdUsdFileFormatTokens->FormatArg] = mArgs.defaultUSDFormat.GetString(); -#if PXR_VERSION > 2008 layer = SdfLayer::CreateNew(filename, args); -#else - layer = SdfLayer::CreateNew(filename, "", args); -#endif } if (!layer) { TF_RUNTIME_ERROR("Failed to create layer '%s'", filename.c_str()); diff --git a/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp b/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp index 423ac929dd..2b4860b0e0 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderGlobals.cpp @@ -81,13 +81,7 @@ global proc mtohRenderOverride_AddMTOHAttributes(int $fromAE) { mtohRenderOverride_AddAttribute("mtoh", "Show Wireframe on Selected Objects", "mtohWireframeSelectionHighlight", $fromAE); mtohRenderOverride_AddAttribute("mtoh", "Highlight Selected Objects", "mtohColorSelectionHighlight", $fromAE); mtohRenderOverride_AddAttribute("mtoh", "Highlight Color for Selected Objects", "mtohColorSelectionHighlightColor", $fromAE); -)mel" -#if PXR_VERSION >= 2005 - R"mel( mtohRenderOverride_AddAttribute("mtoh", "Highlight outline (in pixels, 0 to disable)", "mtohSelectionOutline", $fromAE); -)mel" -#endif - R"mel( } global proc mtohRenderOverride_AEAttributesCallback(string $nodeName) { @@ -884,12 +878,11 @@ MObject MtohRenderGlobals::CreateAttributes(const GlobalParams& params) return mayaObject; } } -#if PXR_VERSION >= 2005 if (filter(_tokens->mtohSelectionOutline)) { _CreateFloatAttribute( node, filter.mayaString(), defGlobals.outlineSelectionWidth, userDefaults); } -#endif + // TODO: Move this to an external function and add support for more types, // and improve code quality/reuse. for (const auto& rit : MtohGetRendererSettings()) { @@ -1068,14 +1061,12 @@ MtohRenderGlobals::GetInstance(const GlobalParams& params, bool storeUserSetting return globals; } } -#if PXR_VERSION >= 2005 if (filter(_tokens->mtohSelectionOutline)) { _GetAttribute(node, filter.mayaString(), globals.outlineSelectionWidth, storeUserSetting); if (filter.attributeFilter()) { return globals; } } -#endif // TODO: Move this to an external function and add support for more types, // and improve code quality/reuse. diff --git a/lib/mayaUsd/render/mayaToHydra/renderGlobals.h b/lib/mayaUsd/render/mayaToHydra/renderGlobals.h index 5d6c61c836..e76578fd4b 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderGlobals.h +++ b/lib/mayaUsd/render/mayaToHydra/renderGlobals.h @@ -97,9 +97,7 @@ class MtohRenderGlobals GfVec4f colorSelectionHighlightColor = GfVec4f(1.0f, 1.0f, 0.0f, 0.5f); bool colorSelectionHighlight = true; bool wireframeSelectionHighlight = true; -#if PXR_VERSION >= 2005 - float outlineSelectionWidth = 4.f; -#endif + float outlineSelectionWidth = 4.f; }; PXR_NAMESPACE_CLOSE_SCOPE diff --git a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp index 87cb869c86..5213914180 100644 --- a/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp +++ b/lib/mayaUsd/render/mayaToHydra/renderOverride.cpp @@ -200,11 +200,7 @@ MtohRenderOverride::MtohRenderOverride(const MtohRendererDescription& desc) : MHWRender::MRenderOverride(desc.overrideName.GetText()) , _rendererDesc(desc) , _globals(MtohRenderGlobals::GetInstance()) -#if PXR_VERSION > 2005 , _hgi(Hgi::CreatePlatformDefaultHgi()) -#else - , _hgi(Hgi::GetPlatformDefaultHgi()) -#endif , _hgiDriver { HgiTokens->renderDriver, VtValue(_hgi.get()) } , _selectionTracker(new HdxSelectionTracker) , _isUsingHdSt(desc.rendererName == MtohTokens->HdStormRendererPlugin) @@ -480,14 +476,9 @@ MStatus MtohRenderOverride::Render(const MHWRender::MDrawContext& drawContext) // if (_playBlasting && !_isUsingHdSt && !tasks.empty()) { // XXX: Is this better as user-configurable ? - constexpr auto msWait = std::chrono::duration(100); -#if PXR_VERSION >= 2005 + constexpr auto msWait = std::chrono::duration(100); std::shared_ptr renderTask = std::dynamic_pointer_cast(tasks.front()); -#else - boost::shared_ptr renderTask - = boost::dynamic_pointer_cast(tasks.front()); -#endif if (renderTask) { HdTaskSharedPtrVector renderOnly = { renderTask }; _engine.Execute(_renderIndex, &renderOnly); @@ -650,13 +641,11 @@ MStatus MtohRenderOverride::Render(const MHWRender::MDrawContext& drawContext) _taskController->SetSelectionColor(_globals.colorSelectionHighlightColor); _taskController->SetEnableSelection(_globals.colorSelectionHighlight); -#if PXR_VERSION >= 2005 if (_globals.outlineSelectionWidth != 0.f) { _taskController->SetSelectionOutlineRadius(_globals.outlineSelectionWidth); _taskController->SetSelectionEnableOutline(true); } else _taskController->SetSelectionEnableOutline(false); -#endif _taskController->SetCollection(_renderCollection); if (_isUsingHdSt) { // TODO: Is there a way to improve this? Quite silly. @@ -825,12 +814,7 @@ void MtohRenderOverride::ClearHydraResources() // Cleanup internal context data that keep references to data that is now // invalid. -#if PXR_VERSION >= 2108 _engine.ClearTaskContextData(); -#else - for (const auto& token : HdxTokens->allTokens) - _engine.RemoveTaskContextData(token); -#endif if (_taskController != nullptr) { delete _taskController; diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp index cea0a4f564..db0dac0870 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp +++ b/lib/mayaUsd/render/pxrUsdMayaGL/batchRenderer.cpp @@ -386,11 +386,7 @@ UsdMayaGLBatchRenderer::UsdMayaGLBatchRenderer() , _objectSoftSelectEnabled(false) , _softSelectOptionsCallbackId(0) , _selectResultsKey(GfMatrix4d(0.0), GfMatrix4d(0.0), false) -#if PXR_VERSION > 2005 , _hgi(Hgi::CreatePlatformDefaultHgi()) -#else - , _hgi(Hgi::GetPlatformDefaultHgi()) -#endif , _hgiDriver { HgiTokens->renderDriver, VtValue(_hgi.get()) } , _selectionResolution(256) , _enableDepthSelection(false) diff --git a/lib/mayaUsd/render/pxrUsdMayaGL/sceneDelegate.cpp b/lib/mayaUsd/render/pxrUsdMayaGL/sceneDelegate.cpp index 739aed41c4..0f1d4c5782 100644 --- a/lib/mayaUsd/render/pxrUsdMayaGL/sceneDelegate.cpp +++ b/lib/mayaUsd/render/pxrUsdMayaGL/sceneDelegate.cpp @@ -153,9 +153,7 @@ PxrMayaHdSceneDelegate::PxrMayaHdSceneDelegate( cache[HdCameraTokens->worldToViewMatrix] = VtValue(GfMatrix4d(1.0)); cache[HdCameraTokens->projectionMatrix] = VtValue(GfMatrix4d(1.0)); -#if PXR_VERSION >= 2102 cache[HdCameraTokens->projection] = VtValue(); -#endif cache[HdCameraTokens->horizontalAperture] = VtValue(); cache[HdCameraTokens->verticalAperture] = VtValue(); cache[HdCameraTokens->horizontalApertureOffset] = VtValue(); @@ -168,9 +166,7 @@ PxrMayaHdSceneDelegate::PxrMayaHdSceneDelegate( cache[HdCameraTokens->focusDistance] = VtValue(); cache[HdCameraTokens->shutterOpen] = VtValue(); cache[HdCameraTokens->shutterClose] = VtValue(); -#if PXR_VERSION >= 2011 cache[HdCameraTokens->exposure] = VtValue(); -#endif } // Simple lighting task. @@ -308,9 +304,7 @@ void PxrMayaHdSceneDelegate::SetCameraState( cache[HdTokens->transform] = VtValue(worldToViewMatrix.GetInverse()); cache[HdCameraTokens->worldToViewMatrix] = VtValue(worldToViewMatrix); cache[HdCameraTokens->projectionMatrix] = VtValue(projectionMatrix); -#if PXR_VERSION >= 2102 cache[HdCameraTokens->projection] = VtValue(); -#endif cache[HdCameraTokens->horizontalAperture] = VtValue(); cache[HdCameraTokens->verticalAperture] = VtValue(); cache[HdCameraTokens->horizontalApertureOffset] = VtValue(); @@ -324,9 +318,7 @@ void PxrMayaHdSceneDelegate::SetCameraState( cache[HdCameraTokens->focusDistance] = VtValue(); cache[HdCameraTokens->shutterOpen] = VtValue(); cache[HdCameraTokens->shutterClose] = VtValue(); -#if PXR_VERSION >= 2011 cache[HdCameraTokens->exposure] = VtValue(); -#endif // invalidate the camera to be synced GetRenderIndex().GetChangeTracker().MarkSprimDirty(_cameraId, HdCamera::AllDirty); diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp index ff6a886758..f7c7e31f96 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/material.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/material.cpp @@ -74,6 +74,9 @@ #include #endif +#include +#include + #include #include @@ -83,18 +86,6 @@ #include #include -#if PXR_VERSION >= 2102 -#include -#else -#include -#endif - -#if PXR_VERSION >= 2102 -#include -#else -#include -#endif - #ifdef WANT_MATERIALX_BUILD namespace mx = MaterialX; #endif @@ -1237,13 +1228,8 @@ _LoadUdimTexture(const std::string& path, bool& isColorSpaceSRGB, MFloatArray& u */ // test for a UDIM texture -#if PXR_VERSION >= 2102 if (!HdStIsSupportedUdimTexture(path)) return nullptr; -#else - if (!GlfIsSupportedUdimTexture(path)) - return nullptr; -#endif /* Maya's tiled texture support is implemented quite differently from Usd's UDIM support. @@ -1286,11 +1272,7 @@ _LoadUdimTexture(const std::string& path, bool& isColorSpaceSRGB, MFloatArray& u // resolution, warn the user if Maya's tiled texture implementation is going to result in // a loss of texture data. { -#if PXR_VERSION >= 2102 HioImageSharedPtr image = HioImage::OpenForReading(std::get<1>(tiles[0]).GetString()); -#else - GlfImageSharedPtr image = GlfImage::OpenForReading(std::get<1>(tiles[0]).GetString()); -#endif if (!TF_VERIFY(image)) { return nullptr; } @@ -1315,11 +1297,7 @@ _LoadUdimTexture(const std::string& path, bool& isColorSpaceSRGB, MFloatArray& u for (auto& tile : tiles) { tilePaths.append(MString(std::get<1>(tile).GetText())); -#if PXR_VERSION >= 2102 HioImageSharedPtr image = HioImage::OpenForReading(std::get<1>(tile).GetString()); -#else - GlfImageSharedPtr image = GlfImage::OpenForReading(std::get<1>(tile).GetString()); -#endif if (!TF_VERIFY(image)) { return nullptr; } @@ -1396,13 +1374,8 @@ MHWRender::MTexture* _LoadTexture( HdVP2RenderDelegate::sProfilerCategory, MProfiler::kColorD_L2, "LoadTexture", path.c_str()); // If it is a UDIM texture we need to modify the path before calling OpenForReading -#if PXR_VERSION >= 2102 if (HdStIsSupportedUdimTexture(path)) return _LoadUdimTexture(path, isColorSpaceSRGB, uvScaleOffset); -#else - if (GlfIsSupportedUdimTexture(path)) - return _LoadUdimTexture(path, isColorSpaceSRGB, uvScaleOffset); -#endif MHWRender::MRenderer* const renderer = MHWRender::MRenderer::theRenderer(); MHWRender::MTextureManager* const textureMgr @@ -1416,12 +1389,7 @@ MHWRender::MTexture* _LoadTexture( return texture; } -#if PXR_VERSION >= 2102 HioImageSharedPtr image = HioImage::OpenForReading(path); -#else - GlfImageSharedPtr image = GlfImage::OpenForReading(path); -#endif - if (!TF_VERIFY(image, "Unable to create an image from %s", path.c_str())) { if (!hasFallbackColor) { return nullptr; @@ -1433,22 +1401,11 @@ MHWRender::MTexture* _LoadTexture( // This image is used for loading pixel data from usdz only and should // not trigger any OpenGL call. VP2RenderDelegate will transfer the // texels to GPU memory with VP2 API which is 3D API agnostic. -#if PXR_VERSION >= 2102 HioImage::StorageSpec spec; -#else - GlfImage::StorageSpec spec; -#endif spec.width = image->GetWidth(); spec.height = image->GetHeight(); spec.depth = 1; -#if PXR_VERSION >= 2102 - spec.format = image->GetFormat(); -#elif PXR_VERSION > 2008 - spec.hioFormat = image->GetHioFormat(); -#else spec.format = image->GetFormat(); - spec.type = image->GetType(); -#endif spec.flipped = false; const int bpp = image->GetBytesPerPixel(); @@ -1469,12 +1426,7 @@ MHWRender::MTexture* _LoadTexture( desc.fBytesPerRow = bytesPerRow; desc.fBytesPerSlice = bytesPerSlice; -#if PXR_VERSION > 2008 -#if PXR_VERSION >= 2102 auto specFormat = spec.format; -#else - auto specFormat = spec.hioFormat; -#endif switch (specFormat) { // Single Channel case HioFormatFloat32: { @@ -1710,88 +1662,6 @@ MHWRender::MTexture* _LoadTexture( path.c_str()); break; } -#else - switch (spec.format) { - case GL_RED: - desc.fFormat = MHWRender::kR8_UNORM; - if (spec.type == GL_FLOAT) - desc.fFormat = MHWRender::kR32_FLOAT; - else if (spec.type == GL_HALF_FLOAT) - desc.fFormat = MHWRender::kR16_FLOAT; - texture = textureMgr->acquireTexture(path.c_str(), desc, spec.data); - break; - case GL_RGB: - if (spec.type == GL_FLOAT) { - desc.fFormat = MHWRender::kR32G32B32_FLOAT; - texture = textureMgr->acquireTexture(path.c_str(), desc, spec.data); - } else if (spec.type == GL_HALF_FLOAT) { - // R16G16B16 is not supported by VP2. Converted to R16G16B16A16. - constexpr int bpp_8 = 8; - - desc.fFormat = MHWRender::kR16G16B16A16_FLOAT; - desc.fBytesPerRow = spec.width * bpp_8; - desc.fBytesPerSlice = desc.fBytesPerRow * spec.height; - - GfHalf opaqueAlpha(1.0f); - const unsigned short alphaBits = opaqueAlpha.bits(); - const unsigned char lowAlpha = reinterpret_cast(&alphaBits)[0]; - const unsigned char highAlpha = reinterpret_cast(&alphaBits)[1]; - - std::vector texels(desc.fBytesPerSlice); - - for (int y = 0; y < spec.height; y++) { - for (int x = 0; x < spec.width; x++) { - const int t = spec.width * y + x; - texels[t * bpp_8 + 0] = storage[t * bpp + 0]; - texels[t * bpp_8 + 1] = storage[t * bpp + 1]; - texels[t * bpp_8 + 2] = storage[t * bpp + 2]; - texels[t * bpp_8 + 3] = storage[t * bpp + 3]; - texels[t * bpp_8 + 4] = storage[t * bpp + 4]; - texels[t * bpp_8 + 5] = storage[t * bpp + 5]; - texels[t * bpp_8 + 6] = lowAlpha; - texels[t * bpp_8 + 7] = highAlpha; - } - } - - texture = textureMgr->acquireTexture(path.c_str(), desc, texels.data()); - } else { - // R8G8B8 is not supported by VP2. Converted to R8G8B8A8. - constexpr int bpp_4 = 4; - - desc.fFormat = MHWRender::kR8G8B8A8_UNORM; - desc.fBytesPerRow = spec.width * bpp_4; - desc.fBytesPerSlice = desc.fBytesPerRow * spec.height; - - std::vector texels(desc.fBytesPerSlice); - - for (int y = 0; y < spec.height; y++) { - for (int x = 0; x < spec.width; x++) { - const int t = spec.width * y + x; - texels[t * bpp_4] = storage[t * bpp]; - texels[t * bpp_4 + 1] = storage[t * bpp + 1]; - texels[t * bpp_4 + 2] = storage[t * bpp + 2]; - texels[t * bpp_4 + 3] = 255; - } - } - - texture = textureMgr->acquireTexture(path.c_str(), desc, texels.data()); - isColorSpaceSRGB = image->IsColorSpaceSRGB(); - } - break; - case GL_RGBA: - if (spec.type == GL_FLOAT) { - desc.fFormat = MHWRender::kR32G32B32A32_FLOAT; - } else if (spec.type == GL_HALF_FLOAT) { - desc.fFormat = MHWRender::kR16G16B16A16_FLOAT; - } else { - desc.fFormat = MHWRender::kR8G8B8A8_UNORM; - isColorSpaceSRGB = image->IsColorSpaceSRGB(); - } - texture = textureMgr->acquireTexture(path.c_str(), desc, spec.data); - break; - default: break; - } -#endif return texture; } diff --git a/lib/mayaUsd/render/vp2RenderDelegate/material.h b/lib/mayaUsd/render/vp2RenderDelegate/material.h index 9ecf3f5b59..40eba8c4be 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 PXR_VERSION >= 2011 && MAYA_API_VERSION >= 20210000 && MAYA_API_VERSION < 20230000 +#if MAYA_API_VERSION >= 20210000 && MAYA_API_VERSION < 20230000 #define HDVP2_MATERIAL_CONSOLIDATION_UPDATE_WORKAROUND #endif diff --git a/lib/mayaUsd/ufe/StagesSubject.cpp b/lib/mayaUsd/ufe/StagesSubject.cpp index 3859d58e73..f57daab0b2 100644 --- a/lib/mayaUsd/ufe/StagesSubject.cpp +++ b/lib/mayaUsd/ufe/StagesSubject.cpp @@ -739,20 +739,8 @@ void StagesSubject::stageChanged( // may have been affected, so we construct UFE paths for // every instance and issue a notification for each one. const UsdGeomPointInstancer pointInstancer(prim); - -#if PXR_VERSION >= 2011 - const size_t numInstances + const size_t numInstances = bool(pointInstancer) ? pointInstancer.GetInstanceCount() : 0u; -#else - VtIntArray protoIndices; - if (pointInstancer) { - const UsdAttribute protoIndicesAttr = pointInstancer.GetProtoIndicesAttr(); - if (protoIndicesAttr) { - protoIndicesAttr.Get(&protoIndices); - } - } - const size_t numInstances = protoIndices.size(); -#endif // The PointInstancer schema can theoretically support as // as many instances as can be addressed by size_t, but diff --git a/lib/mayaUsd/ufe/UsdContextOps.cpp b/lib/mayaUsd/ufe/UsdContextOps.cpp index 8f2ec27c5e..0a573f8d13 100644 --- a/lib/mayaUsd/ufe/UsdContextOps.cpp +++ b/lib/mayaUsd/ufe/UsdContextOps.cpp @@ -21,12 +21,10 @@ #include #include #endif -#if PXR_VERSION >= 2108 -#include -#endif #include #include #include +#include #include #include #include @@ -137,7 +135,6 @@ static constexpr char kDuplicateAsMayaLabel[] = "Duplicate As Maya Data"; static constexpr char kAddMayaReferenceItem[] = "Add Maya Reference"; static constexpr char kAddMayaReferenceLabel[] = "Add Maya Reference..."; #endif -#if PXR_VERSION >= 2108 static constexpr char kBindMaterialToSelectionItem[] = "Assign Material to Selection"; static constexpr char kBindMaterialToSelectionLabel[] = "Assign Material to Selection"; #ifdef UFE_V4_FEATURES_AVAILABLE @@ -148,9 +145,7 @@ static constexpr char kAddNewMaterialLabel[] = "Add New Material"; static constexpr char kAssignExistingMaterialItem[] = "Assign Existing Material"; static constexpr char kAssignExistingMaterialLabel[] = "Assign Existing Material"; #endif -#endif -#if PXR_VERSION >= 2008 static constexpr char kAllRegisteredTypesItem[] = "All Registered"; static constexpr char kAllRegisteredTypesLabel[] = "All Registered"; @@ -185,7 +180,6 @@ static const std::vector kSchemaNiceNames = { "", // Skip legacy AL schemas }; // clang-format on -#endif //! \brief Change the cursor to wait state on construction and restore it on destruction. struct WaitCursor @@ -596,13 +590,7 @@ _computeLoadAndUnloadItems(const UsdPrim& prim) { std::vector> itemLabelPairs; - const bool isInPrototype = -#if PXR_VERSION >= 2011 - prim.IsInPrototype(); -#else - prim.IsInMaster(); -#endif - + const bool isInPrototype = prim.IsInPrototype(); if (!prim.IsActive() || isInPrototype) { return itemLabelPairs; } @@ -663,7 +651,7 @@ _computeLoadAndUnloadItems(const UsdPrim& prim) return itemLabelPairs; } -#if PXR_VERSION >= 2008 + //! \brief Get groups of concrete schema prim types to list dynamically in the UI static const std::vector getConcretePrimTypes(bool sorted) { @@ -725,23 +713,12 @@ static const std::vector getConcretePrimTypes(boo return groups; } -#endif bool sceneItemSupportsShading(const Ufe::SceneItem::Ptr& sceneItem) { -#if PXR_VERSION >= 2108 if (MayaUsd::ufe::BindMaterialUndoableCommand::CompatiblePrim(sceneItem)) { return true; } -#else - auto usdItem = std::dynamic_pointer_cast(sceneItem); - if (!usdItem) { - return false; - } - if (PXR_NS::UsdShadeMaterialBindingAPI(usdItem->prim())) { - return true; - } -#endif return false; } @@ -777,9 +754,7 @@ void executeEditAsMaya(const Ufe::Path& path) namespace MAYAUSD_NS_DEF { namespace ufe { -#if PXR_VERSION >= 2008 std::vector UsdContextOps::schemaTypeGroups = {}; -#endif UsdContextOps::UsdContextOps(const UsdSceneItem::Ptr& item) : Ufe::ContextOps() @@ -809,12 +784,10 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& { Ufe::ContextOps::Items items; if (itemPath.empty()) { -#if PXR_VERSION >= 2108 if (fItem->prim().IsA() && selectionSupportsShading()) { items.emplace_back(kBindMaterialToSelectionItem, kBindMaterialToSelectionLabel); items.emplace_back(Ufe::ContextItem::kSeparator); } -#endif #ifdef WANT_QT_BUILD // Top-level item - USD Layer editor (for all context op types). // Only available when building with Qt enabled. @@ -884,7 +857,6 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& ClearAllReferencesUndoableCommand::commandName, ClearAllReferencesUndoableCommand::commandName); } -#if PXR_VERSION >= 2108 if (!fIsAGatewayType) { // Top level item - Bind/unbind existing materials bool materialSeparatorsAdded = false; @@ -945,7 +917,6 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& } #endif } -#endif } else { if (itemPath[0] == kUSDVariantSetsItem) { UsdVariantSets varSets = prim().GetVariantSets(); @@ -991,7 +962,6 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& items.emplace_back( kUSDCylinderPrimItem, kUSDCylinderPrimLabel, kUSDCylinderPrimImage); items.emplace_back(kUSDSpherePrimItem, kUSDSpherePrimLabel, kUSDSpherePrimImage); -#if PXR_VERSION >= 2008 items.emplace_back(Ufe::ContextItem::kSeparator); items.emplace_back( kAllRegisteredTypesItem, @@ -1023,11 +993,8 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& } } } -#endif - } // If USD >= 20.08, submenus end here. Otherwise end of Root Setup - } -#if PXR_VERSION >= 2108 - else if (itemPath[0] == BindMaterialUndoableCommand::commandName) { + } + } else if (itemPath[0] == BindMaterialUndoableCommand::commandName) { if (fItem) { auto prim = fItem->prim(); if (prim) { @@ -1137,7 +1104,6 @@ Ufe::ContextOps::Items UsdContextOps::getItems(const Ufe::ContextOps::ItemPath& } #endif } -#endif } // Top-level items return items; } @@ -1251,7 +1217,6 @@ Ufe::UndoableCommand::Ptr UsdContextOps::doOpCmd(const ItemPath& itemPath) script, /* display = */ false, /* undoable = */ true); } #endif -#if PXR_VERSION >= 2108 else if (itemPath[0] == BindMaterialUndoableCommand::commandName) { return std::make_shared(fItem->path(), SdfPath(itemPath[1])); } else if (itemPath[0] == kBindMaterialToSelectionItem) { @@ -1300,7 +1265,6 @@ Ufe::UndoableCommand::Ptr UsdContextOps::doOpCmd(const ItemPath& itemPath) return compositeCmd; #endif } -#endif return nullptr; } diff --git a/lib/mayaUsd/ufe/UsdContextOps.h b/lib/mayaUsd/ufe/UsdContextOps.h index f48fbff805..dd7ae33361 100644 --- a/lib/mayaUsd/ufe/UsdContextOps.h +++ b/lib/mayaUsd/ufe/UsdContextOps.h @@ -27,14 +27,12 @@ namespace MAYAUSD_NS_DEF { namespace ufe { -#if PXR_VERSION >= 2008 struct SchemaTypeGroup { std::string _name; PXR_NS::TfTokenVector _types; bool operator==(const std::string rhs) const { return _name == rhs; } }; -#endif //! \brief Interface for scene item context operations. /*! @@ -86,10 +84,8 @@ class MAYAUSD_CORE_PUBLIC UsdContextOps : public Ufe::ContextOps UsdSceneItem::Ptr fItem; bool fIsAGatewayType { false }; -#if PXR_VERSION >= 2008 // A cache to keep the dynamic listing of plugin types to a minimum static std::vector schemaTypeGroups; -#endif }; // UsdContextOps diff --git a/lib/mayaUsd/ufe/UsdPointInstanceModifierBase.h b/lib/mayaUsd/ufe/UsdPointInstanceModifierBase.h index 662562073e..098e44d27e 100644 --- a/lib/mayaUsd/ufe/UsdPointInstanceModifierBase.h +++ b/lib/mayaUsd/ufe/UsdPointInstanceModifierBase.h @@ -155,13 +155,9 @@ class MAYAUSD_CORE_PUBLIC UsdPointInstanceModifierBase return usdValue; } - // For USD 21.02+, avoid triggering a copy-on-write by making sure that + // Avoid triggering a copy-on-write by making sure that // we invoke operator[] on a const reference to the array. -#if PXR_VERSION >= 2102 return usdValues.AsConst()[instanceIndex]; -#else - return usdValues[instanceIndex]; -#endif } bool setValue( diff --git a/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp b/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp index c4117d4249..e227b909e4 100644 --- a/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp +++ b/lib/usd/hdMaya/adapters/aiSkydomeLightAdapter.cpp @@ -65,11 +65,7 @@ class HdMayaAiSkyDomeLightAdapter : public HdMayaLightAdapter return VtValue(light.findPlug("aiExposure", true).asFloat()); } else if (paramName == HdLightTokens->normalize) { return VtValue(light.findPlug("aiNormalize", true).asBool()); -#if PXR_VERSION >= 2102 } else if (paramName == HdLightTokens->textureFormat) { -#else - } else if (paramName == UsdLuxTokens->textureFormat) { -#endif const auto format = light.findPlug("format", true).asShort(); // mirrored_ball : 0 // angular : 1 diff --git a/lib/usd/hdMaya/adapters/cameraAdapter.cpp b/lib/usd/hdMaya/adapters/cameraAdapter.cpp index 927c2e7b91..20220b9c93 100644 --- a/lib/usd/hdMaya/adapters/cameraAdapter.cpp +++ b/lib/usd/hdMaya/adapters/cameraAdapter.cpp @@ -284,7 +284,6 @@ VtValue HdMayaCameraAdapter::GetCameraParamValue(const TfToken& paramName) return {}; return VtValue(windowPolicy); } -#if PXR_VERSION >= 2102 if (paramName == HdCameraTokens->projection) { if (isOrtho) { return VtValue(HdCamera::Orthographic); @@ -293,8 +292,6 @@ VtValue HdMayaCameraAdapter::GetCameraParamValue(const TfToken& paramName) } } -#endif - return {}; } diff --git a/lib/usd/hdMaya/adapters/spotLightAdapter.cpp b/lib/usd/hdMaya/adapters/spotLightAdapter.cpp index 98d0a8da1d..903bbb6407 100644 --- a/lib/usd/hdMaya/adapters/spotLightAdapter.cpp +++ b/lib/usd/hdMaya/adapters/spotLightAdapter.cpp @@ -134,23 +134,11 @@ class HdMayaSpotLightAdapter : public HdMayaLightAdapter } else if (paramName == UsdLuxTokens->treatAsPoint) { const bool treatAsPoint = (light.shadowRadius() == 0.0); return VtValue(treatAsPoint); -#if PXR_VERSION >= 2105 } else if (paramName == UsdLuxTokens->inputsShapingConeAngle) { -#else - } else if (paramName == HdLightTokens->shapingConeAngle) { -#endif return VtValue(GetSpotCutoff(light)); -#if PXR_VERSION >= 2105 } else if (paramName == UsdLuxTokens->inputsShapingConeSoftness) { -#else - } else if (paramName == HdLightTokens->shapingConeSoftness) { -#endif return VtValue(GetSpotSoftness(light)); -#if PXR_VERSION >= 2105 } else if (paramName == UsdLuxTokens->inputsShapingFocus) { -#else - } else if (paramName == HdLightTokens->shapingFocus) { -#endif return VtValue(GetSpotFalloff(light)); } } diff --git a/lib/usd/schemas/ALMayaReference.cpp b/lib/usd/schemas/ALMayaReference.cpp index d0606eef96..7a88d4f114 100644 --- a/lib/usd/schemas/ALMayaReference.cpp +++ b/lib/usd/schemas/ALMayaReference.cpp @@ -61,19 +61,11 @@ MayaUsd_SchemasALMayaReference::Define(const UsdStagePtr& stage, const SdfPath& return MayaUsd_SchemasALMayaReference(stage->DefinePrim(path, usdPrimTypeName)); } -#if PXR_VERSION >= 2108 /* virtual */ UsdSchemaKind MayaUsd_SchemasALMayaReference::_GetSchemaKind() const { return MayaUsd_SchemasALMayaReference::schemaKind; } -#else -/* virtual */ -UsdSchemaType MayaUsd_SchemasALMayaReference::_GetSchemaType() const -{ - return MayaUsd_SchemasALMayaReference::schemaType; -} -#endif /* static */ const TfType& MayaUsd_SchemasALMayaReference::_GetStaticTfType() diff --git a/lib/usd/schemas/ALMayaReference.h b/lib/usd/schemas/ALMayaReference.h index d6712ac204..d81e6b524c 100644 --- a/lib/usd/schemas/ALMayaReference.h +++ b/lib/usd/schemas/ALMayaReference.h @@ -46,17 +46,10 @@ class SdfAssetPath; class MayaUsd_SchemasALMayaReference : public MayaUsd_SchemasMayaReference { public: -#if PXR_VERSION >= 2108 /// Compile time constant representing what kind of schema this class is. /// /// \sa UsdSchemaKind static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; -#else - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaType - static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped; -#endif /// Construct a MayaUsd_SchemasALMayaReference on UsdPrim \p prim . /// Equivalent to MayaUsd_SchemasALMayaReference::Get(prim.GetStage(), prim.GetPath()) @@ -123,19 +116,11 @@ class MayaUsd_SchemasALMayaReference : public MayaUsd_SchemasMayaReference static MayaUsd_SchemasALMayaReference Define(const UsdStagePtr& stage, const SdfPath& path); protected: -#if PXR_VERSION >= 2108 /// Returns the kind of schema this class belongs to. /// /// \sa UsdSchemaKind MAYAUSD_SCHEMAS_API UsdSchemaKind _GetSchemaKind() const override; -#else - /// Returns the type of schema this class belongs to. - /// - /// \sa UsdSchemaType - MAYAUSD_SCHEMAS_API - UsdSchemaType _GetSchemaType() const override; -#endif private: // needs to invoke _GetStaticTfType. diff --git a/lib/usd/schemas/MayaReference.cpp b/lib/usd/schemas/MayaReference.cpp index ad5f2b34c1..7a7f789a72 100644 --- a/lib/usd/schemas/MayaReference.cpp +++ b/lib/usd/schemas/MayaReference.cpp @@ -61,19 +61,11 @@ MayaUsd_SchemasMayaReference::Define(const UsdStagePtr& stage, const SdfPath& pa return MayaUsd_SchemasMayaReference(stage->DefinePrim(path, usdPrimTypeName)); } -#if PXR_VERSION >= 2108 /* virtual */ UsdSchemaKind MayaUsd_SchemasMayaReference::_GetSchemaKind() const { return MayaUsd_SchemasMayaReference::schemaKind; } -#else -/* virtual */ -UsdSchemaType MayaUsd_SchemasMayaReference::_GetSchemaType() const -{ - return MayaUsd_SchemasMayaReference::schemaType; -} -#endif /* static */ const TfType& MayaUsd_SchemasMayaReference::_GetStaticTfType() diff --git a/lib/usd/schemas/MayaReference.h b/lib/usd/schemas/MayaReference.h index a9ac33bcd7..5f4ec77b6d 100644 --- a/lib/usd/schemas/MayaReference.h +++ b/lib/usd/schemas/MayaReference.h @@ -47,17 +47,10 @@ class SdfAssetPath; class MayaUsd_SchemasMayaReference : public UsdGeomXformable { public: -#if PXR_VERSION >= 2108 /// Compile time constant representing what kind of schema this class is. /// /// \sa UsdSchemaKind static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; -#else - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaType - static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped; -#endif /// Construct a MayaUsd_SchemasMayaReference on UsdPrim \p prim . /// Equivalent to MayaUsd_SchemasMayaReference::Get(prim.GetStage(), prim.GetPath()) @@ -124,19 +117,11 @@ class MayaUsd_SchemasMayaReference : public UsdGeomXformable static MayaUsd_SchemasMayaReference Define(const UsdStagePtr& stage, const SdfPath& path); protected: -#if PXR_VERSION >= 2108 /// Returns the kind of schema this class belongs to. /// /// \sa UsdSchemaKind MAYAUSD_SCHEMAS_API UsdSchemaKind _GetSchemaKind() const override; -#else - /// Returns the type of schema this class belongs to. - /// - /// \sa UsdSchemaType - MAYAUSD_SCHEMAS_API - UsdSchemaType _GetSchemaType() const override; -#endif private: // needs to invoke _GetStaticTfType. diff --git a/lib/usd/translators/shading/usdUVTextureReader.cpp b/lib/usd/translators/shading/usdUVTextureReader.cpp index 7548de1982..ba5a2cabee 100644 --- a/lib/usd/translators/shading/usdUVTextureReader.cpp +++ b/lib/usd/translators/shading/usdUVTextureReader.cpp @@ -164,12 +164,7 @@ bool PxrMayaUsdUVTexture_Reader::Read(UsdMayaPrimReaderContext& context) && !filePath.empty() && ArIsPackageRelativePath(filePath)) { // NOTE: (yliangsiew) Package-relatve path means that we are inside of a USDZ file. ArResolver& arResolver = ArGetResolver(); // NOTE: (yliangsiew) This is cached. -#if PXR_VERSION > 2011 std::shared_ptr assetPtr = arResolver.OpenAsset(ArResolvedPath(filePath)); -#else - std::shared_ptr assetPtr = arResolver.OpenAsset(filePath); -#endif - if (assetPtr == nullptr) { TF_WARN( "The file: %s could not be found within the USDZ archive for extraction.", diff --git a/lib/usd/translators/skelReader.cpp b/lib/usd/translators/skelReader.cpp index dfe4075e15..582ff5108d 100644 --- a/lib/usd/translators/skelReader.cpp +++ b/lib/usd/translators/skelReader.cpp @@ -149,20 +149,10 @@ void UsdMayaPrimReaderSkelRoot::PostReadSubtree(UsdMayaPrimReaderContext& contex // prims we produce skin clusters for have been processed first. std::vector bindings; - -#if PXR_VERSION > 2008 _cache.Populate(skelRoot, UsdTraverseInstanceProxies()); - if (!_cache.ComputeSkelBindings(skelRoot, &bindings, UsdTraverseInstanceProxies())) { return; } -#else - _cache.Populate(skelRoot); - - if (!_cache.ComputeSkelBindings(skelRoot, &bindings)) { - return; - } -#endif for (const UsdSkelBinding& binding : bindings) { if (binding.GetSkinningTargets().empty()) diff --git a/lib/usdUfe/ufe/UsdSceneItem.cpp b/lib/usdUfe/ufe/UsdSceneItem.cpp index 9cc08370dc..eec1b97665 100644 --- a/lib/usdUfe/ufe/UsdSceneItem.cpp +++ b/lib/usdUfe/ufe/UsdSceneItem.cpp @@ -70,20 +70,9 @@ std::vector UsdSceneItem::ancestorNodeTypes() const for (const TfType& ty : tfAncestorTypes) { // If there is a concrete schema type name, we'll return that since it is what // is used/shown in the UI (ex: 'Xform' vs 'UsdGeomXform'). -#if PXR_VERSION >= 2005 const auto& schemaReg = UsdSchemaRegistry::GetInstance(); strAncestorTypes.emplace_back( schemaReg.IsConcrete(ty) ? schemaReg.GetSchemaTypeName(ty) : ty.GetTypeName()); -#else - // In USD 20.05 and earlier we cannot get the concrete schema type. - // Thus the USD prim icons that we provide will not be found correctly. - // There are two workarounds: - // 1) Incorporate the GetSchemaTypeName() method into your build of - // USD. See https://github.com/PixarAnimationStudios/USD/commit/340759c - // 2) Rename the icon files to match the type name. - // Ex: "out_USD_Cone_xxx.png" -> "out_USD_UsdGeomCone_xxx.png" - strAncestorTypes.emplace_back(ty.GetTypeName()); -#endif } ancestorTypesCache[schemaType] = strAncestorTypes; return strAncestorTypes; diff --git a/lib/usdUfe/utils/usdUtils.cpp b/lib/usdUfe/utils/usdUtils.cpp index 0287d07441..965a93b0a7 100644 --- a/lib/usdUfe/utils/usdUtils.cpp +++ b/lib/usdUfe/utils/usdUtils.cpp @@ -261,13 +261,6 @@ bool updateReferencedPath(const UsdPrim& oldPrim, const SdfPath& newPath) return true; } -bool isInternalReference(const SdfReference& ref) -{ -#if PXR_VERSION >= 2008 - return ref.IsInternal(); -#else - return ref.GetAssetPath().empty(); -#endif -} +bool isInternalReference(const SdfReference& ref) { return ref.IsInternal(); } } // namespace USDUFE_NS_DEF diff --git a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_misc.cpp b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_misc.cpp index d46d93d667..9e7dafd288 100644 --- a/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_misc.cpp +++ b/plugin/al/plugin/AL_USDMayaTestPlugin/AL/usdmaya/fileio/export_misc.cpp @@ -30,17 +30,11 @@ using AL::maya::test::buildTempPath; TEST(export_misc, subdivision_scheme) { auto geomType = TfType::Find(); -#if PXR_VERSION > 2002 auto geomTypeToken = UsdSchemaRegistry::GetInstance().GetConcreteSchemaTypeName(geomType); auto primDef = UsdSchemaRegistry::GetInstance().FindConcretePrimDefinition(geomTypeToken); ASSERT_TRUE(primDef); TfToken defaultToken; primDef->GetAttributeFallbackValue(UsdGeomTokens->subdivisionScheme, &defaultToken); -#else - auto attrSpec = UsdSchemaRegistry::GetAttributeDefinition( - TfToken(geomType.GetTypeName()), UsdGeomTokens->subdivisionScheme); - auto defaultToken = attrSpec->GetDefaultValue().UncheckedGet(); -#endif std::map subdSchemeMap = { { defaultToken, 0 }, // No value should be authored { UsdGeomTokens->catmullClark, 1 }, { UsdGeomTokens->none, 2 }, diff --git a/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.cpp b/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.cpp index 36943102c0..2e0b17e836 100644 --- a/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.cpp +++ b/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.cpp @@ -59,13 +59,8 @@ AL_usd_FrameRange AL_usd_FrameRange::Define(const UsdStagePtr& stage, const SdfP return AL_usd_FrameRange(stage->DefinePrim(path, usdPrimTypeName)); } -#if PXR_VERSION >= 2108 /* virtual */ UsdSchemaKind AL_usd_FrameRange::_GetSchemaKind() const { return AL_usd_FrameRange::schemaKind; } -#else -/* virtual */ -UsdSchemaType AL_usd_FrameRange::_GetSchemaType() const { return AL_usd_FrameRange::schemaType; } -#endif /* static */ const TfType& AL_usd_FrameRange::_GetStaticTfType() diff --git a/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.h b/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.h index 8cd0247c0c..47613be0b4 100644 --- a/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.h +++ b/plugin/al/schemas/AL/usd/schemas/maya/FrameRange.h @@ -47,17 +47,10 @@ class SdfAssetPath; class AL_usd_FrameRange : public UsdTyped { public: -#if PXR_VERSION >= 2108 /// Compile time constant representing what kind of schema this class is. /// /// \sa UsdSchemaKind static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; -#else - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaType - static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped; -#endif /// Construct a AL_usd_FrameRange on UsdPrim \p prim . /// Equivalent to AL_usd_FrameRange::Get(prim.GetStage(), prim.GetPath()) @@ -124,19 +117,11 @@ class AL_usd_FrameRange : public UsdTyped static AL_usd_FrameRange Define(const UsdStagePtr& stage, const SdfPath& path); protected: -#if PXR_VERSION >= 2108 /// Returns the kind of schema this class belongs to. /// /// \sa UsdSchemaKind AL_USDMAYASCHEMAS_API virtual UsdSchemaKind _GetSchemaKind() const; -#else - /// Returns the type of schema this class belongs to. - /// - /// \sa UsdSchemaType - AL_USDMAYASCHEMAS_API - virtual UsdSchemaType _GetSchemaType() const; -#endif private: // needs to invoke _GetStaticTfType. diff --git a/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.cpp b/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.cpp index b4e641ef83..1a68bf1747 100644 --- a/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.cpp +++ b/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.cpp @@ -39,13 +39,8 @@ AL_usd_ModelAPI AL_usd_ModelAPI::Get(const UsdStagePtr& stage, const SdfPath& pa return AL_usd_ModelAPI(stage->GetPrimAtPath(path)); } -#if PXR_VERSION >= 2108 /* virtual */ UsdSchemaKind AL_usd_ModelAPI::_GetSchemaKind() const { return AL_usd_ModelAPI::schemaKind; } -#else -/* virtual */ -UsdSchemaType AL_usd_ModelAPI::_GetSchemaType() const { return AL_usd_ModelAPI::schemaType; } -#endif /* static */ const TfType& AL_usd_ModelAPI::_GetStaticTfType() diff --git a/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.h b/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.h index fb06c81530..07d7f641a3 100644 --- a/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.h +++ b/plugin/al/schemas/AL/usd/schemas/maya/ModelAPI.h @@ -47,17 +47,10 @@ class SdfAssetPath; class AL_usd_ModelAPI : public UsdModelAPI { public: -#if PXR_VERSION >= 2108 /// Compile time constant representing what kind of schema this class is. /// /// \sa UsdSchemaKind static const UsdSchemaKind schemaKind = UsdSchemaKind::NonAppliedAPI; -#else - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaType - static const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI; -#endif /// Construct a AL_usd_ModelAPI on UsdPrim \p prim . /// Equivalent to AL_usd_ModelAPI::Get(prim.GetStage(), prim.GetPath()) @@ -99,19 +92,11 @@ class AL_usd_ModelAPI : public UsdModelAPI static AL_usd_ModelAPI Get(const UsdStagePtr& stage, const SdfPath& path); protected: -#if PXR_VERSION >= 2108 /// Returns the kind of schema this class belongs to. /// /// \sa UsdSchemaKind AL_USDMAYASCHEMAS_API virtual UsdSchemaKind _GetSchemaKind() const; -#else - /// Returns the type of schema this class belongs to. - /// - /// \sa UsdSchemaType - AL_USDMAYASCHEMAS_API - virtual UsdSchemaType _GetSchemaType() const; -#endif private: // needs to invoke _GetStaticTfType. diff --git a/plugin/al/schemas/AL/usd/schemas/mayatest/ExamplePolyCubeNode.h b/plugin/al/schemas/AL/usd/schemas/mayatest/ExamplePolyCubeNode.h index d064677fcf..3efddcee3c 100644 --- a/plugin/al/schemas/AL/usd/schemas/mayatest/ExamplePolyCubeNode.h +++ b/plugin/al/schemas/AL/usd/schemas/mayatest/ExamplePolyCubeNode.h @@ -55,17 +55,10 @@ class SdfAssetPath; class AL_usd_ExamplePolyCubeNode : public UsdTyped { public: -#if PXR_VERSION >= 2108 /// Compile time constant representing what kind of schema this class is. /// /// \sa UsdSchemaKind static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; -#else - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaType - static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped; -#endif /// Construct a AL_usd_ExamplePolyCubeNode on UsdPrim \p prim . /// Equivalent to AL_usd_ExamplePolyCubeNode::Get(prim.GetStage(), prim.GetPath()) @@ -132,19 +125,11 @@ class AL_usd_ExamplePolyCubeNode : public UsdTyped static AL_usd_ExamplePolyCubeNode Define(const UsdStagePtr& stage, const SdfPath& path); protected: -#if PXR_VERSION >= 2108 /// Returns the kind of schema this class belongs to. /// /// \sa UsdSchemaKind AL_USDMAYASCHEMASTEST_API virtual UsdSchemaKind _GetSchemaKind() const; -#else - /// Returns the type of schema this class belongs to. - /// - /// \sa UsdSchemaType - AL_USDMAYASCHEMASTEST_API - virtual UsdSchemaType _GetSchemaType() const; -#endif private: // needs to invoke _GetStaticTfType.