diff options
author | Jacques Lucke <jacques@blender.org> | 2020-12-18 18:00:45 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-12-18 18:02:23 +0300 |
commit | 3deb21055ad16618b80297b7a82bca46b7b9c1f9 (patch) | |
tree | 9fa16b08fae7acf764386b1a4e5c4809c53e1684 /source/blender/makesrna/intern | |
parent | 1be465cccbf96c64e5a90962bd2c76cbc7675fb0 (diff) |
Geometry Nodes: support randomly picking instances from collection
This uses the "id" attribute to randomly pick instances from a collection
for each point.
There is one issue. When the collection is updated (e.g. when an object is
added to it), the nodes modifier is not automatically updated. It seems
like we don't have the infrastructure to support this dependency yet.
The same issue exists in the Boolean modifier and with collision collections.
This should be solved separately soonish.
When "Whole Collection" is disabled, one direct child of the input collection
is instanced at each point. A direct child can be an object or a collection.
Currently, all objects are picked approximately equally often. In the future,
we will provide more control over which point gets which instance.
Differential Revision: https://developer.blender.org/D9884
Ref T82372.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 25bfc70ef8f..cbd677582a9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -8502,6 +8502,11 @@ static void def_geo_point_instance(StructRNA *srna) RNA_def_property_enum_default(prop, GEO_NODE_POINT_INSTANCE_TYPE_OBJECT); RNA_def_property_ui_text(prop, "Instance Type", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1); + RNA_def_property_ui_text(prop, "Whole Collection", "Instance entire collection on each point"); + RNA_def_property_update(prop, 0, "rna_Node_socket_update"); } static void def_geo_attribute_mix(StructRNA *srna) |