Cleanup: use more concise function names in function nodes

This is the same naming convention that's used for geometry nodes.
This commit is contained in:
Jacques Lucke 2022-11-24 12:49:17 +01:00
parent 369914e7b1
commit 5f626ac331
18 changed files with 141 additions and 152 deletions

View File

@ -12,7 +12,7 @@
namespace blender::nodes::node_fn_align_euler_to_vector_cc {
static void fn_node_align_euler_to_vector_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).hide_value();
@ -25,9 +25,7 @@ static void fn_node_align_euler_to_vector_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Rotation")).subtype(PROP_EULER);
}
static void fn_node_align_euler_to_vector_layout(uiLayout *layout,
bContext * /*C*/,
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "axis", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiLayoutSetPropSep(layout, true);
@ -188,7 +186,7 @@ class MF_AlignEulerToVector : public fn::MultiFunction {
}
};
static void fn_node_align_euler_to_vector_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &node = builder.node();
builder.construct_and_set_matching_fn<MF_AlignEulerToVector>(node.custom1, node.custom2);
@ -204,8 +202,8 @@ void register_node_type_fn_align_euler_to_vector()
fn_node_type_base(
&ntype, FN_NODE_ALIGN_EULER_TO_VECTOR, "Align Euler to Vector", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_align_euler_to_vector_declare;
ntype.draw_buttons = file_ns::fn_node_align_euler_to_vector_layout;
ntype.build_multi_function = file_ns::fn_node_align_euler_to_vector_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -14,7 +14,7 @@
namespace blender::nodes::node_fn_boolean_math_cc {
static void fn_node_boolean_math_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Bool>(N_("Boolean"), "Boolean");
@ -22,22 +22,19 @@ static void fn_node_boolean_math_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Bool>(N_("Boolean"));
}
static void fn_node_boolean_math_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void node_boolean_math_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sockB = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
nodeSetSocketAvailability(ntree, sockB, !ELEM(node->custom1, NODE_BOOLEAN_MATH_NOT));
}
static void node_boolean_math_label(const bNodeTree * /*tree*/,
const bNode *node,
char *label,
int maxlen)
static void node_label(const bNodeTree * /*tree*/, const bNode *node, char *label, int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_boolean_math_items, node->custom1, &name);
@ -114,7 +111,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
return nullptr;
}
static void fn_node_boolean_math_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const fn::MultiFunction *fn = get_multi_function(builder.node());
builder.set_matching_fn(fn);
@ -129,11 +126,11 @@ void register_node_type_fn_boolean_math()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_boolean_math_declare;
ntype.labelfunc = file_ns::node_boolean_math_label;
ntype.updatefunc = file_ns::node_boolean_math_update;
ntype.build_multi_function = file_ns::fn_node_boolean_math_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_boolean_math_layout;
ntype.declare = file_ns::node_declare;
ntype.labelfunc = file_ns::node_label;
ntype.updatefunc = file_ns::node_update;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
nodeRegisterType(&ntype);
}

View File

