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:
-rw-r--r--source/blender/modifiers/intern/MOD_nodes_evaluator.cc53
1 files changed, 29 insertions, 24 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 3c51ef83311..20ee6127504 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -17,6 +17,7 @@
#include "MOD_nodes_evaluator.hh"
#include "NOD_geometry_exec.hh"
+#include "NOD_socket_declarations.hh"
#include "NOD_type_conversions.hh"
#include "DEG_depsgraph_query.h"
@@ -321,41 +322,45 @@ static const CPPType *get_socket_cpp_type(const DSocket socket)
return get_socket_cpp_type(*socket.socket_ref());
}
-static void get_socket_value(const SocketRef &socket, void *r_value)
+/**
+ * \note 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.
+ */
+static bool get_implicit_socket_input(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) {
- if (ELEM(bnode.type,
- GEO_NODE_SET_POSITION,
- SH_NODE_TEX_GRADIENT,
- SH_NODE_TEX_NOISE,
- SH_NODE_TEX_VORONOI,
- SH_NODE_TEX_WHITE_NOISE,
- GEO_NODE_MESH_TO_POINTS,
- GEO_NODE_PROXIMITY)) {
- new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>("position"));
- return;
- }
+ const NodeRef &node = socket.node();
+ const nodes::NodeDeclaration *node_declaration = node.declaration();
+ if (node_declaration == nullptr) {
+ return false;
+ }
+ const nodes::SocketDeclaration &socket_declaration = *node_declaration->inputs()[socket.index()];
+ if (socket_declaration.input_field_type() == nodes::InputSocketFieldType::Implicit) {
+ if (socket.typeinfo()->type == SOCK_VECTOR) {
+ const bNode &bnode = *socket.bnode();
if (bnode.type == GEO_NODE_SET_CURVE_HANDLES) {
StringRef side = ((NodeGeometrySetCurveHandlePositions *)bnode.storage)->mode ==
GEO_NODE_CURVE_HANDLE_LEFT ?
"handle_left" :
"handle_right";
new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>(side));
- return;
+ return true;
}
+ new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>("position"));
+ return true;
}
- 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;
- }
+ if (socket.typeinfo()->type == SOCK_INT) {
+ new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>());
+ return true;
}
}
+ return false;
+}
+
+static void get_socket_value(const SocketRef &socket, void *r_value)
+{
+ if (get_implicit_socket_input(socket, r_value)) {
+ return;
+ }
const bNodeSocketType *typeinfo = socket.typeinfo();
typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value);