USD: Fix cyclic bezier curve export
During work on GeometrySet import it was discovered that periodic (cyclic) bezier curves do not need their first control point repeated in the actual scene description. The USD API documentation was a bit unclear on this aspect but this has been confirmed informally on the AOUSD forum and emperically using another implementation. This patch removes the duplicated start point during export. Pull Request: https://projects.blender.org/blender/blender/pulls/119185
This commit is contained in:
committed by
Jesse Yurkovich
parent
6dffc162c7
commit
e07081e15b
@@ -213,10 +213,8 @@ static void populate_curve_verts_for_bezier(const bke::CurvesGeometry &geometry,
|
||||
positions[last_point_index][1],
|
||||
positions[last_point_index][2]));
|
||||
|
||||
/* For USD representation of periodic bezier curve, one of the curve's points must be
|
||||
* repeated to close the curve. The repeated point is the first point. Since the curve is
|
||||
* closed, we now need to include the right handle of the last point and the left handle of
|
||||
* the first point.
|
||||
/* For USD periodic bezier curves, since the curve is closed, we need to include
|
||||
* the right handle of the last point and the left handle of the first point.
|
||||
*/
|
||||
if (is_cyclic) {
|
||||
const blender::float3 right_handle = handles_r[last_point_index];
|
||||
@@ -224,10 +222,6 @@ static void populate_curve_verts_for_bezier(const bke::CurvesGeometry &geometry,
|
||||
|
||||
const blender::float3 left_handle = handles_l[start_point_index];
|
||||
verts.push_back(pxr::GfVec3f(left_handle[0], left_handle[1], left_handle[2]));
|
||||
|
||||
verts.push_back(pxr::GfVec3f(positions[start_point_index][0],
|
||||
positions[start_point_index][1],
|
||||
positions[start_point_index][2]));
|
||||
}
|
||||
|
||||
const int tot_points = verts.size() - start_verts_count;
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST_F(UsdCurvesTest, usd_export_curves)
|
||||
std::string prim_name = pxr::TfMakeValidIdentifier("BezierCircle");
|
||||
pxr::UsdPrim test_prim = stage->GetPrimAtPath(pxr::SdfPath("/BezierCircle/" + prim_name));
|
||||
EXPECT_TRUE(test_prim.IsValid());
|
||||
check_bezier_curve(test_prim, true, 13);
|
||||
check_bezier_curve(test_prim, true, 12);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user