[Bf-blender-cvs] [1b4cf3af4b1] master: Cleanup: Improve consistency when nodes run without OpenVDB

Hans Goudey noreply at git.blender.org
Tue Sep 20 19:27:46 CEST 2022


Commit: 1b4cf3af4b177ae97b04b025e6b9a73267e59310
Author: Hans Goudey
Date:   Tue Sep 20 12:27:36 2022 -0500
Branches: master
https://developer.blender.org/rB1b4cf3af4b177ae97b04b025e6b9a73267e59310

Cleanup: Improve consistency when nodes run without OpenVDB

Use a consistent order of expressions and formatting.
Also use consistent error message text.

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

M	source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc
M	source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
index 24f81a81b3e..b3fc24ded68 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
@@ -183,12 +183,11 @@ static void geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
 {
   GeometrySet geometry_set_in = params.extract_input<GeometrySet>("Volume");
 
+#ifdef WITH_OPENVDB
   const NodeGeometryDistributePointsInVolume &storage = node_storage(params.node());
   const GeometryNodeDistributePointsInVolumeMode mode =
       static_cast<GeometryNodeDistributePointsInVolumeMode>(storage.mode);
 
-#ifdef WITH_OPENVDB
-
   float density;
   int seed;
   float3 spacing{0, 0, 0};
@@ -258,9 +257,11 @@ static void geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
 
   params.set_output("Points", std::move(geometry_set_in));
 
-#else  /* WITH_OPENVDB */
-  params.error_message_add(NodeWarningType::Error, TIP_("Blender is compiled without OpenVDB"));
-#endif /* !WITH_OPENVDB */
+#else
+  params.set_default_remaining_outputs();
+  params.error_message_add(NodeWarningType::Error,
+                           TIP_("Disabled, Blender was compiled without OpenVDB"));
+#endif
 }
 }  // namespace blender::nodes
 
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
index 92814a8bc5e..f6fa5c99013 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
@@ -149,7 +149,6 @@ static void node_geo_exec(GeoNodeExecParams params)
 {
 #ifdef WITH_OPENVDB
   GeometrySet geometry_set(params.extract_input<GeometrySet>("Mesh"));
-
   geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
     if (geometry_set.has_mesh()) {
       Volume *volume = create_volume_from_mesh(*geometry_set.get_mesh_for_read(), params);
@@ -159,9 +158,9 @@ static void node_geo_exec(GeoNodeExecParams params)
   });
   params.set_output("Volume", std::move(geometry_set));
 #else
+  params.set_default_remaining_outputs();
   params.error_message_add(NodeWarningType::Error,
                            TIP_("Disabled, Blender was compiled without OpenVDB"));
-  params.set_default_remaining_outputs();
   return;
 #endif
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index ba6bd40a6b6..0990eebb903 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -231,17 +231,16 @@ static void initialize_volume_component_from_points(GeoNodeExecParams &params,
 
 static void node_geo_exec(GeoNodeExecParams params)
 {
-  GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
-
 #ifdef WITH_OPENVDB
+  GeometrySet geometry_set = params.extract_input<GeometrySet>("Points");
   geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
     initialize_volume_component_from_points(params, geometry_set);
   });
   params.set_output("Volume", std::move(geometry_set));
 #else
+  params.set_default_remaining_outputs();
   params.error_message_add(NodeWarningType::Error,
                            TIP_("Disabled, Blender was compiled without OpenVDB"));
-  params.set_default_remaining_outputs();
 #endif
 }
 
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc
index e964bf03ed2..c102b91acb1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_cube.cc
@@ -113,9 +113,9 @@ class Grid3DFieldContext : public FieldContext {
   }
 };
 
-#ifdef WITH_OPENVDB
 static void node_geo_exec(GeoNodeExecParams params)
 {
+#ifdef WITH_OPENVDB
   const float3 bounds_min = params.extract_input<float3>("Min");
   const float3 bounds_max = params.extract_input<float3>("Max");
 
@@ -177,16 +177,12 @@ static void node_geo_exec(GeoNodeExecParams params)
   GeometrySet r_geometry_set;
   r_geometry_set.replace_volume(volume);
   params.set_output("Volume", r_geometry_set);
-}
-
 #else
-static void node_geo_exec(GeoNodeExecParams params)
-{
+  params.set_default_remaining_outputs();
   params.error_message_add(NodeWarningType::Error,
                            TIP_("Disabled, Blender was compiled without OpenVDB"));
-  params.set_default_remaining_outputs();
+#endif
 }
-#endif /* WITH_OPENVDB */
 
 }  // namespace blender::nodes::node_geo_volume_cube_cc
 
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
index 46708f53087..763e207b388 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
@@ -187,20 +187,19 @@ static Mesh *create_mesh_from_volume(GeometrySet &geometry_set, GeoNodeExecParam
 
 static void node_geo_exec(GeoNodeExecParams params)
 {
-  GeometrySet geometry_set = params.extract_input<GeometrySet>("Volume");
-
 #ifdef WITH_OPENVDB
+  GeometrySet geometry_set = params.extract_input<GeometrySet>("Volume");
   geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
     Mesh *mesh = create_mesh_from_volume(geometry_set, params);
     geometry_set.replace_mesh(mesh);
     geometry_set.keep_only_during_modify({GEO_COMPONENT_TYPE_MESH});
   });
+  params.set_output("Mesh", std::move(geometry_set));
 #else
+  params.set_default_remaining_outputs();
   params.error_message_add(NodeWarningType::Error,
                            TIP_("Disabled, Blender was compiled without OpenVDB"));
 #endif
-
-  params.set_output("Mesh", std::move(geometry_set));
 }
 
 }  // namespace blender::nodes::node_geo_volume_to_mesh_cc



More information about the Bf-blender-cvs mailing list