From f462d45baad6e2946acb599748592b6bd4841502 Mon Sep 17 00:00:00 2001 From: krickw Date: Thu, 18 Mar 2021 11:00:03 -0400 Subject: [PATCH] Don't convert the near and far clipping planes linear units to cm. The UFE documentation for these methods has changed and the functions now return the values in scene units. --- lib/mayaUsd/ufe/UsdCamera.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/lib/mayaUsd/ufe/UsdCamera.cpp b/lib/mayaUsd/ufe/UsdCamera.cpp index 7e1139c64e..0ef5a2acbf 100644 --- a/lib/mayaUsd/ufe/UsdCamera.cpp +++ b/lib/mayaUsd/ufe/UsdCamera.cpp @@ -244,17 +244,10 @@ float UsdCamera::nearClipPlane() const GfRange1f clippingRange = gfCamera.GetClippingRange(); float nearClipPlane = clippingRange.GetMin(); - // Convert the near clip plane value to cm, the return unit of this function. + // Ufe doesn't convert linear units for prim size or translation, so don't convert the + // clipping plane. - // Figure out the stage unit - UsdStageWeakPtr stage = prim().GetStage(); - - double stageUnits = UsdGeomLinearUnits::centimeters; - if (UsdGeomStageHasAuthoredMetersPerUnit(stage)) { - stageUnits = UsdGeomGetStageMetersPerUnit(stage); - } - - return UsdMayaUtil::ConvertUnit(nearClipPlane, stageUnits, UsdGeomLinearUnits::centimeters); + return nearClipPlane; } Ufe::FarClipPlaneUndoableCommand::Ptr UsdCamera::farClipPlaneCmd(float) { return nullptr; } @@ -269,17 +262,10 @@ float UsdCamera::farClipPlane() const GfRange1f clippingRange = gfCamera.GetClippingRange(); float farClipPlane = clippingRange.GetMax(); - // Convert the far clip plane value to cm, the return unit of this function. - - // Figure out the stage unit - UsdStageWeakPtr stage = prim().GetStage(); - - double stageUnits = UsdGeomLinearUnits::centimeters; - if (UsdGeomStageHasAuthoredMetersPerUnit(stage)) { - stageUnits = UsdGeomGetStageMetersPerUnit(stage); - } + // Ufe doesn't convert linear units for prim size or translation, so don't convert the + // clipping plane. - return UsdMayaUtil::ConvertUnit(farClipPlane, stageUnits, UsdGeomLinearUnits::centimeters); + return farClipPlane; } Ufe::ProjectionUndoableCommand::Ptr UsdCamera::projectionCmd(Ufe::Camera::Projection projection)