diff options
author | Jacques Lucke <jacques@blender.org> | 2021-09-27 11:16:38 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-09-27 11:17:17 +0300 |
commit | 617954c1438096810ce8e47f09c25c8311baac4d (patch) | |
tree | 8cbca34265f3ee5a867bbe206520309055aab20f /source/blender/modifiers/intern/MOD_nodes_evaluator.cc | |
parent | 547f7d23cafb682d3ac6d1348d70caef411ecc51 (diff) |
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
Diffstat (limited to 'source/blender/modifiers/intern/MOD_nodes_evaluator.cc')
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes_evaluator.cc | 20 |
1 files changed, 12 insertions, 8 deletions
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<float3>( - std::make_shared<bke::AttributeFieldInput>("position", CPPType::get<float3>())); - return; + if (bsocket.type == SOCK_VECTOR) { + if (ELEM(bnode.type, GEO_NODE_SET_POSITION, SH_NODE_TEX_NOISE)) { + new (r_value) Field<float3>( + std::make_shared<bke::AttributeFieldInput>("position", CPPType::get<float3>())); + return; + } } - if (bsocket.type == SOCK_INT && bnode.type == FN_NODE_RANDOM_VALUE) { - new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>()); - return; + else if (bsocket.type == SOCK_INT) { + if (ELEM(bnode.type, FN_NODE_RANDOM_VALUE, GEO_NODE_INSTANCE_ON_POINTS)) { + new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>()); + return; + } } } + const bNodeSocketType *typeinfo = socket.typeinfo(); typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value); } |