[Bf-blender-cvs] [8709d0cd5d8] geometry-nodes-curve-support: Splines: Rename DCurve to SplineGroup

Hans Goudey noreply at git.blender.org
Mon Apr 26 04:26:07 CEST 2021


Commit: 8709d0cd5d8400297b4c59ee2499843231640f06
Author: Hans Goudey
Date:   Sun Apr 25 21:26:00 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB8709d0cd5d8400297b4c59ee2499843231640f06

Splines: Rename DCurve to SplineGroup

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

M	source/blender/blenkernel/BKE_geometry_set.hh
M	source/blender/blenkernel/BKE_spline.hh
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/geometry_component_curve.cc
M	source/blender/blenkernel/intern/geometry_set.cc
R094	source/blender/blenkernel/intern/derived_curve.cc	source/blender/blenkernel/intern/spline_group.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_sample_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
M	source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
M	source/blender/nodes/geometry/nodes/node_geo_object_info.cc
M	source/blender/nodes/geometry/nodes/node_geo_transform.cc

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

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 78d63aa412c..fc3adde0178 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -34,13 +34,13 @@
 #include "BKE_attribute_access.hh"
 #include "BKE_geometry_set.h"
 
-struct DCurve;
+struct SplineGroup;
 struct Collection;
 struct Mesh;
 struct Object;
 struct PointCloud;
 struct Volume;
