diff options
author | Michael Kowalski <makowalski@nvidia.com> | 2022-03-25 18:29:39 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-03-25 18:29:39 +0300 |
commit | c671a26637a7be3dc95cefdfb2cf566d43ef6627 (patch) | |
tree | 56eaaafb48142e85944fa272b0b0827fa6c1bf8b /source/blender/io/usd/intern/usd_reader_stage.cc | |
parent | 378022c7973db54f1ad8cf335a9359c3bf27ddb5 (diff) |
USD: Support building against USD 21.11+
For 3.2 USD will be bumped to a newer version with some
slight API changes, however since we cannot simultaneously
land the libs for all platforms as well as these code changes,
we'll have to support both 21.02 and 21.11+ for at least a
short period of time making the code slightly more messy than
it could have been.
Differential Revision: https://developer.blender.org/D14184
Reviewed by: sybren
Diffstat (limited to 'source/blender/io/usd/intern/usd_reader_stage.cc')
-rw-r--r-- | source/blender/io/usd/intern/usd_reader_stage.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc index 06f7d3ce3f5..583c58a1356 100644 --- a/source/blender/io/usd/intern/usd_reader_stage.cc +++ b/source/blender/io/usd/intern/usd_reader_stage.cc @@ -18,7 +18,13 @@ #include <pxr/usd/usdGeom/nurbsCurves.h> #include <pxr/usd/usdGeom/scope.h> #include <pxr/usd/usdGeom/xform.h> -#include <pxr/usd/usdLux/light.h> + +#if PXR_VERSION >= 2111 +# include <pxr/usd/usdLux/boundableLightBase.h> +# include <pxr/usd/usdLux/nonboundableLightBase.h> +#else +# include <pxr/usd/usdLux/light.h> +#endif #include <iostream> @@ -55,7 +61,12 @@ USDPrimReader *USDStageReader::create_reader_if_allowed(const pxr::UsdPrim &prim if (params_.import_meshes && prim.IsA<pxr::UsdGeomMesh>()) { return new USDMeshReader(prim, params_, settings_); } +#if PXR_VERSION >= 2111 + if (params_.import_lights && (prim.IsA<pxr::UsdLuxBoundableLightBase>() || + prim.IsA<pxr::UsdLuxNonboundableLightBase>())) { +#else if (params_.import_lights && prim.IsA<pxr::UsdLuxLight>()) { +#endif return new USDLightReader(prim, params_, settings_); } if (params_.import_volumes && prim.IsA<pxr::UsdVolVolume>()) { @@ -82,7 +93,11 @@ USDPrimReader *USDStageReader::create_reader(const pxr::UsdPrim &prim) if (prim.IsA<pxr::UsdGeomMesh>()) { return new USDMeshReader(prim, params_, settings_); } +#if PXR_VERSION >= 2111 + if (prim.IsA<pxr::UsdLuxBoundableLightBase>() || prim.IsA<pxr::UsdLuxNonboundableLightBase>()) { +#else if (prim.IsA<pxr::UsdLuxLight>()) { +#endif return new USDLightReader(prim, params_, settings_); } if (prim.IsA<pxr::UsdVolVolume>()) { |