[Bf-blender-cvs] [3a59ddb2927] master: Fix: Incorrect warning in curve to mesh node with instances

Vitor Boschi noreply at git.blender.org
Fri Oct 1 01:30:59 CEST 2021


Commit: 3a59ddb2927cc5b507fd5f071c6c1831dce743c4
Author: Vitor Boschi
Date:   Thu Sep 30 18:27:58 2021 -0500
Branches: master
https://developer.blender.org/rB3a59ddb2927cc5b507fd5f071c6c1831dce743c4

Fix: Incorrect warning in curve to mesh node with instances

The node was setting a warning when used with instances on input,
even though it worked fine.

Differential Revision: https://developer.blender.org/D12718

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
index b123820989f..9b4b6cdcd0c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
@@ -33,17 +33,8 @@ static void geo_node_curve_to_mesh_declare(NodeDeclarationBuilder &b)
 }
 
 static void geometry_set_curve_to_mesh(GeometrySet &geometry_set,
-                                       const GeometrySet &profile_set,
-                                       const GeoNodeExecParams &params)
+                                       const GeometrySet &profile_set)
 {
-  if (!geometry_set.has_curve()) {
-    if (!geometry_set.is_empty()) {
-      params.error_message_add(NodeWarningType::Warning,
-                               TIP_("No curve data available in curve input"));
-    }
-    return;
-  }
-
   const CurveEval *profile_curve = profile_set.get_curve_for_read();
 
   if (profile_curve == nullptr) {
@@ -73,11 +64,20 @@ static void geo_node_curve_to_mesh_exec(GeoNodeExecParams params)
                              TIP_("No curve data available in the profile input"));
   }
 
+  bool has_curve = false;
   curve_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
-    geometry_set_curve_to_mesh(geometry_set, profile_set, params);
+    if (geometry_set.has_curve()) {
+      has_curve = true;
+      geometry_set_curve_to_mesh(geometry_set, profile_set);
+    }
     geometry_set.keep_only({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_INSTANCES});
   });
 
+  if (!has_curve && !curve_set.is_empty()) {
+    params.error_message_add(NodeWarningType::Warning,
+                             TIP_("No curve data available in curve input"));
+  }
+
   params.set_output("Mesh", std::move(curve_set));
 }



More information about the Bf-blender-cvs mailing list