-struct DCurve;
+struct SplineGroup;
 
 enum class GeometryOwnershipType {
   /* The geometry is owned. This implies that it can be changed. */
@@ -366,7 +366,7 @@ struct GeometrySet {
   static GeometrySet create_with_pointcloud(
       PointCloud *pointcloud, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
   static GeometrySet create_with_curve(
-      DCurve *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
+      SplineGroup *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
 
   /* Utility methods for access. */
   bool has_mesh() const;
@@ -378,18 +378,19 @@ struct GeometrySet {
   const Mesh *get_mesh_for_read() const;
   const PointCloud *get_pointcloud_for_read() const;
   const Volume *get_volume_for_read() const;
-  const DCurve *get_curve_for_read() const;
+  const SplineGroup *get_curve_for_read() const;
 
   Mesh *get_mesh_for_write();
   PointCloud *get_pointcloud_for_write();
   Volume *get_volume_for_write();
-  DCurve *get_curve_for_write();
+  SplineGroup *get_curve_for_write();
 
   /* Utility methods for replacement. */
   void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
   void replace_pointcloud(PointCloud *pointcloud,
                           GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
-  void replace_curve(DCurve *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
+  void replace_curve(SplineGroup *mesh,
+                     GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
 };
 
 /** A geometry component that can store a mesh. */
@@ -473,7 +474,7 @@ class PointCloudComponent : public GeometryComponent {
 
 class CurveComponent : public GeometryComponent {
  private:
-  DCurve *curve_ = nullptr;
+  SplineGroup *curve_ = nullptr;
   GeometryOwnershipType ownership_ = GeometryOwnershipType::Owned;
 
  public:
@@ -483,11 +484,11 @@ class CurveComponent : public GeometryComponent {
 
   void clear();
   bool has_curve() const;
-  void replace(DCurve *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
-  DCurve *release();
+  void replace(SplineGroup *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
+  SplineGroup *release();
 
-  const DCurve *get_for_read() const;
-  DCurve *get_for_write();
+  const SplineGroup *get_for_read() const;
+  SplineGroup *get_for_write();
 
   int attribute_domain_size(const AttributeDomain domain) const final;
 
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 4831805210f..7f58794a1d3 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -407,15 +407,15 @@ class PolySpline final : public Spline {
 };
 
 /* Proposed name to be different from DNA type. */
-class DCurve {
+class SplineGroup {
  public:
   blender::Vector<SplinePtr> splines;
 
-  DCurve *copy();
+  SplineGroup *copy();
 
   void translate(const blender::float3 translation);
   void transform(const blender::float4x4 &matrix);
   void bounds_min_max(blender::float3 &min, blender::float3 &max, const bool use_evaluated) const;
 };
 
-DCurve *dcurve_from_dna_curve(const Curve &curve);
\ No newline at end of file
+SplineGroup *dcurve_from_dna_curve(const Curve &curve);
\ No newline at end of file
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 17639eaba85..7e0138ff85d 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -117,7 +117,6 @@ set(SRC
   intern/customdata_file.c
   intern/data_transfer.c
   intern/deform.c
-  intern/derived_curve.cc  
   intern/displist.cc
   intern/displist_tangent.c
   intern/dynamicpaint.c
@@ -245,6 +244,7 @@ set(SRC
   intern/speaker.c
   intern/spline_base.cc
   intern/spline_bezier.cc
+  intern/spline_group.cc  
   intern/spline_nurbs.cc
   intern/spline_poly.cc
   intern/studiolight.c
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc
index a37b1da3847..67625237a01 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -62,7 +62,7 @@ bool CurveComponent::has_curve() const
 }
 
 /* Clear the component and replace it with the new curve. */
-void CurveComponent::replace(DCurve *curve, GeometryOwnershipType ownership)
+void CurveComponent::replace(SplineGroup *curve, GeometryOwnershipType ownership)
 {
   BLI_assert(this->is_mutable());
   this->clear();
@@ -70,20 +70,20 @@ void CurveComponent::replace(DCurve *curve, GeometryOwnershipType ownership)
   ownership_ = ownership;
 }
 
-DCurve *CurveComponent::release()
+SplineGroup *CurveComponent::release()
 {
   BLI_assert(this->is_mutable());
-  DCurve *curve = curve_;
+  SplineGroup *curve = curve_;
   curve_ = nullptr;
   return curve;
 }
 
-const DCurve *CurveComponent::get_for_read() const
+const SplineGroup *CurveComponent::get_for_read() const
 {
   return curve_;
 }
 
-DCurve *CurveComponent::get_for_write()
+SplineGroup *CurveComponent::get_for_write()
 {
   BLI_assert(this->is_mutable());
   if (ownership_ == GeometryOwnershipType::ReadOnly) {
@@ -139,8 +139,8 @@ int CurveComponent::attribute_domain_size(const AttributeDomain domain) const
 namespace blender::bke {
 
 class BuiltinSplineAttributeProvider final : public BuiltinAttributeProvider {
-  using AsReadAttribute = GVArrayPtr (*)(const DCurve &data);
-  using AsWriteAttribute = GVMutableArrayPtr (*)(DCurve &data);
+  using AsReadAttribute = GVArrayPtr (*)(const SplineGroup &data);
+  using AsWriteAttribute = GVMutableArrayPtr (*)(SplineGroup &data);
   using UpdateOnWrite = void (*)(Spline &spline);
   const AsReadAttribute as_read_attribute_;
   const AsWriteAttribute as_write_attribute_;
@@ -165,7 +165,7 @@ class BuiltinSplineAttributeProvider final : public BuiltinAttributeProvider {
   GVArrayPtr try_get_for_read(const GeometryComponent &component) const final
   {
     const CurveComponent &curve_component = static_cast<const CurveComponent &>(component);
-    const DCurve *curve = curve_component.get_for_read();
+    const SplineGroup *curve = curve_component.get_for_read();
     if (curve == nullptr) {
       return {};
     }
@@ -179,7 +179,7 @@ class BuiltinSplineAttributeProvider final : public BuiltinAttributeProvider {
       return {};
     }
     CurveComponent &curve_component = static_cast<CurveComponent &>(component);
-    DCurve *curve = curve_component.get_for_write();
+    SplineGroup *curve = curve_component.get_for_write();
     if (curve == nullptr) {
       return {};
     }
@@ -215,13 +215,13 @@ static void set_spline_resolution(SplinePtr &spline, const int resolution)
   spline->mark_cache_invalid();
 }
 
-static GVArrayPtr make_resolution_read_attribute(const DCurve &curve)
+static GVArrayPtr make_resolution_read_attribute(const SplineGroup &curve)
 {
   return std::make_unique<fn::GVArray_For_DerivedSpan<SplinePtr, int, get_spline_resolution>>(
       curve.splines.as_span());
 }
 
-static GVMutableArrayPtr make_resolution_write_attribute(DCurve &curve)
+static GVMutableArrayPtr make_resolution_write_attribute(SplineGroup &curve)
 {
   return std::make_unique<fn::GVMutableArray_For_DerivedSpan<SplinePtr,
                                                              int,
@@ -235,7 +235,7 @@ static float get_spline_length(const SplinePtr &spline)
   return spline->length();
 }
 
-static GVArrayPtr make_length_attribute(const DCurve &curve)
+static GVArrayPtr make_length_attribute(const SplineGroup &curve)
 {
   return std::make_unique<fn::GVArray_For_DerivedSpan<SplinePtr, float, get_spline_length>>(
       curve.splines.as_span());
@@ -254,13 +254,13 @@ static void set_cyclic_value(SplinePtr &spline, const bool value)
   }
 }
 
-static GVArrayPtr make_cyclic_read_attribute(const DCurve &curve)
+static GVArrayPtr make_cyclic_read_attribute(const SplineGroup &curve)
 {
   return std::make_unique<fn::GVArray_For_DerivedSpan<SplinePtr, bool, get_cyclic_value>>(
       curve.splines.as_span());
 }
 
-static GVMutableArrayPtr make_cyclic_write_attribute(DCurve &curve)
+static GVMutableArrayPtr make_cyclic_write_attribute(SplineGroup &curve)
 {
   return std::make_unique<
       fn::GVMutableArray_For_DerivedSpan<SplinePtr, bool, get_cyclic_value, set_cyclic_value>>(
@@ -293,7 +293,7 @@ class BuiltinPointAttributeProvider final : public BuiltinAttributeProvider {
   GVArrayPtr try_get_for_read(const GeometryComponent &component) const final
   {
     const CurveComponent &curve_component = static_cast<const CurveComponent &>(component);
-    const DCurve *curve = curve_component.get_for_read();
+    const SplineGroup *curve = curve_component.get_for_read();
     if (curve == nullptr) {
       return {};
     }
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index 533fb3f2f22..c343fff51fa 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -185,7 +185,7 @@ void GeometrySet::compute_boundbox_without_instances(float3 *r_min, float3 *r_ma
   if (volume != nullptr) {
     BKE_volume_min_max(volume, *r_min, *r_max);
   }
-  const DCurve *curve = this->get_curve_for_read();
+  const SplineGroup *curve = this->get_curve_for_read();
   if (curve != nullptr) {
     /* Note the the choice of using the evaluated positions is somewhat arbitrary, and may counter
      * the idea that the curve is the reduced set of control point information, but it may also be
@@ -263,7 +263,7 @@ const Volume *GeometrySet::get_volume_for_r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list