Curves: Port set resolution node to the new data-block
The node unnecessarily converted to the old data structure to check if there were any poly splines. Instead, that warning is just removed, because the node now still sets resolution values in that case, they just aren't used (before the values weren't set at all). Either way, it wasn't clear that looping though all of the curve types was worth the performance cost here.
This commit is contained in:
parent
2600806c2e
commit
ddf956fb58
Notes:
blender-bot
2023-02-13 16:20:51 +01:00
Referenced by issue #95443, Refactor curve nodes to use new data structure
|
@ -41,29 +41,11 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
Field<bool> selection_field = params.extract_input<Field<bool>>("Selection");
|
||||
Field<int> resolution_field = params.extract_input<Field<int>>("Resolution");
|
||||
|
||||
bool only_poly = true;
|
||||
geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
|
||||
if (geometry_set.has_curves()) {
|
||||
if (only_poly) {
|
||||
const std::unique_ptr<CurveEval> curve = curves_to_curve_eval(
|
||||
*geometry_set.get_curves_for_read());
|
||||
for (const SplinePtr &spline : curve->splines()) {
|
||||
if (ELEM(spline->type(), CURVE_TYPE_BEZIER, CURVE_TYPE_NURBS)) {
|
||||
only_poly = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
set_resolution_in_component(geometry_set.get_component_for_write<CurveComponent>(),
|
||||
selection_field,
|
||||
resolution_field);
|
||||
}
|
||||
set_resolution_in_component(
|
||||
geometry_set.get_component_for_write<CurveComponent>(), selection_field, resolution_field);
|
||||
});
|
||||
|
||||
if (only_poly) {
|
||||
params.error_message_add(NodeWarningType::Warning,
|
||||
TIP_("Input geometry does not contain a Bezier or NURB spline"));
|
||||
}
|
||||
params.set_output("Geometry", std::move(geometry_set));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue