diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-03 01:50:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-03 01:50:25 +0300 |
commit | ddf956fb5846da3835a1785978e0b9f1af89b45d (patch) | |
tree | 46845052350f525633f2922d2775a75f422defc1 /source/blender | |
parent | 2600806c2ef1b626e3d82f14a7facfcc7f9f0992 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc index da8d7bcf255..fccfed21ef4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc @@ -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)); } |