Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/BKE_spline.hh')
-rw-r--r--source/blender/blenkernel/BKE_spline.hh28
1 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 9e5552082af..fc1292e3620 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -101,15 +101,14 @@ class Spline {
Spline(const Type type) : type_(type)
{
}
- Spline(Spline &other)
- : normal_mode(other.normal_mode),
- attributes(other.attributes),
- type_(other.type_),
- is_cyclic_(other.is_cyclic_)
+ Spline(Spline &other) : attributes(other.attributes), type_(other.type_)
{
+ copy_base_settings(other, *this);
}
virtual SplinePtr copy() const = 0;
+ /** Return a new spline with the same type and settings like "cyclic", but without any data. */
+ virtual SplinePtr copy_settings() const = 0;
Spline::Type type() const;
@@ -183,6 +182,12 @@ class Spline {
protected:
virtual void correct_end_tangents() const = 0;
+ /** Copy settings stored in the base spline class. */
+ static void copy_base_settings(const Spline &src, Spline &dst)
+ {
+ dst.normal_mode = src.normal_mode;
+ dst.is_cyclic_ = src.is_cyclic_;
+ }
};
/**
@@ -236,6 +241,7 @@ class BezierSpline final : public Spline {
public:
virtual SplinePtr copy() const final;
+ SplinePtr copy_settings() const final;
BezierSpline() : Spline(Type::Bezier)
{
}
@@ -257,10 +263,10 @@ class BezierSpline final : public Spline {
void set_resolution(const int value);
void add_point(const blender::float3 position,
- const HandleType handle_type_start,
- const blender::float3 handle_position_start,
- const HandleType handle_type_end,
- const blender::float3 handle_position_end,
+ const HandleType handle_type_left,
+ const blender::float3 handle_position_left,
+ const HandleType handle_type_right,
+ const blender::float3 handle_position_right,
const float radius,
const float tilt);
@@ -377,6 +383,7 @@ class NURBSpline final : public Spline {
public:
SplinePtr copy() const final;
+ SplinePtr copy_settings() const final;
NURBSpline() : Spline(Type::NURBS)
{
}
@@ -444,6 +451,7 @@ class PolySpline final : public Spline {
public:
SplinePtr copy() const final;
+ SplinePtr copy_settings() const final;
PolySpline() : Spline(Type::Poly)
{
}
@@ -483,7 +491,7 @@ class PolySpline final : public Spline {
* A #CurveEval corresponds to the #Curve object data. The name is different for clarity, since
* more of the data is stored in the splines, but also just to be different than the name in DNA.
*/
-class CurveEval {
+struct CurveEval {
private:
blender::Vector<SplinePtr> splines_;