[Bf-blender-cvs] [e4da3694ab2] virtual-array-attributes: fix compilation errors

Jacques Lucke noreply at git.blender.org
Tue Apr 13 17:34:38 CEST 2021


Commit: e4da3694ab2ef7de2fb4bcc96c9c2bb1b547da27
Author: Jacques Lucke
Date:   Tue Apr 13 17:34:30 2021 +0200
Branches: virtual-array-attributes
https://developer.blender.org/rBe4da3694ab2ef7de2fb4bcc96c9c2bb1b547da27

fix compilation errors

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

M	source/blender/blenkernel/intern/attribute_access.cc
M	source/blender/blenkernel/intern/geometry_component_mesh.cc
M	source/blender/blenkernel/intern/geometry_set_instances.cc
M	source/blender/functions/FN_generic_virtual_array.hh
M	source/blender/nodes/geometry/nodes/node_geo_attribute_separate_xyz.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_scale.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
M	source/blender/nodes/geometry/nodes/node_geo_point_translate.cc
M	source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc

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

diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index a3ba6a472b4..9f478dc38a6 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -182,6 +182,16 @@ AttributeDomain attribute_domain_highest_priority(Span<AttributeDomain> domains)
   return highest_priority_domain;
 }
 
+void OutputAttribute::save()
+{
+  if (optional_span_varray_.has_value()) {
+    optional_span_varray_->apply();
+  }
+  if (save_) {
+    save_(*this);
+  }
+}
+
 std::unique_ptr<GVArray> BuiltinCustomDataLayerProvider::try_get_for_read(
     const GeometryComponent &component) const
 {
@@ -782,5 +792,3 @@ blender::bke::OutputAttribute GeometryComponent::attribute_try_get_for_output(
   /* TODO */
   return {};
 }
-
-/** \} */
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index 304a2e5c2ce..88ef4c1b67a 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -227,7 +227,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_corner_to_point(const Mesh &me
       /* We compute all interpolated values at once, because for this interpolation, one has to
        * iterate over all loops anyway. */
       Array<T> values(mesh.totvert);
-      adapt_mesh_domain_corner_to_point_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_corner_to_point_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -259,7 +259,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_corner(const Mesh &me
      * when an algorithm only accesses very few of the corner values. However, for the algorithms
      * we currently have, precomputing the array is fine. Also, it is easier to implement. */
     Array<T> values(mesh.totloop);
-    adapt_mesh_domain_point_to_corner_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+    adapt_mesh_domain_point_to_corner_impl<T>(mesh, varray->typed<T>(), values);
     new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
   });
   return new_varray;
@@ -272,7 +272,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_corner(const Mesh &me
  */
 template<typename T>
 static void adapt_mesh_domain_corner_to_face_impl(const Mesh &mesh,
-                                                  Span<T> old_values,
+                                                  const VArray<T> &old_values,
                                                   MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totpoly);
@@ -298,7 +298,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_corner_to_face(const Mesh &mes
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totpoly);
-      adapt_mesh_domain_corner_to_face_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_corner_to_face_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -307,7 +307,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_corner_to_face(const Mesh &mes
 
 template<typename T>
 static void adapt_mesh_domain_corner_to_edge_impl(const Mesh &mesh,
-                                                  const VArray<T> old_values,
+                                                  const VArray<T> &old_values,
                                                   MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totedge);
@@ -338,7 +338,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_corner_to_edge(const Mesh &mes
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totedge);
-      adapt_mesh_domain_corner_to_edge_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_corner_to_edge_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -347,7 +347,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_corner_to_edge(const Mesh &mes
 
 template<typename T>
 void adapt_mesh_domain_face_to_point_impl(const Mesh &mesh,
-                                          Span<T> old_values,
+                                          const VArray<T> &old_values,
                                           MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totvert);
@@ -375,7 +375,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_point(const Mesh &mesh
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totvert);
-      adapt_mesh_domain_face_to_point_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_face_to_point_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -384,7 +384,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_point(const Mesh &mesh
 
 template<typename T>
 void adapt_mesh_domain_face_to_corner_impl(const Mesh &mesh,
-                                           const VArray<T> old_values,
+                                           const VArray<T> &old_values,
                                            MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totloop);
@@ -405,7 +405,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_corner(const Mesh &mes
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totloop);
-      adapt_mesh_domain_face_to_corner_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_face_to_corner_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -414,7 +414,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_corner(const Mesh &mes
 
 template<typename T>
 void adapt_mesh_domain_face_to_edge_impl(const Mesh &mesh,
-                                         const VArray<T> old_values,
+                                         const VArray<T> &old_values,
                                          MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totedge);
@@ -440,7 +440,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_edge(const Mesh &mesh,
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totedge);
-      adapt_mesh_domain_face_to_edge_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_face_to_edge_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -454,7 +454,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_face_to_edge(const Mesh &mesh,
  */
 template<typename T>
 static void adapt_mesh_domain_point_to_face_impl(const Mesh &mesh,
-                                                 const VArray<T> old_values,
+                                                 const VArray<T> &old_values,
                                                  MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totpoly);
@@ -480,7 +480,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_face(const Mesh &mesh
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totpoly);
-      adapt_mesh_domain_point_to_face_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_point_to_face_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -494,7 +494,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_face(const Mesh &mesh
  */
 template<typename T>
 static void adapt_mesh_domain_point_to_edge_impl(const Mesh &mesh,
-                                                 const VArray<T> old_values,
+                                                 const VArray<T> &old_values,
                                                  MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totedge);
@@ -518,7 +518,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_edge(const Mesh &mesh
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totedge);
-      adapt_mesh_domain_point_to_edge_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_point_to_edge_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVArray_For_ArrayContainer<Array<T>>>(std::move(values));
     }
   });
@@ -527,7 +527,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_point_to_edge(const Mesh &mesh
 
 template<typename T>
 void adapt_mesh_domain_edge_to_corner_impl(const Mesh &mesh,
-                                           const VArray<T> old_values,
+                                           const VArray<T> &old_values,
                                            MutableSpan<T> r_values)
 {
   BLI_assert(r_values.size() == mesh.totloop);
@@ -558,7 +558,7 @@ static std::unique_ptr<GVArray> adapt_mesh_domain_edge_to_corner(const Mesh &mes
     using T = decltype(dummy);
     if constexpr (!std::is_void_v<attribute_math::DefaultMixer<T>>) {
       Array<T> values(mesh.totloop);
-      adapt_mesh_domain_edge_to_corner_impl<T>(mesh, *fn::GVArray_Typed<T>{varray}, values);
+      adapt_mesh_domain_edge_to_corner_impl<T>(mesh, varray->typed<T>(), values);
       new_varray = std::make_unique<fn::GVAr

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list