Skip to content

Commit

Permalink
Merge pull request #1265 from Autodesk/krickw/MAYA-110334/leave_clipp…
Browse files Browse the repository at this point in the history
…ing_planes_in_scene_units

Don't convert the near and far clipping planes linear units to cm.
  • Loading branch information
Krystian Ligenza authored Mar 18, 2021
2 parents d4f3bbe + f462d45 commit f6a6a54
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 f6a6a54

Please sign in to comment.