[Bf-blender-cvs] [ddf956fb584] master: Curves: Port set resolution node to the new data-block

Hans Goudey noreply at git.blender.org
Wed Mar 2 23:50:35 CET 2022


Commit: ddf956fb5846da3835a1785978e0b9f1af89b45d
Author: Hans Goudey
Date:   Wed Mar 2 17:50:25 2022 -0500
Branches: master
https://developer.blender.org/rBddf956fb5846da3835a1785978e0b9f1af89b45d

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.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc

===================================================================

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));
 }



More information about the Bf-blender-cvs mailing list