@ -5,11 +5,11 @@
#include "UI_interface.h"
#include "UI_resources.h"
namespace blender::nodes {
namespace blender::nodes::node_fn_combine_color_cc {
NODE_STORAGE_FUNCS(NodeCombSepColor)
static void fn_node_combine_color_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Float>(N_("Red")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
@ -31,18 +31,18 @@ static void fn_node_combine_color_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>(N_("Color"));
};
static void fn_node_combine_color_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", 0, "", ICON_NONE);
}
static void fn_node_combine_color_update(bNodeTree * /*tree*/, bNode *node)
static void node_update(bNodeTree * /*tree*/, bNode *node)
{
const NodeCombSepColor &storage = node_storage(*node);
node_combsep_color_label(&node->inputs, (NodeCombSepColorMode)storage.mode);
}
static void fn_node_combine_color_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeCombSepColor *data = MEM_cnew<NodeCombSepColor>(__func__);
data->mode = NODE_COMBSEP_COLOR_RGB;
@ -83,26 +83,28 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
return nullptr;
}
static void fn_node_combine_color_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const fn::MultiFunction *fn = get_multi_function(builder.node());
builder.set_matching_fn(fn);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_fn_combine_color_cc
void register_node_type_fn_combine_color(void)
{
namespace file_ns = blender::nodes::node_fn_combine_color_cc;
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_COMBINE_COLOR, "Combine Color", NODE_CLASS_CONVERTER);
ntype.declare = blender::nodes::fn_node_combine_color_declare;
ntype.updatefunc = blender::nodes::fn_node_combine_color_update;
ntype.initfunc = blender::nodes::fn_node_combine_color_init;
ntype.declare = file_ns::node_declare;
ntype.updatefunc = file_ns::node_update;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = blender::nodes::fn_node_combine_color_build_multi_function;
ntype.draw_buttons = blender::nodes::fn_node_combine_color_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -19,7 +19,7 @@ namespace blender::nodes::node_fn_compare_cc {
NODE_STORAGE_FUNCS(NodeFunctionCompare)
static void fn_node_compare_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Float>(N_("A")).min(-10000.0f).max(10000.0f);
@ -44,7 +44,7 @@ static void fn_node_compare_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Bool>(N_("Result"));
}
static void geo_node_compare_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
const NodeFunctionCompare &data = node_storage(*static_cast<const bNode *>(ptr->data));
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
@ -54,7 +54,7 @@ static void geo_node_compare_layout(uiLayout *layout, bContext * /*C*/, PointerR
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void node_compare_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage;
@ -82,7 +82,7 @@ static void node_compare_update(bNodeTree *ntree, bNode *node)
data->data_type == SOCK_VECTOR);
}
static void node_compare_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeFunctionCompare *data = MEM_cnew<NodeFunctionCompare>(__func__);
data->operation = NODE_COMPARE_GREATER_THAN;
@ -107,7 +107,7 @@ class SocketSearchOp {
}
};
static void node_compare_gather_link_searches(GatherLinkSearchOpParams &params)
static void node_gather_link_searches(GatherLinkSearchOpParams &params)
{
const eNodeSocketDatatype type = static_cast<eNodeSocketDatatype>(params.other_socket().type);
if (!ELEM(type, SOCK_BOOLEAN, SOCK_FLOAT, SOCK_RGBA, SOCK_VECTOR, SOCK_INT, SOCK_STRING)) {
@ -148,10 +148,7 @@ static void node_compare_gather_link_searches(GatherLinkSearchOpParams &params)
}
}
static void node_compare_label(const bNodeTree * /*tree*/,
const bNode *node,
char *label,
int maxlen)
static void node_label(const bNodeTree * /*tree*/, const bNode *node, char *label, int maxlen)
{
const NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage;
const char *name;
@ -566,7 +563,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
return nullptr;
}
static void fn_node_compare_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const fn::MultiFunction *fn = get_multi_function(builder.node());
builder.set_matching_fn(fn);
@ -580,14 +577,14 @@ void register_node_type_fn_compare()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_compare_declare;
ntype.labelfunc = file_ns::node_compare_label;
ntype.updatefunc = file_ns::node_compare_update;
ntype.initfunc = file_ns::node_compare_init;
ntype.declare = file_ns::node_declare;
ntype.labelfunc = file_ns::node_label;
ntype.updatefunc = file_ns::node_update;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeFunctionCompare", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_compare_build_multi_function;
ntype.draw_buttons = file_ns::geo_node_compare_layout;
ntype.gather_link_search_ops = file_ns::node_compare_gather_link_searches;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
ntype.gather_link_search_ops = file_ns::node_gather_link_searches;
nodeRegisterType(&ntype);
}

View File

