Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/intern/node_declaration.cc
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| #include "NOD_node_declaration.hh" | #include "NOD_node_declaration.hh" | ||||
| #include "BKE_geometry_fields.hh" | #include "BKE_geometry_fields.hh" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| namespace blender::nodes { | namespace blender::nodes { | ||||
| void build_node_declaration(const bNodeType &typeinfo, NodeDeclaration &r_declaration) | |||||
| { | |||||
| NodeDeclarationBuilder node_decl_builder{r_declaration}; | |||||
| typeinfo.declare(node_decl_builder); | |||||
| node_decl_builder.finalize(); | |||||
| } | |||||
| void NodeDeclarationBuilder::finalize() | |||||
| { | |||||
| if (is_function_node_) { | |||||
| for (SocketDeclarationPtr &socket_decl : declaration_.inputs_) { | |||||
| if (socket_decl->input_field_type_ != InputSocketFieldType::Implicit) { | |||||
| socket_decl->input_field_type_ = InputSocketFieldType::IsSupported; | |||||
| } | |||||
| } | |||||
| for (SocketDeclarationPtr &socket_decl : declaration_.outputs_) { | |||||
| socket_decl->output_field_dependency_ = OutputFieldDependency::ForDependentField(); | |||||
| } | |||||
| } | |||||
| } | |||||
| bool NodeDeclaration::matches(const bNode &node) const | bool NodeDeclaration::matches(const bNode &node) const | ||||
| { | { | ||||
| auto check_sockets = [&](ListBase sockets, Span<SocketDeclarationPtr> socket_decls) { | auto check_sockets = [&](ListBase sockets, Span<SocketDeclarationPtr> socket_decls) { | ||||
| const int tot_sockets = BLI_listbase_count(&sockets); | const int tot_sockets = BLI_listbase_count(&sockets); | ||||
| if (tot_sockets != socket_decls.size()) { | if (tot_sockets != socket_decls.size()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| int i; | int i; | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||