15 b.use_custom_socket_order();
16 b.allow_any_socket_order();
18 b.add_output<
decl::String>(
"String"_ustr).align_with_previous();
20 b.add_input<
decl::Int>(
"Length"_ustr).
min(0).default_value(10);
25 static auto slice_fn = mf::build::SI3_SO<std::string, int, int, std::string>(
26 "Slice", [](
const std::string &
str,
int a,
int b) {
29 str.c_str(),
str.size(), std::max(0, a +
b));
30 return str.substr(start, std::max<int>(end - start, 0));
41 ntype.
ui_description =
"Extract a string segment from a larger string";
#define NODE_CLASS_CONVERTER
#define FN_NODE_SLICE_STRING
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void set_matching_fn(const mf::MultiFunction *fn)
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
int BLI_str_utf8_offset_from_index(const char *str, size_t str_len, int index_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void common_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare