[Bf-blender-cvs] [c2359ff4aa4] geometry-nodes: Geometry Nodes: improve boolean node when not both inputs are connected

Jacques Lucke noreply at git.blender.org
Fri Nov 20 19:02:11 CET 2020


Commit: c2359ff4aa4f30eadbeffaaeba678a72ca1266cd
Author: Jacques Lucke
Date:   Fri Nov 20 19:02:01 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rBc2359ff4aa4f30eadbeffaaeba678a72ca1266cd

Geometry Nodes: improve boolean node when not both inputs are connected

Previously, it was always outputting an empty geometry in that case.
This was confusing because e.g. the output of a union operation
with a single non-empty mesh is also non-empty.

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

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

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
index 7f82e77e631..570c754194c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
@@ -109,13 +109,6 @@ static void geo_boolean_exec(GeoNodeExecParams params)
   GeometrySet geometry_set_in_b = params.extract_input<GeometrySet>("Geometry B");
   GeometrySet geometry_set_out;
 
-  const Mesh *mesh_in_a = geometry_set_in_a.get_mesh_for_read();
-  const Mesh *mesh_in_b = geometry_set_in_b.get_mesh_for_read();
-  if (mesh_in_a == nullptr || mesh_in_b == nullptr) {
-    params.set_output("Geometry", std::move(geometry_set_out));
-    return;
-  }
-
   GeometryNodeBooleanOperation operation = (GeometryNodeBooleanOperation)params.node().custom1;
   if (operation < 0 || operation > 2) {
     BLI_assert(false);
@@ -123,6 +116,24 @@ static void geo_boolean_exec(GeoNodeExecParams params)
     return;
   }
 
+  const Mesh *mesh_in_a = geometry_set_in_a.get_mesh_for_read();
+  const Mesh *mesh_in_b = geometry_set_in_b.get_mesh_for_read();
+
+  if (mesh_in_a == nullptr || mesh_in_b == nullptr) {
+    if (operation == GEO_NODE_BOOLEAN_UNION) {
+      if (mesh_in_a != nullptr) {
+        params.set_output("Geometry", geometry_set_in_a);
+      }
+      else {
+        params.set_output("Geometry", geometry_set_in_b);
+      }
+    }
+    else {
+      params.set_output("Geometry", geometry_set_in_a);
+    }
+    return;
+  }
+
   Mesh *mesh_out = mesh_boolean_calc(mesh_in_a, mesh_in_b, operation);
   geometry_set_out = GeometrySet::create_with_mesh(mesh_out);



More information about the Bf-blender-cvs mailing list