[Bf-blender-cvs] [3e16f3b3ef4] master: BLI: move generic data structures to blenlib

Jacques Lucke noreply at git.blender.org
Sat Mar 19 08:26:52 CET 2022


Commit: 3e16f3b3ef4b8f385b30fe4a1e00860620f610ee
Author: Jacques Lucke
Date:   Sat Mar 19 08:26:29 2022 +0100
Branches: master
https://developer.blender.org/rB3e16f3b3ef4b8f385b30fe4a1e00860620f610ee

BLI: move generic data structures to blenlib

This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.

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

M	source/blender/blenkernel/BKE_attribute_access.hh
M	source/blender/blenkernel/BKE_curves.hh
M	source/blender/blenkernel/BKE_geometry_set.hh
M	source/blender/blenkernel/BKE_mesh_sample.hh
M	source/blender/blenkernel/BKE_spline.hh
M	source/blender/blenkernel/BKE_type_conversions.hh
M	source/blender/blenkernel/intern/attribute_access.cc
M	source/blender/blenkernel/intern/curve_catmull_rom.cc
M	source/blender/blenkernel/intern/curve_eval.cc
M	source/blender/blenkernel/intern/curve_nurbs.cc
M	source/blender/blenkernel/intern/curve_to_mesh_convert.cc
M	source/blender/blenkernel/intern/curves_geometry.cc
M	source/blender/blenkernel/intern/geometry_component_curve.cc
M	source/blender/blenkernel/intern/geometry_component_curves.cc
M	source/blender/blenkernel/intern/geometry_component_instances.cc
M	source/blender/blenkernel/intern/geometry_component_mesh.cc
M	source/blender/blenkernel/intern/spline_base.cc
M	source/blender/blenkernel/intern/spline_bezier.cc
M	source/blender/blenkernel/intern/spline_nurbs.cc
M	source/blender/blenkernel/intern/spline_poly.cc
M	source/blender/blenkernel/intern/type_conversions.cc
R098	source/blender/functions/FN_generic_array.hh	source/blender/blenlib/BLI_generic_array.hh
R097	source/blender/functions/FN_generic_pointer.hh	source/blender/blenlib/BLI_generic_pointer.hh
R098	source/blender/functions/FN_generic_span.hh	source/blender/blenlib/BLI_generic_span.hh
R097	source/blender/functions/FN_generic_value_map.hh	source/blender/blenlib/BLI_generic_value_map.hh
R096	source/blender/functions/FN_generic_vector_array.hh	source/blender/blenlib/BLI_generic_vector_array.hh
R098	source/blender/functions/FN_generic_virtual_array.hh	source/blender/blenlib/BLI_generic_virtual_array.hh
R095	source/blender/functions/FN_generic_virtual_vector_array.hh	source/blender/blenlib/BLI_generic_virtual_vector_array.hh
M	source/blender/blenlib/BLI_virtual_array.hh
M	source/blender/blenlib/CMakeLists.txt
R093	source/blender/functions/intern/generic_vector_array.cc	source/blender/blenlib/intern/generic_vector_array.cc
R099	source/blender/functions/intern/generic_virtual_array.cc	source/blender/blenlib/intern/generic_virtual_array.cc
R094	source/blender/functions/intern/generic_virtual_vector_array.cc	source/blender/blenlib/intern/generic_virtual_vector_array.cc
R097	source/blender/functions/tests/FN_generic_array_test.cc	source/blender/blenlib/tests/BLI_generic_array_test.cc
R092	source/blender/functions/tests/FN_generic_span_test.cc	source/blender/blenlib/tests/BLI_generic_span_test.cc
R090	source/blender/functions/tests/FN_generic_vector_array_test.cc	source/blender/blenlib/tests/BLI_generic_vector_array_test.cc
M	source/blender/editors/geometry/geometry_attributes.cc
M	source/blender/editors/space_node/node_draw.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
M	source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh
M	source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
M	source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
M	source/blender/functions/CMakeLists.txt
M	source/blender/functions/FN_field.hh
M	source/blender/functions/FN_multi_function.hh
M	source/blender/functions/FN_multi_function_params.hh
M	source/blender/geometry/intern/mesh_to_curve_convert.cc
M	source/blender/geometry/intern/realize_instances.cc
M	source/blender/modifiers/intern/MOD_nodes.cc
M	source/blender/modifiers/intern/MOD_nodes_evaluator.cc
M	source/blender/modifiers/intern/MOD_nodes_evaluator.hh
M	source/blender/nodes/NOD_geometry_exec.hh
M	source/blender/nodes/NOD_geometry_nodes_eval_log.hh
M	source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc

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

diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh
index e36163878a5..36f29c7fbb7 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -4,14 +4,13 @@
 
 #include <mutex>
 
-#include "FN_generic_span.hh"
-#include "FN_generic_virtual_array.hh"
-
 #include "BKE_anonymous_attribute.hh"
 #include "BKE_attribute.h"
 
 #include "BLI_color.hh"
 #include "BLI_function_ref.hh"
+#include "BLI_generic_span.hh"
+#include "BLI_generic_virtual_array.hh"
 #include "BLI_math_vec_types.hh"
 
 /**
@@ -132,9 +131,9 @@ struct AttributeInitDefault : public AttributeInit {
  * Note that this can be used to fill the new attribute with the default
  */
 struct AttributeInitVArray : public AttributeInit {
-  blender::fn::GVArray varray;
+  blender::GVArray varray;
 
-  AttributeInitVArray(blender::fn::GVArray varray)
+  AttributeInitVArray(blender::GVArray varray)
       : AttributeInit(Type::VArray), varray(std::move(varray))
   {
   }
@@ -165,9 +164,6 @@ using AttributeForeachCallback = blender::FunctionRef<bool(
 
 namespace blender::bke {
 
-using fn::GVArray;
-using fn::GVMutableArray;
-
 const CPPType *custom_data_type_to_cpp_type(const CustomDataType type);
 CustomDataType cpp_type_to_custom_data_type(const CPPType &type);
 CustomDataType attribute_data_type_highest_complexity(Span<CustomDataType> data_types);
@@ -237,7 +233,7 @@ class OutputAttribute {
   GVMutableArray varray_;
   AttributeDomain domain_ = ATTR_DOMAIN_AUTO;
   SaveFn save_;
-  std::unique_ptr<fn::GVMutableArray_GSpan> optional_span_varray_;
+  std::unique_ptr<GVMutableArray_GSpan> optional_span_varray_;
   bool ignore_old_values_ = false;
   bool save_has_been_called_ = false;
 
@@ -254,13 +250,13 @@ class OutputAttribute {
   operator bool() const;
 
   GVMutableArray &operator*();
-  fn::GVMutableArray *operator->();
+  GVMutableArray *operator->();
   GVMutableArray &varray();
   AttributeDomain domain() const;
   const CPPType &cpp_type() const;
   CustomDataType custom_data_type() const;
 
-  fn::GMutableSpan as_span();
+  GMutableSpan as_span();
   template<typename T> MutableSpan<T> as_span();
 
   void save();
@@ -374,16 +370,16 @@ class CustomDataAttributes {
 
   void clear();
 
-  std::optional<blender::fn::GSpan> get_for_read(const AttributeIDRef &attribute_id) const;
+  std::optional<blender::GSpan> get_for_read(const AttributeIDRef &attribute_id) const;
 
   /**
    * Return a virtual array for a stored attribute, or a single value virtual array with the
    * default value if the attribute doesn't exist. If no default value is provided, the default
    * value for the type will be used.
    */
-  blender::fn::GVArray get_for_read(const AttributeIDRef &attribute_id,
-                                    const CustomDataType data_type,
-                                    const void *default_value) const;
+  blender::GVArray get_for_read(const AttributeIDRef &attribute_id,
+                                const CustomDataType data_type,
+                                const void *default_value) const;
 
   template<typename T>
   blender::VArray<T> get_for_read(const AttributeIDRef &attribute_id, const T &default_value) const
@@ -394,7 +390,7 @@ class CustomDataAttributes {
     return varray.typed<T>();
   }
 
-  std::optional<blender::fn::GMutableSpan> get_for_write(const AttributeIDRef &attribute_id);
+  std::optional<blender::GMutableSpan> get_for_write(const AttributeIDRef &attribute_id);
   bool create(const AttributeIDRef &attribute_id, const CustomDataType data_type);
   bool create_by_move(const AttributeIDRef &attribute_id,
                       const CustomDataType data_type,
@@ -514,7 +510,7 @@ inline GVMutableArray &OutputAttribute::operator*()
   return varray_;
 }
 
-inline fn::GVMutableArray *OutputAttribute::operator->()
+inline GVMutableArray *OutputAttribute::operator->()
 {
   return &varray_;
 }
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 93b98a01fce..ea378c5a0a5 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -12,6 +12,7 @@
 #include <mutex>
 
 #include "BLI_float4x4.hh"
+#include "BLI_generic_virtual_array.hh"
 #include "BLI_index_mask.hh"
 #include "BLI_math_vec_types.hh"
 #include "BLI_span.hh"
@@ -21,8 +22,6 @@
 
 #include "BKE_attribute_access.hh"
 
-#include "FN_generic_virtual_array.hh"
-
 namespace blender::bke {
 
 template<typename T, BLI_ENABLE_IF(std::is_integral_v<T>)>
@@ -287,9 +286,7 @@ class CurvesGeometry : public ::CurvesGeometry {
    * Attributes.
    */
 
-  fn::GVArray adapt_domain(const fn::GVArray &varray,
-                           AttributeDomain from,
-                           AttributeDomain to) const;
+  GVArray adapt_domain(const GVArray &varray, AttributeDomain from, AttributeDomain to) const;
 };
 
 namespace curves {
@@ -375,7 +372,7 @@ int calculate_evaluated_size(int size, bool cyclic, int resolution);
  * Evaluate the Catmull Rom curve. The length of the #dst span should be calculated with
  * #calculate_evaluated_size and is expected to divide evenly by the #src span's segment size.
  */
-void interpolate_to_evaluated(fn::GSpan src, bool cyclic, int resolution, fn::GMutableSpan dst);
+void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst);
 
 }  // namespace catmull_rom
 
@@ -439,8 +436,8 @@ void calculate_basis_cache(int size,
 void interpolate_to_evaluated(const BasisCache &basis_cache,
                               int8_t order,
                               Span<float> control_weights,
-                              fn::GSpan src,
-                              fn::GMutableSpan dst);
+                              GSpan src,
+                              GMutableSpan dst);
 
 }  // namespace nurbs
 
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 372922a24d2..bd392057436 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -131,9 +131,9 @@ class GeometryComponent {
    * interpolate from one domain to another.
    * \return null if the interpolation is not implemented.
    */
-  blender::fn::GVArray attribute_try_adapt_domain(const blender::fn::GVArray &varray,
-                                                  const AttributeDomain from_domain,
-                                                  const AttributeDomain to_domain) const
+  blender::GVArray attribute_try_adapt_domain(const blender::GVArray &varray,
+                                              const AttributeDomain from_domain,
+                                              const AttributeDomain to_domain) const
   {
     return this->attribute_try_adapt_domain_impl(varray, from_domain, to_domain);
   }
@@ -177,17 +177,17 @@ class GeometryComponent {
    * and converted to the data type. Returns null when the attribute does not exist or cannot be
    * interpolated or converted.
    */
-  blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
-                                                  AttributeDomain domain,
-                                                  const CustomDataType data_type) const;
+  blender::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
+                                              AttributeDomain domain,
+                                              const CustomDataType data_type) const;
 
   /**
    * Get a virtual array that refers to the data of an attribute, interpolated to the given domain.
    * The data type is left unchanged. Returns null when the attribute does not exist or cannot be
    * interpolated.
    */
-  blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
-                                                  AttributeDomain domain) const;
+  blender::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
+                                              AttributeDomain domain) const;
 
   /**
    * Get a virtual array that refers to the data of an attribute converted to the given data type.
@@ -202,10 +202,10 @@ class GeometryComponent {
    * and converted to the data type. If that is not possible, the returned virtual array will
    * contain a default value. This never returns null.
    */
-  blender::fn::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
-                                              AttributeDomain domain,
-                                              const CustomDataType data_type,
-                                              const void *default_value = nullptr) const;
+  blender::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
+                                          AttributeDomain domain,
+                                          const CustomDataType data_type,
+                                          const void *default_value = nullptr) const;
   /* Use instead of the method above when the type is known at compile time for type safety. */
   template<typename T>
   blender::VArray<T> attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id,
@@ -268,9 +268,9 @@ class GeometryComponent {
  private:
   virtual const blender::bke::ComponentAttributeProviders *get_attribute_providers() const;
 
-  virtual blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray,
-                                                               AttributeDomain from_domain,
-                                                               AttributeDomain to_domain) const;
+  virtual blender::GVArray attribute_try_adapt_domain_impl(const blender::GVArray &varray,
+                                                           AttributeDomain from_domain,
+                                                           AttributeDomain to_domain) const;
 };
 
 template<typename T>
@@ -568,9 +568,9 @@ class MeshComponent : public GeometryComponent {
  privat

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list