From 3deb21055ad16618b80297b7a82bca46b7b9c1f9 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 18 Dec 2020 16:00:45 +0100 Subject: 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. --- source/blender/editors/space_node/drawnode.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors/space_node/drawnode.c') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b6744719cad..652c70155ab 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3196,6 +3196,9 @@ static void node_geometry_buts_point_instance(uiLayout *layout, PointerRNA *ptr) { uiItemR(layout, ptr, "instance_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + if (RNA_enum_get(ptr, "instance_type") == GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION) { + uiItemR(layout, ptr, "use_whole_collection", DEFAULT_FLAGS, NULL, ICON_NONE); + } } static void node_geometry_buts_attribute_fill(uiLayout *layout, -- cgit v1.2.3