diff options
author | Erik Abrahamsson <ecke101@gmail.com> | 2022-06-29 18:56:17 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-06-29 18:56:17 +0300 |
commit | 1516f7dcde34a4a31f6f3d04eac5f60310ea32b7 (patch) | |
tree | ee5a6c53cad8944e6768d1548a1a15ee2db62e08 /source/blender/blenkernel | |
parent | 6b508eb012b929b34e893f71a785580562cc9a6a (diff) |
Geometry Nodes: Add Mesh To Volume Node
This adds a Mesh To Volume Node T86838 based on the existing modifier.
The mesh to volume conversion is implemented in the geometry module,
and shared between the node and the modifier.
Currently the node outputs a grid with the name "density". This may
change in the future depending on the decisions made in T91668.
The original patch was by Kris (@Metricity), further implementation
by Geramy Loveless (@GeramyLoveless), then finished by Erik Abrahamsson
(@erik85).
Differential Revision: https://developer.blender.org/D10895
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_geometry_set.hh | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set.cc | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 1 |
4 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 8d658c9be15..1d4291473bb 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -412,6 +412,11 @@ struct GeometrySet { static GeometrySet create_with_mesh( Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); /** + * Create a new geometry set that only contains the given volume. + */ + static GeometrySet create_with_volume( + Volume *volume, GeometryOwnershipType ownership = GeometryOwnershipType::Owned); + /** * Create a new geometry set that only contains the given point cloud. */ static GeometrySet create_with_pointcloud( diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 4a84f8fc3c4..bad3e0005b8 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1498,6 +1498,7 @@ struct TexResult; #define GEO_NODE_VOLUME_CUBE 1161 #define GEO_NODE_POINTS 1162 #define GEO_NODE_FIELD_ON_DOMAIN 1163 +#define GEO_NODE_MESH_TO_VOLUME 1164 /** \} */ diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 1a43c4d01b0..70a39acf620 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -322,6 +322,16 @@ GeometrySet GeometrySet::create_with_mesh(Mesh *mesh, GeometryOwnershipType owne return geometry_set; } +GeometrySet GeometrySet::create_with_volume(Volume *volume, GeometryOwnershipType ownership) +{ + GeometrySet geometry_set; + if (volume != nullptr) { + VolumeComponent &component = geometry_set.get_component_for_write<VolumeComponent>(); + component.replace(volume, ownership); + } + return geometry_set; +} + GeometrySet GeometrySet::create_with_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership) { diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index b6ab1e0174b..244c9ccd048 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4804,6 +4804,7 @@ static void registerGeometryNodes() register_node_type_geo_mesh_subdivide(); register_node_type_geo_mesh_to_curve(); register_node_type_geo_mesh_to_points(); + register_node_type_geo_mesh_to_volume(); register_node_type_geo_object_info(); register_node_type_geo_points(); register_node_type_geo_points_to_vertices(); |