Blender V4.3
node_geo_string_join.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8
10{
11 b.add_input<decl::String>("Delimiter");
12 b.add_input<decl::String>("Strings").multi_input().hide_value();
13 b.add_output<decl::String>("String");
14}
15
17{
18 Vector<SocketValueVariant> strings = params.extract_input<Vector<SocketValueVariant>>("Strings");
19 const std::string delim = params.extract_input<std::string>("Delimiter");
20
21 std::string output;
22 for (const int i : strings.index_range()) {
23 output += strings[i].extract<std::string>();
24 if (i < (strings.size() - 1)) {
25 output += delim;
26 }
27 }
28 params.set_output("String", std::move(output));
29}
30
31static void node_register()
32{
33 static blender::bke::bNodeType ntype;
34
35 geo_node_type_base(&ntype, GEO_NODE_STRING_JOIN, "Join Strings", NODE_CLASS_CONVERTER);
37 ntype.declare = node_declare;
39}
41
42} // namespace blender::nodes::node_geo_string_join_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define output
local_group_size(16, 16) .push_constant(Type b
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:339
NodeDeclareFunction declare
Definition BKE_node.hh:347