Blender  V3.3
node_geo_string_join.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "node_geometry_util.hh"
4 
6 
8 {
9  b.add_input<decl::String>(N_("Delimiter"));
10  b.add_input<decl::String>(N_("Strings")).multi_input().hide_value();
11  b.add_output<decl::String>(N_("String"));
12 }
13 
15 {
16  Vector<std::string> strings = params.extract_multi_input<std::string>("Strings");
17  const std::string delim = params.extract_input<std::string>("Delimiter");
18 
19  std::string output;
20  for (const int i : strings.index_range()) {
21  output += strings[i];
22  if (i < (strings.size() - 1)) {
23  output += delim;
24  }
25  }
26  params.set_output("String", std::move(output));
27 }
28 
29 } // namespace blender::nodes::node_geo_string_join_cc
30 
32 {
33  namespace file_ns = blender::nodes::node_geo_string_join_cc;
34 
35  static bNodeType ntype;
36 
40  nodeRegisterType(&ntype);
41 }
#define GEO_NODE_STRING_JOIN
Definition: BKE_node.h:1429
#define NODE_CLASS_CONVERTER
Definition: BKE_node.h:351
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
int64_t size() const
Definition: BLI_vector.hh:694
IndexRange index_range() const
Definition: BLI_vector.hh:920
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_global KernelShaderEvalInput ccl_global float * output
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_string_join()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition: BKE_node.h:226
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:316
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)