[Bf-blender-cvs] [46a037707b0] geometry-nodes-curve-support: Splines: Fix cache not recalculated error
Hans Goudey
noreply at git.blender.org
Thu Apr 22 23:30:35 CEST 2021
Commit: 46a037707b0247c26c344625f1bfed18024c13e6
Author: Hans Goudey
Date: Thu Apr 22 16:30:06 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB46a037707b0247c26c344625f1bfed18024c13e6
Splines: Fix cache not recalculated error
===================================================================
M source/blender/blenkernel/BKE_spline.hh
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
===================================================================
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();
More information about the Bf-blender-cvs
mailing list