Skip to content

Commit

Permalink
Don't convert the near and far clipping planes linear units to cm. Th…
Browse files Browse the repository at this point in the history
…e UFE documentation for these methods has changed and the functions now return the values in scene units.
  • Loading branch information
krickw committed Mar 18, 2021
1 parent 5da577e commit f462d45
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions lib/mayaUsd/ufe/UsdCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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)
Expand Down

0 comments on commit f462d45

Please sign in to comment.