@ -14,22 +14,19 @@
namespace blender::nodes::node_fn_float_to_int_cc {
static void fn_node_float_to_int_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Float>(N_("Float"));
b.add_output<decl::Int>(N_("Integer"));
}
static void fn_node_float_to_int_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "rounding_mode", 0, "", ICON_NONE);
}
static void node_float_to_int_label(const bNodeTree * /*tree*/,
const bNode *node,
char *label,
int maxlen)
static void node_label(const bNodeTree * /*tree*/, const bNode *node, char *label, int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_float_to_int_items, node->custom1, &name);
@ -66,7 +63,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
return nullptr;
}
static void fn_node_float_to_int_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const fn::MultiFunction *fn = get_multi_function(builder.node());
builder.set_matching_fn(fn);
@ -81,9 +78,9 @@ void register_node_type_fn_float_to_int()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, "Float to Integer", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_float_to_int_declare;
ntype.labelfunc = file_ns::node_float_to_int_label;
ntype.build_multi_function = file_ns::fn_node_float_to_int_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_float_to_int_layout;
ntype.declare = file_ns::node_declare;
ntype.labelfunc = file_ns::node_label;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -9,25 +9,25 @@
namespace blender::nodes::node_fn_input_bool_cc {
static void fn_node_input_bool_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Bool>(N_("Boolean"));
}
static void fn_node_input_bool_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "boolean", UI_ITEM_R_EXPAND, IFACE_("Value"), ICON_NONE);
}
static void fn_node_input_bool_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
NodeInputBool *node_storage = static_cast<NodeInputBool *>(bnode.storage);
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<bool>>(node_storage->boolean);
}
static void fn_node_input_bool_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeInputBool *data = MEM_cnew<NodeInputBool>(__func__);
node->storage = data;
@ -42,11 +42,11 @@ void register_node_type_fn_input_bool()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_INPUT_BOOL, "Boolean", 0);
ntype.declare = file_ns::fn_node_input_bool_declare;
ntype.initfunc = file_ns::fn_node_input_bool_init;
ntype.declare = file_ns::node_declare;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeInputBool", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_bool_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_input_bool_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -9,19 +9,18 @@
namespace blender::nodes::node_fn_input_color_cc {
static void fn_node_input_color_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Color>(N_("Color"));
}
static void fn_node_input_color_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiTemplateColorPicker(layout, ptr, "color", true, false, false, true);
uiItemR(layout, ptr, "color", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
}
static void fn_node_input_color_build_multi_function(
blender::nodes::NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
NodeInputColor *node_storage = static_cast<NodeInputColor *>(bnode.storage);
@ -29,7 +28,7 @@ static void fn_node_input_color_build_multi_function(
builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<ColorGeometry4f>>(color);
}
static void fn_node_input_color_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeInputColor *data = MEM_cnew<NodeInputColor>(__func__);
copy_v4_fl4(data->color, 0.5f, 0.5f, 0.5f, 1.0f);
@ -45,11 +44,11 @@ void register_node_type_fn_input_color()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_INPUT_COLOR, "Color", NODE_CLASS_INPUT);
ntype.declare = file_ns::fn_node_input_color_declare;
ntype.initfunc = file_ns::fn_node_input_color_init;
ntype.declare = file_ns::node_declare;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeInputColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_color_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_input_color_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -9,25 +9,25 @@
namespace blender::nodes::node_fn_input_int_cc {
static void fn_node_input_int_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Int>(N_("Integer"));
}
static void fn_node_input_int_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "integer", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
static void fn_node_input_int_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
NodeInputInt *node_storage = static_cast<NodeInputInt *>(bnode.storage);
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<int>>(node_storage->integer);
}
static void fn_node_input_int_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeInputInt *data = MEM_cnew<NodeInputInt>(__func__);
node->storage = data;
@ -42,11 +42,11 @@ void register_node_type_fn_input_int()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_INPUT_INT, "Integer", 0);
ntype.declare = file_ns::fn_node_input_int_declare;
ntype.initfunc = file_ns::fn_node_input_int_init;
ntype.declare = file_ns::node_declare;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeInputInt", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_int_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_input_int_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -4,7 +4,7 @@
namespace blender::nodes::node_fn_input_special_characters_cc {
static void fn_node_input_special_characters_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::String>(N_("Line Break"));
b.add_output<decl::String>(N_("Tab"));
@ -38,8 +38,7 @@ class MF_SpecialCharacters : public fn::MultiFunction {
}
};
static void fn_node_input_special_characters_build_multi_function(
NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static MF_SpecialCharacters special_characters_fn;
builder.set_matching_fn(special_characters_fn);
@ -55,7 +54,7 @@ void register_node_type_fn_input_special_characters()
fn_node_type_base(
&ntype, FN_NODE_INPUT_SPECIAL_CHARACTERS, "Special Characters", NODE_CLASS_INPUT);
ntype.declare = file_ns::fn_node_input_special_characters_declare;
ntype.build_multi_function = file_ns::fn_node_input_special_characters_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -7,18 +7,18 @@
namespace blender::nodes::node_fn_input_string_cc {
static void fn_node_input_string_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_output<decl::String>(N_("String"));
}
static void fn_node_input_string_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "string", 0, "", ICON_NONE);
}
static void fn_node_input_string_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
NodeInputString *node_storage = static_cast<NodeInputString *>(bnode.storage);
@ -26,12 +26,12 @@ static void fn_node_input_string_build_multi_function(NodeMultiFunctionBuilder &
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<std::string>>(std::move(string));
}
static void fn_node_input_string_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
node->storage = MEM_callocN(sizeof(NodeInputString), __func__);
}
static void fn_node_input_string_free(bNode *node)
static void node_storage_free(bNode *node)
{
NodeInputString *storage = (NodeInputString *)node->storage;
if (storage == nullptr) {
@ -43,7 +43,7 @@ static void fn_node_input_string_free(bNode *node)
MEM_freeN(storage);
}
static void fn_node_string_copy(bNodeTree * /*dst_ntree*/, bNode *dest_node, const bNode *src_node)
static void node_storage_copy(bNodeTree * /*dst_ntree*/, bNode *dest_node, const bNode *src_node)
{
NodeInputString *source_storage = (NodeInputString *)src_node->storage;
NodeInputString *destination_storage = (NodeInputString *)MEM_dupallocN(source_storage);
@ -64,11 +64,11 @@ void register_node_type_fn_input_string()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_INPUT_STRING, "String", NODE_CLASS_INPUT);
ntype.declare = file_ns::fn_node_input_string_declare;
ntype.initfunc = file_ns::fn_node_input_string_init;
ntype.declare = file_ns::node_declare;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeInputString", file_ns::fn_node_input_string_free, file_ns::fn_node_string_copy);
ntype.build_multi_function = file_ns::fn_node_input_string_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_input_string_layout;
&ntype, "NodeInputString", file_ns::node_storage_free, file_ns::node_storage_copy);
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -9,18 +9,18 @@
namespace blender::nodes::node_fn_input_vector_cc {
static void fn_node_input_vector_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Vector>(N_("Vector"));
}
static void fn_node_input_vector_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "vector", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
static void fn_node_input_vector_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const bNode &bnode = builder.node();
NodeInputVector *node_storage = static_cast<NodeInputVector *>(bnode.storage);
@ -28,7 +28,7 @@ static void fn_node_input_vector_build_multi_function(NodeMultiFunctionBuilder &
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<float3>>(vector);
}
static void fn_node_input_vector_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeInputVector *data = MEM_cnew<NodeInputVector>(__func__);
node->storage = data;
@ -43,11 +43,11 @@ void register_node_type_fn_input_vector()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_INPUT_VECTOR, "Vector", 0);
ntype.declare = file_ns::fn_node_input_vector_declare;
ntype.initfunc = file_ns::fn_node_input_vector_init;
ntype.declare = file_ns::node_declare;
ntype.initfunc = file_ns::node_init;
node_type_storage(
&ntype, "NodeInputVector", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = file_ns::fn_node_input_vector_build_multi_function;
ntype.draw_buttons = file_ns::fn_node_input_vector_layout;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -14,7 +14,7 @@ namespace blender::nodes::node_fn_random_value_cc {
NODE_STORAGE_FUNCS(NodeRandomValue)
static void fn_node_random_value_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Vector>(N_("Min")).supports_field();
b.add_input<decl::Vector>(N_("Max")).default_value({1.0f, 1.0f, 1.0f}).supports_field();
@ -42,7 +42,7 @@ static void fn_node_random_value_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Bool>(N_("Value"), "Value_003").dependent_field();
}
static void fn_node_random_value_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
}
@ -103,7 +103,7 @@ static std::optional<eCustomDataType> node_type_from_other_socket(const bNodeSoc
}
}
static void fn_node_random_value_gather_link_search(GatherLinkSearchOpParams &params)
static void node_gather_link_search_ops(GatherLinkSearchOpParams &params)
{
const NodeDeclaration &declaration = *params.node_type().fixed_declaration;
const std::optional<eCustomDataType> type = node_type_from_other_socket(params.other_socket());
@ -134,7 +134,7 @@ static void fn_node_random_value_gather_link_search(GatherLinkSearchOpParams &pa
}
}
static void fn_node_random_value_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const NodeRandomValue &storage = node_storage(builder.node());
const eCustomDataType data_type = static_cast<eCustomDataType>(storage.data_type);
@ -220,10 +220,10 @@ void register_node_type_fn_random_value()
fn_node_type_base(&ntype, FN_NODE_RANDOM_VALUE, "Random Value", NODE_CLASS_CONVERTER);
ntype.initfunc = file_ns::fn_node_random_value_init;
ntype.updatefunc = file_ns::fn_node_random_value_update;
ntype.draw_buttons = file_ns::fn_node_random_value_layout;
ntype.declare = file_ns::fn_node_random_value_declare;
ntype.build_multi_function = file_ns::fn_node_random_value_build_multi_function;
ntype.gather_link_search_ops = file_ns::fn_node_random_value_gather_link_search;
ntype.draw_buttons = file_ns::node_layout;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
ntype.gather_link_search_ops = file_ns::node_gather_link_search_ops;
node_type_storage(
&ntype, "NodeRandomValue", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);

