Blender V5.0
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.use_custom_socket_order();
12 b.allow_any_socket_order();
13 b.add_input<decl::String>("Delimiter");
14 b.add_input<decl::String>("Strings").multi_input().hide_value();
15 b.add_output<decl::String>("String").align_with_previous();
16}
17
19{
20 auto strings = params.extract_input<GeoNodesMultiInput<std::string>>("Strings");
21 const std::string delim = params.extract_input<std::string>("Delimiter");
22
23 std::string output;
24 for (const int i : strings.values.index_range()) {
25 output += strings.values[i];
26 if (i < (strings.values.size() - 1)) {
27 output += delim;
28 }
29 }
30 params.set_output("String", std::move(output));
31}
32
33static void node_register()
34{
35 static blender::bke::bNodeType ntype;
36
37 geo_node_type_base(&ntype, "GeometryNodeStringJoin", GEO_NODE_STRING_JOIN);
38 ntype.ui_name = "Join Strings";
39 ntype.ui_description = "Combine any number of input strings";
40 ntype.enum_name_legacy = "STRING_JOIN";
43 ntype.declare = node_declare;
45}
47
48} // namespace blender::nodes::node_geo_string_join_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:453
#define GEO_NODE_STRING_JOIN
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define output
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:354
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362
i
Definition text_draw.cc:230