[Bf-blender-cvs] [c3206bd2a07] temp-geometry-nodes-fields--fields: Rename Function to FieldFunction

Hans Goudey noreply at git.blender.org
Fri Aug 27 16:49:47 CEST 2021


Commit: c3206bd2a076be81c1aee2ef2011790fa6243d42
Author: Hans Goudey
Date:   Fri Aug 27 09:49:36 2021 -0500
Branches: temp-geometry-nodes-fields--fields
https://developer.blender.org/rBc3206bd2a076be81c1aee2ef2011790fa6243d42

Rename Function to FieldFunction

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

M	source/blender/functions/FN_field.hh
M	source/blender/functions/intern/field.cc
M	source/blender/functions/tests/FN_field_test.cc

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

diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh
index 16164aabffb..e43a6769ee5 100644
--- a/source/blender/functions/FN_field.hh
+++ b/source/blender/functions/FN_field.hh
@@ -25,7 +25,7 @@
  * and optimization might mean executing the fields differently based on some factors like the
  * number of elements.
  *
- * For now, fields are very tied to the multi-function system, but in the future the #Function
+ * For now, fields are very tied to the multi-function system, but in the future the #FieldFunction
  * class could be extended to use different descriptions of its outputs and computation besides
  * the embedded multi-function.
  */
@@ -44,7 +44,7 @@ class Field;
  * An operation acting on data described by fields. Generally corresponds
  * to a node or a subset of a node in a node graph.
  */
-class Function {
+class FieldFunction {
   /**
    * The function used to calculate the
    */
@@ -56,7 +56,7 @@ class Function {
   blender::Vector<Field *> inputs_;
 
  public:
-  Function(std::unique_ptr<MultiFunction> function, Span<Field *> inputs)
+  FieldFunction(std::unique_ptr<MultiFunction> function, Span<Field *> inputs)
       : function_(std::move(function)), inputs_(inputs)
   {
   }
@@ -88,7 +88,7 @@ class Field {
    * used as multiple inputs. This avoids calling the same function many times, only using one of
    * its results.
    */
-  const Function *function_;
+  const FieldFunction *function_;
   /**
    * Which output of the function this field corresponds to.
    */
@@ -97,7 +97,7 @@ class Field {
   std::string debug_name_ = "";
 
  public:
-  Field(const fn::CPPType &type, const Function &function, const int output_index)
+  Field(const fn::CPPType &type, const FieldFunction &function, const int output_index)
       : type_(&type), function_(&function), output_index_(output_index)
   {
   }
@@ -108,7 +108,7 @@ class Field {
     return *type_;
   }
 
-  const Function &function() const
+  const FieldFunction &function() const
   {
     BLI_assert(function_ != nullptr);
     return *function_;
diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc
index 77331f5681c..29f5148c01a 100644
--- a/source/blender/functions/intern/field.cc
+++ b/source/blender/functions/intern/field.cc
@@ -22,11 +22,11 @@
 namespace blender::fn {
 
 /* A map to hold the output variables for each function so they can be reused. */
-using OutputMap = MultiValueMap<const Function *, MFVariable *>;
+using OutputMap = MultiValueMap<const FieldFunction *, MFVariable *>;
 
 static MFVariable *get_field_variable(const Field &field, const OutputMap &output_map)
 {
-  const Function &input_field_function = field.function();
+  const FieldFunction &input_field_function = field.function();
   const Span<MFVariable *> input_function_outputs = output_map.lookup(&input_field_function);
   return input_function_outputs[field.function_output_index()];
 }
@@ -40,7 +40,7 @@ static void add_field_variables(const Field &field,
                                 MFProcedureBuilder &builder,
                                 OutputMap &output_map)
 {
-  const Function &function = field.function();
+  const FieldFunction &function = field.function();
   for (const Field *input_field : function.inputs()) {
     add_field_variables(*input_field, builder, output_map);
   }
diff --git a/source/blender/functions/tests/FN_field_test.cc b/source/blender/functions/tests/FN_field_test.cc
index 3addc054d34..902bea8e655 100644
--- a/source/blender/functions/tests/FN_field_test.cc
+++ b/source/blender/functions/tests/FN_field_test.cc
@@ -10,7 +10,7 @@ namespace blender::fn::tests {
 
 TEST(field, ConstantInput)
 {
-  Function function = Function(std::make_unique<CustomMF_Constant<int>>(10), {});
+  FieldFunction function = FieldFunction(std::make_unique<CustomMF_Constant<int>>(10), {});
   Field constant_field = Field(CPPType::get<int>(), function, 0);
 
   Array<int> result(4);
@@ -49,7 +49,7 @@ class IndexFunction : public MultiFunction {
 
 TEST(field, IndexInput)
 {
-  Function function = Function(std::make_unique<IndexFunction>(), {});
+  FieldFunction function = FieldFunction(std::make_unique<IndexFunction>(), {});
   Field index_field = Field(CPPType::get<int>(), function, 0);
 
   Array<int> result_1(4);



More information about the Bf-blender-cvs mailing list