[Bf-blender-cvs] [99f02d28b81] temp-geometry-nodes-distribute-points-cleanup: Cleanup: Use switch
Dalai Felinto
noreply at git.blender.org
Fri Dec 11 02:00:47 CET 2020
Commit: 99f02d28b815832a6f3e9b439ca47353b4162ff3
Author: Dalai Felinto
Date: Thu Dec 10 11:32:40 2020 +0100
Branches: temp-geometry-nodes-distribute-points-cleanup
https://developer.blender.org/rB99f02d28b815832a6f3e9b439ca47353b4162ff3
Cleanup: Use switch
This automatically gives a warning if a new enum value is added and is not handled here.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 93764ed4d8e..38c8ec026d9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -284,16 +284,14 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
Vector<float3> points;
- if (distribute_method == GEO_NODE_POINT_DISTRIBUTE_RANDOM) {
- points = random_scatter_points_from_mesh(mesh_in, density, density_factors, seed);
- }
- else if (distribute_method == GEO_NODE_POINT_DISTRIBUTE_POISSON) {
- const float min_dist = params.extract_input<float>("Minimum Distance");
- points = poisson_scatter_points_from_mesh(mesh_in, density, min_dist, density_factors, seed);
- }
- else {
- /* Unhandled point distribution. */
- BLI_assert(false);
+ switch (distribute_method) {
+ case GEO_NODE_POINT_DISTRIBUTE_RANDOM:
+ points = random_scatter_points_from_mesh(mesh_in, density, density_factors, seed);
+ break;
+ case GEO_NODE_POINT_DISTRIBUTE_POISSON:
+ const float min_dist = params.extract_input<float>("Minimum Distance");
+ points = poisson_scatter_points_from_mesh(mesh_in, density, min_dist, density_factors, seed);
+ break;
}
PointCloud *pointcloud = BKE_pointcloud_new_nomain(points.size());
More information about the Bf-blender-cvs
mailing list