[Bf-blender-cvs] [710842cd1de] geometry-nodes: Geometry Nodes: only output new data from Distribute and Instance nodes
Jacques Lucke
noreply at git.blender.org
Tue Nov 24 11:50:59 CET 2020
Commit: 710842cd1de5a006edfe1a13bc432360c6138edc
Author: Jacques Lucke
Date: Tue Nov 24 11:50:49 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB710842cd1de5a006edfe1a13bc432360c6138edc
Geometry Nodes: only output new data from Distribute and Instance nodes
This can be recombined with the original data using a
Join node if necessary.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
M source/blender/nodes/geometry/nodes/node_geo_point_instance.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 7ab3bfba1b1..7f94ca35e6e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -93,9 +93,10 @@ static Vector<float3> scatter_points_from_mesh(const Mesh *mesh,
static void geo_node_point_distribute_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
+ GeometrySet geometry_set_out;
if (!geometry_set.has_mesh()) {
- params.set_output("Geometry", std::move(geometry_set));
+ params.set_output("Geometry", std::move(geometry_set_out));
return;
}
@@ -103,9 +104,7 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
const std::string density_attribute = params.extract_input<std::string>("Density Attribute");
if (density <= 0.0f) {
- geometry_set.replace_mesh(nullptr);
- geometry_set.replace_pointcloud(nullptr);
- params.set_output("Geometry", std::move(geometry_set));
+ params.set_output("Geometry", std::move(geometry_set_out));
return;
}
@@ -124,10 +123,8 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
pointcloud->radius[i] = 0.05f;
}
- geometry_set.replace_mesh(nullptr);
- geometry_set.replace_pointcloud(pointcloud);
-
- params.set_output("Geometry", std::move(geometry_set));
+ geometry_set_out.replace_pointcloud(pointcloud);
+ params.set_output("Geometry", std::move(geometry_set_out));
}
} // namespace blender::nodes
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
index b8b7dc4cace..dfa50d38d43 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
@@ -76,13 +76,14 @@ static void add_instances_from_geometry_component(InstancesComponent &instances,
static void geo_node_point_instance_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
+ GeometrySet geometry_set_out;
bke::PersistentObjectHandle object_handle = params.extract_input<bke::PersistentObjectHandle>(
"Object");
Object *object = params.handle_map().lookup(object_handle);
if (object != nullptr) {
- InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>();
+ InstancesComponent &instances = geometry_set_out.get_component_for_write<InstancesComponent>();
if (geometry_set.has<MeshComponent>()) {
add_instances_from_geometry_component(
instances, *geometry_set.get_component_for_read<MeshComponent>(), object, params);
@@ -93,9 +94,7 @@ static void geo_node_point_instance_exec(GeoNodeExecParams params)
}
}
- geometry_set.remove<MeshComponent>();
- geometry_set.remove<PointCloudComponent>();
- params.set_output("Geometry", std::move(geometry_set));
+ params.set_output("Geometry", std::move(geometry_set_out));
}
} // namespace blender::nodes
More information about the Bf-blender-cvs
mailing list