Blender V4.3
node_fn_string_length.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
5#include "BLI_string_utf8.h"
6
7#include <iomanip>
8
10
12
14{
15 b.add_input<decl::String>("String").hide_label();
16 b.add_output<decl::Int>("Length");
17}
18
20{
21 static auto str_len_fn = mf::build::SI1_SO<std::string, int>(
22 "String Length", [](const std::string &a) { return BLI_strlen_utf8(a.c_str()); });
23 builder.set_matching_fn(&str_len_fn);
24}
25
26static void node_register()
27{
28 static blender::bke::bNodeType ntype;
29
30 fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, "String Length", NODE_CLASS_CONVERTER);
31 ntype.declare = node_declare;
34}
36
37} // namespace blender::nodes::node_fn_string_length_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void set_matching_fn(const mf::MultiFunction *fn)
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_declare(NodeDeclarationBuilder &b)
void fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:336
NodeDeclareFunction declare
Definition BKE_node.hh:347