From 23ab43d36f2f7dd67809c74a3007f4f0ed0cad53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20Piek=C3=A9?= Date: Mon, 7 Mar 2022 08:41:19 +0000 Subject: [PATCH 1/3] Copying behaviour from `lightAdapter` to consider *all* attributes for setting `DirtyParams` in `TrackVariability` --- pxr/usdImaging/usdImaging/cameraAdapter.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pxr/usdImaging/usdImaging/cameraAdapter.cpp b/pxr/usdImaging/usdImaging/cameraAdapter.cpp index 5c3453f30c..cffa06c8e7 100644 --- a/pxr/usdImaging/usdImaging/cameraAdapter.cpp +++ b/pxr/usdImaging/usdImaging/cameraAdapter.cpp @@ -199,6 +199,24 @@ UsdImagingCameraAdapter::TrackVariability(UsdPrim const& prim, false)) { return; } + + if ((*timeVaryingBits & HdCamera::DirtyParams) != 0) + return; + + // If any other camera attributes are time varying + // we will assume all camera params are time-varying. + const std::vector &attrs = prim.GetAttributes(); + for (UsdAttribute const& attr : attrs) { + // Don't double-count transform attrs. + if (UsdGeomXformable::IsTransformationAffectedByAttrNamed( + attr.GetBaseName())) { + continue; + } + if (attr.GetNumTimeSamples() > 1) { + *timeVaryingBits |= HdCamera::DirtyParams; + break; + } + } } void From 04a1b2cd443ce572ca5a238c29bc38c5339d95f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20Piek=C3=A9?= Date: Mon, 25 Apr 2022 09:22:47 +0100 Subject: [PATCH 2/3] Addressing feedback --- pxr/usdImaging/usdImaging/cameraAdapter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxr/usdImaging/usdImaging/cameraAdapter.cpp b/pxr/usdImaging/usdImaging/cameraAdapter.cpp index 6a0db54716..de541035da 100644 --- a/pxr/usdImaging/usdImaging/cameraAdapter.cpp +++ b/pxr/usdImaging/usdImaging/cameraAdapter.cpp @@ -239,12 +239,13 @@ UsdImagingCameraAdapter::TrackVariability(UsdPrim const& prim, // we will assume all camera params are time-varying. const std::vector &attrs = prim.GetAttributes(); for (UsdAttribute const& attr : attrs) { + if (attr.GetBaseName() == UsdGeomTokens->clippingPlanes) { continue; } // Don't double-count transform attrs. if (UsdGeomXformable::IsTransformationAffectedByAttrNamed( attr.GetBaseName())) { continue; } - if (attr.GetNumTimeSamples() > 1) { + if (attr.ValueMightBeTimeVarying()) { *timeVaryingBits |= HdCamera::DirtyParams; break; } From 8f82263b0dbc75dfe0edab53b2f6d72ef442ad6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20Piek=C3=A9?= Date: Thu, 28 Apr 2022 11:16:35 +0100 Subject: [PATCH 3/3] Addressing feedback --- pxr/usdImaging/usdImaging/cameraAdapter.cpp | 126 ++------------------ 1 file changed, 8 insertions(+), 118 deletions(-) diff --git a/pxr/usdImaging/usdImaging/cameraAdapter.cpp b/pxr/usdImaging/usdImaging/cameraAdapter.cpp index de541035da..ee854bad61 100644 --- a/pxr/usdImaging/usdImaging/cameraAdapter.cpp +++ b/pxr/usdImaging/usdImaging/cameraAdapter.cpp @@ -121,133 +121,23 @@ UsdImagingCameraAdapter::TrackVariability(UsdPrim const& prim, timeVaryingBits, false); - // Rest of the function is just checking whether any - // param is time-varying. - - if (_IsVarying(prim, - UsdGeomTokens->projection, - HdCamera::DirtyParams, - HdCameraTokens->projection, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->horizontalAperture, - HdCamera::DirtyParams, - HdCameraTokens->horizontalAperture, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->verticalAperture, - HdCamera::DirtyParams, - HdCameraTokens->verticalAperture, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->horizontalApertureOffset, - HdCamera::DirtyParams, - HdCameraTokens->horizontalApertureOffset, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->verticalApertureOffset, - HdCamera::DirtyParams, - HdCameraTokens->verticalApertureOffset, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->focalLength, - HdCamera::DirtyParams, - HdCameraTokens->focalLength, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->clippingRange, - HdCamera::DirtyParams, - HdCameraTokens->clippingRange, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->fStop, - HdCamera::DirtyParams, - HdCameraTokens->fStop, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->focusDistance, - HdCamera::DirtyParams, - HdCameraTokens->focusDistance, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->shutterOpen, - HdCamera::DirtyParams, - HdCameraTokens->shutterOpen, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->shutterClose, - HdCamera::DirtyParams, - HdCameraTokens->shutterClose, - timeVaryingBits, - false)) { - return; - } - - if (_IsVarying(prim, - UsdGeomTokens->exposure, - HdCamera::DirtyParams, - HdCameraTokens->exposure, - timeVaryingBits, - false)) { - return; - } - - if ((*timeVaryingBits & HdCamera::DirtyParams) != 0) - return; - // If any other camera attributes are time varying // we will assume all camera params are time-varying. const std::vector &attrs = prim.GetAttributes(); for (UsdAttribute const& attr : attrs) { + // Don't double-count clipping-plane or transform attrs. if (attr.GetBaseName() == UsdGeomTokens->clippingPlanes) { continue; } - // Don't double-count transform attrs. if (UsdGeomXformable::IsTransformationAffectedByAttrNamed( attr.GetBaseName())) { continue; } - if (attr.ValueMightBeTimeVarying()) { - *timeVaryingBits |= HdCamera::DirtyParams; - break; + if (_IsVarying(prim, + attr.GetName(), + HdCamera::DirtyParams, + attr.GetName(), + timeVaryingBits, + false)) { + return; } } }