View File

@ -6,7 +6,7 @@
namespace blender::nodes::node_fn_replace_string_cc {
static void fn_node_replace_string_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::String>(N_("String"));
b.add_input<decl::String>(N_("Find")).description(N_("The string to find in the input string"));
@ -28,7 +28,7 @@ static std::string replace_all(const StringRefNull str,
return new_str;
}
static void fn_node_replace_string_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static fn::CustomMF_SI_SI_SI_SO<std::string, std::string, std::string, std::string> substring_fn{
"Replace", [](const std::string &str, const std::string &find, const std::string &replace) {
@ -46,7 +46,7 @@ void register_node_type_fn_replace_string()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_REPLACE_STRING, "Replace String", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_replace_string_declare;
ntype.build_multi_function = file_ns::fn_node_replace_string_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -13,7 +13,7 @@
namespace blender::nodes::node_fn_rotate_euler_cc {
static void fn_node_rotate_euler_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
auto enable_axis_angle = [](bNode &node) {
node.custom1 = FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE;
@ -32,7 +32,7 @@ static void fn_node_rotate_euler_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Rotation"));
}
static void fn_node_rotate_euler_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *rotate_by_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 1));
bNodeSocket *axis_socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, 2));
@ -46,7 +46,7 @@ static void fn_node_rotate_euler_update(bNodeTree *ntree, bNode *node)
ntree, angle_socket, ELEM(node->custom1, FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE));
}
static void fn_node_rotate_euler_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "type", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiItemR(layout, ptr, "space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
@ -115,7 +115,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
return nullptr;
}
static void fn_node_rotate_euler_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const fn::MultiFunction *fn = get_multi_function(builder.node());
builder.set_matching_fn(fn);
@ -130,9 +130,9 @@ void register_node_type_fn_rotate_euler()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_ROTATE_EULER, "Rotate Euler", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_rotate_euler_declare;
ntype.draw_buttons = file_ns::fn_node_rotate_euler_layout;
ntype.updatefunc = file_ns::fn_node_rotate_euler_update;
ntype.build_multi_function = file_ns::fn_node_rotate_euler_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.updatefunc = file_ns::node_update;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -9,7 +9,7 @@ namespace blender::nodes {
NODE_STORAGE_FUNCS(NodeCombSepColor)
static void fn_node_separate_color_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.is_function_node();
b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f});
@ -19,18 +19,18 @@ static void fn_node_separate_color_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Alpha"));
};
static void fn_node_separate_color_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", 0, "", ICON_NONE);
}
static void fn_node_separate_color_update(bNodeTree * /*tree*/, bNode *node)
static void node_update(bNodeTree * /*tree*/, bNode *node)
{
const NodeCombSepColor &storage = node_storage(*node);
node_combsep_color_label(&node->outputs, (NodeCombSepColorMode)storage.mode);
}
static void fn_node_separate_color_init(bNodeTree * /*tree*/, bNode *node)
static void node_init(bNodeTree * /*tree*/, bNode *node)
{
NodeCombSepColor *data = MEM_cnew<NodeCombSepColor>(__func__);
data->mode = NODE_COMBSEP_COLOR_RGB;
@ -178,7 +178,7 @@ class SeparateHSLAFunction : public fn::MultiFunction {
}
};
static void fn_node_separate_color_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
const NodeCombSepColor &storage = node_storage(builder.node());
@ -212,13 +212,13 @@ void register_node_type_fn_separate_color(void)
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_SEPARATE_COLOR, "Separate Color", NODE_CLASS_CONVERTER);
ntype.declare = blender::nodes::fn_node_separate_color_declare;
ntype.updatefunc = blender::nodes::fn_node_separate_color_update;
ntype.initfunc = blender::nodes::fn_node_separate_color_init;
ntype.declare = blender::nodes::node_declare;
ntype.updatefunc = blender::nodes::node_update;
ntype.initfunc = blender::nodes::node_init;
node_type_storage(
&ntype, "NodeCombSepColor", node_free_standard_storage, node_copy_standard_storage);
ntype.build_multi_function = blender::nodes::fn_node_separate_color_build_multi_function;
ntype.draw_buttons = blender::nodes::fn_node_separate_color_layout;
ntype.build_multi_function = blender::nodes::node_build_multi_function;
ntype.draw_buttons = blender::nodes::node_layout;
nodeRegisterType(&ntype);
}

