diff options
author | Iyad Ahmed <iyadahmed2001> | 2022-09-19 18:13:55 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-19 18:14:08 +0300 |
commit | b6e26a410cd29f32da1e8112607a61f29c2863c4 (patch) | |
tree | 84e442d59e6e367e02961b17b79ab1d77ce7a509 /source/blender/makesrna/intern | |
parent | 0e6a8df6df28fc785ad25aef91a4599865d156f0 (diff) |
Geometry Nodes: Distribute Points in Volume
This commit adds a node to distribute points inside of volume grids.
The "Random" mode usese OpenVDB's "point scatter" implementation, and
there is also a "Grid" mode for uniform distributions. Both methods
operate on all of the float grids in the volume, using every voxel with
a value higher than the threshold. The random method is not stable as
the input volume deforms.
Based on a patch by Angus Stanton (@abstanton), which was based on a
patch by Kenzie (@kenziemac130).
Differential Revision: https://developer.blender.org/D15375
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index daae1d6f3e4..971043158e1 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -9614,6 +9614,31 @@ static void def_geo_extrude_mesh(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_geo_distribute_points_in_volume(StructRNA *srna) +{ + PropertyRNA *prop; + + static const EnumPropertyItem mode_items[] = { + {GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_RANDOM, + "DENSITY_RANDOM", + 0, + "Random", + "Distribute points randomly inside of the volume"}, + {GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_GRID, + "DENSITY_GRID", + 0, + "Grid", + "Distribute the points in a grid pattern inside of the volume"}, + {0, NULL, 0, NULL, NULL}, + }; + + RNA_def_struct_sdna_from(srna, "NodeGeometryDistributePointsInVolume", "storage"); + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for scattering points"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + static void def_geo_distribute_points_on_faces(StructRNA *srna) { PropertyRNA *prop; |