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:
authorHans Goudey <h.goudey@me.com>2021-05-12 18:21:12 +0300
committerHans Goudey <h.goudey@me.com>2021-05-12 18:21:32 +0300
commit1892b131edc76abb4439ca6fcc69b95a208ab7d7 (patch)
treee91c0a3621e5a0e46e0319b27ae622cded028b47 /source/blender/blenkernel/BKE_spline.hh
parent8dc95f61f3dff4e5686c2a278bd44db714065b20 (diff)
Geometry Nodes Curves: Expose first builtin point attributes
This commit exposes the first spline control point attributes. The implementation incorporates the attributes into the virtual array system, providing efficient methods to flatten the data into a contiguous array and to apply changes from a flattened array. This is only part of the eventual goal, which includes changes to run attribute nodes separately for each spline to completely avoid copying. So far `tilt` and `radius`, the two generic attributes common to all spline types, are implemented. The more complex `position` attribute is also added. It requires some special handling for Bezier splines, where the control point handles need to be moved along with the control points. To make that work I also added automatic handle recalculation to the Bezier spline. Differential Revision: https://developer.blender.org/D11187
Diffstat (limited to 'source/blender/blenkernel/BKE_spline.hh')
-rw-r--r--source/blender/blenkernel/BKE_spline.hh9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 48b5dfb1623..35bbc23b21a 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -206,8 +206,12 @@ class BezierSpline final : public Spline {
blender::Vector<HandleType> handle_types_left_;
blender::Vector<HandleType> handle_types_right_;
- blender::Vector<blender::float3> handle_positions_left_;
- blender::Vector<blender::float3> handle_positions_right_;
+ /* These are mutable to allow lazy recalculation of #Auto and #Vector handle positions. */
+ mutable blender::Vector<blender::float3> handle_positions_left_;
+ mutable blender::Vector<blender::float3> handle_positions_right_;
+
+ mutable std::mutex auto_handle_mutex_;
+ mutable bool auto_handles_dirty_ = true;
/** Start index in evaluated points array for every control point. */
mutable blender::Vector<int> offset_cache_;
@@ -296,6 +300,7 @@ class BezierSpline final : public Spline {
const blender::fn::GVArray &source_data) const override;
private:
+ void ensure_auto_handles() const;
void correct_end_tangents() const final;
bool segment_is_vector(const int start_index) const;
void evaluate_bezier_segment(const int index,