USD Curve Export: Pinned CatmullRom Curve #108183

Merged
2 changed files with 9 additions and 2 deletions

View File

@ -54,6 +54,13 @@ pxr::UsdGeomCurves USDCurvesWriter::DefineUsdGeomBasisCurves(pxr::VtValue curve_
if (is_cyclic) {
basis_curves.CreateWrapAttr(pxr::VtValue(pxr::UsdGeomTokens->periodic));
}
else if (curve_basis == pxr::VtValue(pxr::UsdGeomTokens->catmullRom)) {
/* In Blender the first and last points are treated as endpoints. The pinned attribute tells
* the client that to evaluate or render the curve, it must effectively add 'phantom
* points' at the beginning and end of every curve in a batch. These phantom points are
* injected to ensure that the interpolated curve begins at P[0] and ends at P[n-1]. */
basis_curves.CreateWrapAttr(pxr::VtValue(pxr::UsdGeomTokens->pinned));
}
else {
basis_curves.CreateWrapAttr(pxr::VtValue(pxr::UsdGeomTokens->nonperiodic));
}

View File

@ -192,8 +192,8 @@ static void check_catmullRom_curve(const pxr::UsdPrim prim,
<< "Wrap token should be periodic for periodic curve";
}
else {
EXPECT_EQ(wrap_token, pxr::UsdGeomTokens->nonperiodic)
<< "Wrap token should be nonperiodic for nonperiodic curve";
EXPECT_EQ(wrap_token, pxr::UsdGeomTokens->pinned)
<< "Wrap token should be pinned for nonperiodic catmullRom curve";
}
pxr::UsdAttribute vert_count_attr = curve.GetCurveVertexCountsAttr();