Cleanup: Use early return in legacy curve conversion
Return null instead of an empty curves data-block, which amounts to the same thing in geometry nodes, with less potential for error in the rest of the function.
This commit is contained in:
parent
2b6c1600cf
commit
87cd22f643
@ -80,6 +80,9 @@ static KnotsMode knots_mode_from_legacy(const short flag)
|
||||
Curves *curve_legacy_to_curves(const Curve &curve_legacy, const ListBase &nurbs_list)
|
||||
{
|
||||
const Vector<const Nurb *> src_curves(nurbs_list);
|
||||
if (src_curves.is_empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Curves *curves_id = curves_new_nomain(0, src_curves.size());
|
||||
CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
@ -104,10 +107,6 @@ Curves *curve_legacy_to_curves(const Curve &curve_legacy, const ListBase &nurbs_
|
||||
|
||||
curves.update_curve_types();
|
||||
|
||||
if (curves.curves_num() == 0) {
|
||||
return curves_id;
|
||||
}
|
||||
|
||||
const OffsetIndices points_by_curve = curves.points_by_curve();
|
||||
MutableSpan<float3> positions = curves.positions_for_write();
|
||||
SpanAttributeWriter<float> radius_attribute =
|
||||
|
Loading…
Reference in New Issue
Block a user