View File

@ -6,7 +6,7 @@
namespace blender::nodes::node_fn_slice_string_cc {
static void fn_node_slice_string_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::String>(N_("String"));
b.add_input<decl::Int>(N_("Position"));
@ -14,7 +14,7 @@ static void fn_node_slice_string_declare(NodeDeclarationBuilder &b)
b.add_output<decl::String>(N_("String"));
}
static void fn_node_slice_string_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static fn::CustomMF_SI_SI_SI_SO<std::string, int, int, std::string> slice_fn{
"Slice", [](const std::string &str, int a, int b) {
@ -35,7 +35,7 @@ void register_node_type_fn_slice_string()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_SLICE_STRING, "Slice String", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_slice_string_declare;
ntype.build_multi_function = file_ns::fn_node_slice_string_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -8,13 +8,13 @@
namespace blender::nodes::node_fn_string_length_cc {
static void fn_node_string_length_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::String>(N_("String"));
b.add_output<decl::Int>(N_("Length"));
}
static void fn_node_string_length_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static fn::CustomMF_SI_SO<std::string, int> str_len_fn{
"String Length", [](const std::string &a) { return BLI_strlen_utf8(a.c_str()); }};
@ -30,7 +30,7 @@ void register_node_type_fn_string_length()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_STRING_LENGTH, "String Length", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_string_length_declare;
ntype.build_multi_function = file_ns::fn_node_string_length_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}

View File

@ -5,14 +5,14 @@
namespace blender::nodes::node_fn_value_to_string_cc {
static void fn_node_value_to_string_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>(N_("Value"));
b.add_input<decl::Int>(N_("Decimals")).min(0);
b.add_output<decl::String>(N_("String"));
}
static void fn_node_value_to_string_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
{
static fn::CustomMF_SI_SI_SO<float, int, std::string> to_str_fn{
"Value To String", [](float a, int b) {
@ -32,7 +32,7 @@ void register_node_type_fn_value_to_string()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_VALUE_TO_STRING, "Value to String", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::fn_node_value_to_string_declare;
ntype.build_multi_function = file_ns::fn_node_value_to_string_build_multi_function;
ntype.declare = file_ns::node_declare;
ntype.build_multi_function = file_ns::node_build_multi_function;
nodeRegisterType(&ntype);
}