[Bf-blender-cvs] [5f626ac331e] master: Cleanup: use more concise function names in function nodes

Jacques Lucke noreply at git.blender.org
Thu Nov 24 12:49:44 CET 2022


Commit: 5f626ac331ef8bc48d6db30d43aaa3d54f931987
Author: Jacques Lucke
Date:   Thu Nov 24 12:49:17 2022 +0100
Branches: master
https://developer.blender.org/rB5f626ac331ef8bc48d6db30d43aaa3d54f931987

Cleanup: use more concise function names in function nodes

This is the same naming convention that's used for geometry nodes.

===================================================================

M	source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
M	source/blender/nodes/function/nodes/node_fn_boolean_math.cc
M	source/blender/nodes/function/nodes/node_fn_combine_color.cc
M	source/blender/nodes/function/nodes/node_fn_compare.cc
M	source/blender/nodes/function/nodes/node_fn_float_to_int.cc
M	source/blender/nodes/function/nodes/node_fn_input_bool.cc
M	source/blender/nodes/function/nodes/node_fn_input_color.cc
M	source/blender/nodes/function/nodes/node_fn_input_int.cc
M	source/blender/nodes/function/nodes/node_fn_input_special_characters.cc
M	source/blender/nodes/function/nodes/node_fn_input_string.cc
M	source/blender/nodes/function/nodes/node_fn_input_vector.cc
M	source/blender/nodes/function/nodes/node_fn_random_value.cc
M	source/blender/nodes/function/nodes/node_fn_replace_string.cc
M	source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
M	source/blender/nodes/function/nodes/node_fn_separate_color.cc
M	source/blender/nodes/function/nodes/node_fn_slice_string.cc
M	source/blender/nodes/function/nodes/node_fn_string_length.cc
M	source/blender/nodes/function/nodes/node_fn_value_to_string.cc

===================================================================

diff --git a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
index 9e21fc86871..20180971127 100644
--- a/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
+++ b/source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
@@ -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);
 }
diff --git a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
index 3027a81807b..849e03ca77f 100644
--- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
+++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
@@ -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);
 }
diff --git a/source/blender/nodes/function/nodes/node_fn_combine_color.cc b/source/blender/nodes/function/nodes/node_fn_combine_color.cc
index c5dd5dfff1a..318c8997f9a 100644
--- a/source/blender/nodes/function/nodes/node_fn_combine_color.cc
+++ b/source/blender/nodes/function/nodes/node_fn_combine_color.cc
@@ -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);
 }
diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc
index c0eb3e9ffd5..d73cb8cd558 100644
--- a/source/blender/nodes/function/nodes/node_fn_compare.cc
+++ b/source/blender/nodes/function/nodes/node_fn_compare.cc
@@ -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(G

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list