Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes_evaluator.cc
| Show All 21 Lines | |||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "FN_field.hh" | #include "FN_field.hh" | ||||
| #include "FN_field_cpp_type.hh" | #include "FN_field_cpp_type.hh" | ||||
| #include "FN_generic_value_map.hh" | #include "FN_generic_value_map.hh" | ||||
| #include "FN_multi_function.hh" | #include "FN_multi_function.hh" | ||||
| #include "BKE_geometry_set.hh" | |||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BLI_enumerable_thread_specific.hh" | #include "BLI_enumerable_thread_specific.hh" | ||||
| #include "BLI_stack.hh" | #include "BLI_stack.hh" | ||||
| #include "BLI_task.h" | #include "BLI_task.h" | ||||
| #include "BLI_task.hh" | #include "BLI_task.hh" | ||||
| #include "BLI_vector_set.hh" | #include "BLI_vector_set.hh" | ||||
| ▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | |||||
| static const CPPType *get_socket_cpp_type(const DSocket socket) | static const CPPType *get_socket_cpp_type(const DSocket socket) | ||||
| { | { | ||||
| return get_socket_cpp_type(*socket.socket_ref()); | return get_socket_cpp_type(*socket.socket_ref()); | ||||
| } | } | ||||
| static void get_socket_value(const SocketRef &socket, void *r_value) | static void get_socket_value(const SocketRef &socket, void *r_value) | ||||
| { | { | ||||
| const NodeRef &node = socket.node(); | const NodeRef &node = socket.node(); | ||||
| if (node.declaration()) { | |||||
| const nodes::SocketDeclaration &declaration = *node.declaration()->inputs()[socket.index()]; | const nodes::SocketDeclaration &declaration = *node.declaration()->inputs()[socket.index()]; | ||||
| /* This is not supposed to be a long term solution. Eventually we want that nodes can specify | /* 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. | * more complex defaults (other than just single values) in their socket declarations. | ||||
| * For now, assume all vector sockets with implicit inputs need the position, | * For now, assume all vector sockets with implicit inputs need the position, | ||||
| * and all integer sockets with an implicit input need the index. */ | * and all integer sockets with an implicit input need the index. */ | ||||
| if (declaration.input_field_type() == nodes::InputSocketFieldType::Implicit) { | if (declaration.input_field_type() == nodes::InputSocketFieldType::Implicit) { | ||||
| if (socket.typeinfo()->type == SOCK_VECTOR) { | if (socket.typeinfo()->type == SOCK_VECTOR) { | ||||
| const bNode &bnode = *socket.bnode(); | const bNode &bnode = *socket.bnode(); | ||||
| if (bnode.type == GEO_NODE_SET_CURVE_HANDLES) { | if (bnode.type == GEO_NODE_SET_CURVE_HANDLES) { | ||||
| StringRef side = ((NodeGeometrySetCurveHandlePositions *)bnode.storage)->mode == | StringRef side = ((NodeGeometrySetCurveHandlePositions *)bnode.storage)->mode == | ||||
| GEO_NODE_CURVE_HANDLE_LEFT ? | GEO_NODE_CURVE_HANDLE_LEFT ? | ||||
| "handle_left" : | "handle_left" : | ||||
| "handle_right"; | "handle_right"; | ||||
| new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>(side)); | new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>(side)); | ||||
| return; | return; | ||||
| } | } | ||||
| new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>("position")); | new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>("position")); | ||||
| return; | return; | ||||
| } | } | ||||
| if (socket.typeinfo()->type == SOCK_INT) { | if (socket.typeinfo()->type == SOCK_INT) { | ||||
| new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>()); | new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>()); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| const bNodeSocketType *typeinfo = socket.typeinfo(); | const bNodeSocketType *typeinfo = socket.typeinfo(); | ||||
| typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value); | typeinfo->get_geometry_nodes_cpp_value(*socket.bsocket(), r_value); | ||||
| } | } | ||||
| static bool node_supports_laziness(const DNode node) | static bool node_supports_laziness(const DNode node) | ||||
| { | { | ||||
| return node->typeinfo()->geometry_node_execute_supports_laziness; | return node->typeinfo()->geometry_node_execute_supports_laziness; | ||||
| ▲ Show 20 Lines • Show All 1,334 Lines • Show Last 20 Lines | |||||