Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-09-20 19:56:30 +0300
committerJacques Lucke <jacques@blender.org>2021-09-20 19:56:30 +0300
commit32a4c7f188826d649b231b39baa1c1bcb7cbcbdc (patch)
tree7c1d2936c2ef0be17f202286db31c196aab6a691 /source/blender/modifiers
parenta79c33e8f8f3cac25459b703f3ad21f4eabb4455 (diff)
Geometry Nodes: implicit position input in Set Position node
This change makes the Set Position node do nothing by default. Before, the geometry would always disappear, because it all points would be moved to (0, 0, 0). Differential Revision: https://developer.blender.org/D12553
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_nodes_evaluator.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index f67f7f967c9..a215ad4d21a 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -321,6 +321,17 @@ static const CPPType *get_socket_cpp_type(const DSocket socket)
static void get_socket_value(const SocketRef &socket, void *r_value)
{
+ const bNodeSocket &bsocket = *socket.bsocket();
+ /* This is not supposed to be a long term solution. Eventually we want that nodes can specify
+ * 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 && bnode.type == GEO_NODE_SET_POSITION) {
+ new (r_value) Field<float3>(
+ std::make_shared<bke::AttributeFieldInput>("position", CPPType::get<float3>()));
+ return;
+ }
+ }
const bNodeSocketType *typeinfo = socket.typeinfo();
typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value);
}