Alembic: Support new Curves object type for export #119894

Merged
Jesse Yurkovich merged 10 commits from deadpin/blender:fix-alembicexport into main 2024-04-12 21:27:25 +02:00
1 changed files with 3 additions and 4 deletions
Showing only changes of commit 6c78378bff - Show all commits

View File

@ -125,13 +125,12 @@ void ABCCurveWriter::do_write(HierarchyContext &context)
return;
}
const VArray<bool> cyclic_values = curves.cyclic();
const bool is_cyclic = cyclic_values.is_empty() ? false : cyclic_values.first();
if (array_utils::booleans_mix_calc(curves.cyclic()) == array_utils::BooleanMix::Mixed) {
CLOG_WARN(&LOG, "Cannot export mixed cyclic and non-cyclic curves in the same Curves object");
return;
}
const bool is_cyclic = curves.cyclic().first();
Alembic::AbcGeom::BasisType curve_basis = Alembic::AbcGeom::kNoBasis;
deadpin marked this conversation as resolved Outdated

cast to CurveType for compiler warnings in the switch if we ever add a new type

cast to `CurveType` for compiler warnings in the switch if we ever add a new type
Alembic::AbcGeom::CurveType curve_type = Alembic::AbcGeom::kVariableOrder;
Alembic::AbcGeom::CurvePeriodicity periodicity = is_cyclic ? Alembic::AbcGeom::kPeriodic :
@ -189,9 +188,9 @@ void ABCCurveWriter::do_write(HierarchyContext &context)
* control point 1(+ width), right handle 1, left handle 2,
* control point 2(+ width), ...
* ] */
for (int i_point = start_point_index; i_point < last_point_index; i_point++) {
for (const int i_point : points.drop_back(1)) {
verts.push_back(to_yup_V3f(positions[i_point]));
deadpin marked this conversation as resolved
Review

Just noticed, I think this can be simpler as for (const int point : points) {

Just noticed, I think this can be simpler as `for (const int point : points) {`
widths.push_back(radii[last_point_index] * 2.0f);
widths.push_back(radii[i_point] * 2.0f);
deadpin marked this conversation as resolved
Review

Seems the radius should be accessed from the current point rather than always the last point in the curve

Seems the radius should be accessed from the current point rather than always the last point in the curve
verts.push_back(to_yup_V3f(handles_r[i_point]));
verts.push_back(to_yup_V3f(handles_l[i_point + 1]));