From 617954c1438096810ce8e47f09c25c8311baac4d Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 27 Sep 2021 10:16:38 +0200 Subject: Geometry Nodes: new Instance on Points node This adds a new Instance on Points node that is a replacement for the old Point Instance node. Contrary to the old node, it does not have a mode to instance objects or collections directly. Instead, the node has to be used with an Object/ Collection Info to achieve the same effect. Rotation and scale of the instances can be adjusted in the node directly or can be controlled with a field to get some variation between instances. The node supports placing different instances on different points. The user has control over which instance is placed on which point using an Instance Index input. If that functionality is used, the Instance Geometry has to contain multiple instances that can are instanced separately. Differential Revision: https://developer.blender.org/D12478 --- .../blender/modifiers/intern/MOD_nodes_evaluator.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc index fd0205cffc5..6f18c4d40db 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc @@ -328,17 +328,21 @@ static void get_socket_value(const SocketRef &socket, void *r_value) * more complex defaults (other than just single values) in their socket declarations. */ if (bsocket.flag & SOCK_HIDE_VALUE) { const bNode &bnode = *socket.bnode(); - if (bsocket.type == SOCK_VECTOR && - ELEM(bnode.type, GEO_NODE_SET_POSITION, SH_NODE_TEX_NOISE)) { - new (r_value) Field( - std::make_shared("position", CPPType::get())); - return; + if (bsocket.type == SOCK_VECTOR) { + if (ELEM(bnode.type, GEO_NODE_SET_POSITION, SH_NODE_TEX_NOISE)) { + new (r_value) Field( + std::make_shared("position", CPPType::get())); + return; + } } - if (bsocket.type == SOCK_INT && bnode.type == FN_NODE_RANDOM_VALUE) { - new (r_value) Field(std::make_shared()); - return; + else if (bsocket.type == SOCK_INT) { + if (ELEM(bnode.type, FN_NODE_RANDOM_VALUE, GEO_NODE_INSTANCE_ON_POINTS)) { + new (r_value) Field(std::make_shared()); + return; + } } } + const bNodeSocketType *typeinfo = socket.typeinfo(); typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value); } -- cgit v1.2.3