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
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-04-23 00:30:06 +0300
committerHans Goudey <h.goudey@me.com>2021-04-23 00:30:06 +0300
commit46a037707b0247c26c344625f1bfed18024c13e6 (patch)
tree8973991b45e379dbb38138ee1ad8f259655c5053 /source
parentf2948faf97ae965e24f30d1175530d82d62b3a06 (diff)
Splines: Fix cache not recalculated error
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_spline.hh9
-rw-r--r--source/blender/blenkernel/intern/spline_base.cc11
-rw-r--r--source/blender/blenkernel/intern/spline_bezier.cc8
-rw-r--r--source/blender/blenkernel/intern/spline_nurbs.cc9
-rw-r--r--source/blender/blenkernel/intern/spline_poly.cc7
5 files changed, 32 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 0d84a032af4..21249de57f2 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -132,7 +132,11 @@ class Spline {
virtual blender::MutableSpan<float> tilts() = 0;
virtual blender::Span<float> tilts() const = 0;
- virtual void mark_cache_invalid();
+ /**
+ * Mark all caches for recomputation. This must be called after any operation that would
+ * change the generated positions, tangents, normals, mapping, etc. of the evaluated points.
+ */
+ virtual void mark_cache_invalid() = 0;
virtual int evaluated_points_size() const = 0;
int evaluated_edges_size() const;
@@ -246,6 +250,7 @@ class BezierSpline final : public Spline {
void move_control_point(const int index, const blender::float3 new_position);
+ void mark_cache_invalid() final;
int evaluated_points_size() const final;
blender::Span<PointMapping> evaluated_mappings() const;
@@ -345,6 +350,7 @@ class NURBSpline final : public Spline {
blender::MutableSpan<float> weights();
blender::Span<float> weights() const;
+ void mark_cache_invalid() final;
int evaluated_points_size() const final;
blender::Span<blender::float3> evaluated_positions() const final;
@@ -392,6 +398,7 @@ class PolySpline final : public Spline {
blender::MutableSpan<float> tilts() final;
blender::Span<float> tilts() const final;
+ void mark_cache_invalid() final;
int evaluated_points_size() const final;
blender::Span<blender::float3> evaluated_positions() const final;
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index efc53442ec1..02f65611f60 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -30,17 +30,6 @@ using blender::MutableSpan;
using blender::Span;
using blender::Vector;
-/**
- * Mark all caches for recomputation. This must be called after any operation that would
- * change the generated positions, tangents, normals, mapping, etc. of the evaluated points.
- */
-void Spline::mark_cache_invalid()
-{
- tangent_cache_dirty_ = true;
- normal_cache_dirty_ = true;
- length_cache_dirty_ = true;
-}
-
Spline::Type Spline::type() const
{
return this->type_;
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index ec86c81d7c3..e7d59d830dc 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -198,6 +198,14 @@ bool BezierSpline::segment_is_vector(const int index) const
this->handle_types_start_[index + 1] == HandleType::Vector;
}
+void BezierSpline::mark_cache_invalid()
+{
+ this->base_cache_dirty_ = true;
+ this->tangent_cache_dirty_ = true;
+ this->normal_cache_dirty_ = true;
+ this->length_cache_dirty_ = true;
+}
+
int BezierSpline::evaluated_points_size() const
{
BLI_assert(this->size() > 0);
diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc
index 0176c36582f..0e1342f8f08 100644
--- a/source/blender/blenkernel/intern/spline_nurbs.cc
+++ b/source/blender/blenkernel/intern/spline_nurbs.cc
@@ -135,6 +135,15 @@ Span<float> NURBSpline::weights() const
return this->weights_;
}
+void NURBSpline::mark_cache_invalid()
+{
+ this->basis_cache_dirty_ = true;
+ this->position_cache_dirty_ = true;
+ this->tangent_cache_dirty_ = true;
+ this->normal_cache_dirty_ = true;
+ this->length_cache_dirty_ = true;
+}
+
int NURBSpline::evaluated_points_size() const
{
return this->resolution_u_ * this->segments_size();
diff --git a/source/blender/blenkernel/intern/spline_poly.cc b/source/blender/blenkernel/intern/spline_poly.cc
index ebd4bb1ccb0..9868320d2a6 100644
--- a/source/blender/blenkernel/intern/spline_poly.cc
+++ b/source/blender/blenkernel/intern/spline_poly.cc
@@ -106,6 +106,13 @@ Span<float> PolySpline::tilts() const
return this->tilts_;
}
+void PolySpline::mark_cache_invalid()
+{
+ this->tangent_cache_dirty_ = true;
+ this->normal_cache_dirty_ = true;
+ this->length_cache_dirty_ = true;
+}
+
int PolySpline::evaluated_points_size() const
{
return this->size();