Blender  V3.3
Public Member Functions | Public Attributes | List of all members
CurveEval Struct Reference

#include <BKE_spline.hh>

Public Member Functions

 CurveEval ()=default
 
 CurveEval (const CurveEval &other)
 
blender::Span< SplinePtrsplines () const
 
blender::MutableSpan< SplinePtrsplines ()
 
bool has_spline_with_type (const CurveType type) const
 
void resize (int size)
 
void add_spline (SplinePtr spline)
 
void add_splines (blender::MutableSpan< SplinePtr > splines)
 
void remove_splines (blender::IndexMask mask)
 
void translate (const blender::float3 &translation)
 
void transform (const blender::float4x4 &matrix)
 
bool bounds_min_max (blender::float3 &min, blender::float3 &max, bool use_evaluated) const
 
blender::bke::MutableAttributeAccessor attributes_for_write ()
 
blender::Array< int > control_point_offsets () const
 
blender::Array< int > evaluated_point_offsets () const
 
blender::Array< floataccumulated_spline_lengths () const
 
float total_length () const
 
int total_control_point_num () const
 
void mark_cache_invalid ()
 
void assert_valid_point_attributes () const
 

Public Attributes

blender::bke::CustomDataAttributes attributes
 

Detailed Description

A collection of Spline objects with the same attribute types and names. Most data and functionality is in splines, but this contains some helpers for working with them as a group.

Note
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.

Definition at line 612 of file BKE_spline.hh.

Constructor & Destructor Documentation

◆ CurveEval() [1/2]

CurveEval::CurveEval ( )
default

◆ CurveEval() [2/2]

CurveEval::CurveEval ( const CurveEval other)
inline

Definition at line 620 of file BKE_spline.hh.

References splines().

Member Function Documentation

◆ accumulated_spline_lengths()

blender::Array< float > CurveEval::accumulated_spline_lengths ( ) const

Return the accumulated length at the start of every spline in the curve.

Note
The result is one longer than the spline count; the last element is the total length.

Definition at line 151 of file curve_eval.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

◆ add_spline()

void CurveEval::add_spline ( SplinePtr  spline)
Warning
Call #reallocate on the spline's attributes after adding all splines.

Definition at line 62 of file curve_eval.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append().

Referenced by add_splines().

◆ add_splines()

void CurveEval::add_splines ( blender::MutableSpan< SplinePtr splines)

Definition at line 67 of file curve_eval.cc.

References add_spline(), and splines().

◆ assert_valid_point_attributes()

void CurveEval::assert_valid_point_attributes ( ) const

Check the invariants that curve control point attributes should always uphold, necessary because attributes are stored on splines rather than in a flat array on the curve:

  • The same set of attributes exists on every spline.
  • Attributes with the same name have the same type on every spline.
  • Attributes are in the same order on every spline.

Definition at line 544 of file curve_eval.cc.

References ATTR_DOMAIN_POINT, BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::first(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

◆ attributes_for_write()

blender::bke::MutableAttributeAccessor CurveEval::attributes_for_write ( )

◆ bounds_min_max()

bool CurveEval::bounds_min_max ( blender::float3 min,
blender::float3 max,
bool  use_evaluated 
) const

Definition at line 96 of file curve_eval.cc.

References max, min, and splines().

◆ control_point_offsets()

blender::Array< int > CurveEval::control_point_offsets ( ) const

Return the start indices for each of the curve spline's control points, if they were part of a flattened array. This can be used to facilitate parallelism by avoiding the need to accumulate an offset while doing more complex calculations.

Note
The result is one longer than the spline count; the last element is the total size.

Definition at line 127 of file curve_eval.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Array< T, InlineBufferCapacity, Allocator >::last(), offset, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

Referenced by curve_eval_to_curves().

◆ evaluated_point_offsets()

blender::Array< int > CurveEval::evaluated_point_offsets ( ) const

◆ has_spline_with_type()

bool CurveEval::has_spline_with_type ( const CurveType  type) const
Returns
True if the curve contains a spline with the given type.
Note
If you are looping over all of the splines in the same scope anyway, it's better to avoid calling this function, in case there are many splines.

Definition at line 46 of file curve_eval.cc.

References splines(), and type.

Referenced by curve_eval_to_curves().

◆ mark_cache_invalid()

void CurveEval::mark_cache_invalid ( )

Definition at line 163 of file curve_eval.cc.

◆ remove_splines()

void CurveEval::remove_splines ( blender::IndexMask  mask)

◆ resize()

void CurveEval::resize ( int  size)

◆ splines() [1/2]

blender::MutableSpan< SplinePtr > CurveEval::splines ( )

Definition at line 41 of file curve_eval.cc.

◆ splines() [2/2]

blender::Span< SplinePtr > CurveEval::splines ( ) const

◆ total_control_point_num()

int CurveEval::total_control_point_num ( ) const

Definition at line 118 of file curve_eval.cc.

References count, and splines().

Referenced by curve_eval_to_curves(), and blender::bke::get_curve_accessor_functions().

◆ total_length()

float CurveEval::total_length ( ) const

Definition at line 109 of file curve_eval.cc.

References blender::math::length(), and splines().

◆ transform()

void CurveEval::transform ( const blender::float4x4 matrix)

Definition at line 89 of file curve_eval.cc.

References splines().

◆ translate()

void CurveEval::translate ( const blender::float3 translation)

Definition at line 81 of file curve_eval.cc.

References splines().

Member Data Documentation

◆ attributes

blender::bke::CustomDataAttributes CurveEval::attributes

Definition at line 617 of file BKE_spline.hh.

Referenced by resize().


The documentation for this struct was generated from the following files: