Blender V4.5
blender::bke::curves Namespace Reference

Namespaces

namespace  bezier
 
namespace  catmull_rom
 
namespace  nurbs
 
namespace  poly
 

Classes

struct  CurvePoint
 
struct  CurveSegment
 
class  CurvesVertexGroupsAttributeProvider
 
class  IndexRangeCyclic
 

Functions

const AttributeAccessorFunctionsget_attribute_accessor_functions ()
 
static void tag_component_topology_changed (void *owner)
 
static void tag_component_curve_types_changed (void *owner)
 
static void tag_component_positions_changed (void *owner)
 
static void tag_component_radii_changed (void *owner)
 
static void tag_component_normals_changed (void *owner)
 
static void tag_component_material_index_changed (void *owner)
 
static GeometryAttributeProviders create_attribute_providers_for_curve ()
 
static AttributeAccessorFunctions get_curves_accessor_functions ()
 
static void if_has_data_call_callback (const Span< int > offset_data, const int begin, const int end, UnselectedCallback callback)
 
template<typename Fn >
static void foreach_selected_point_ranges_per_curve_ (const IndexMask &mask, const OffsetIndices< int > points_by_curve, SelectedCallback selected_fn, Fn unselected_fn)
 
Inline Curve Methods
int segments_num (const int points_num, const bool cyclic)
 
float2 encode_surface_bary_coord (const float3 &v)
 
float3 decode_surface_bary_coord (const float2 &v)
 
IndexRange per_curve_point_offsets_range (const IndexRange points, const int curve_index)
 

Utility Functions

using SelectedCallback
 
using UnselectedCallback = FunctionRef<void(IndexRange curves, IndexRange unselected_points)>
 
IndexMask curve_to_point_selection (OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, IndexMaskMemory &memory)
 
void fill_points (OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, GPointer value, GMutableSpan dst)
 
template<typename T >
void fill_points (const OffsetIndices< int > points_by_curve, const IndexMask &curve_selection, const T &value, MutableSpan< T > dst)
 
bke::CurvesGeometry copy_only_curve_domain (const bke::CurvesGeometry &src_curves)
 
IndexMask indices_for_type (const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const CurveType type, const IndexMask &selection, IndexMaskMemory &memory)
 
void foreach_curve_by_type (const VArray< int8_t > &types, const std::array< int, CURVE_TYPES_NUM > &type_counts, const IndexMask &selection, FunctionRef< void(IndexMask)> catmull_rom_fn, FunctionRef< void(IndexMask)> poly_fn, FunctionRef< void(IndexMask)> bezier_fn, FunctionRef< void(IndexMask)> nurbs_fn)
 
void foreach_selected_point_ranges_per_curve (const IndexMask &mask, const OffsetIndices< int > points_by_curve, SelectedCallback selected_fn)
 
void foreach_selected_point_ranges_per_curve (const IndexMask &mask, const OffsetIndices< int > points_by_curve, SelectedCallback selected_fn, UnselectedCallback unselected_fn)
 

Typedef Documentation

◆ SelectedCallback

Initial value:
FunctionRef<void(
int curve_i, IndexRange curve_points, Span<IndexRange> selected_point_ranges)>

Definition at line 511 of file BKE_curves_utils.hh.

◆ UnselectedCallback

Definition at line 513 of file BKE_curves_utils.hh.

Function Documentation

◆ copy_only_curve_domain()

CurvesGeometry blender::bke::curves::copy_only_curve_domain ( const bke::CurvesGeometry & src_curves)

Create new curves with the same number of curves as the input, but no points. Copy all curve domain attributes to the new curves, except the offsets encoding the size of each curve.

Used for operations that change the number of points but not the number of curves, allowing creation of the new offsets directly inside the new array.

Warning
The returned curves have invalid offsets!

Definition at line 40 of file curves_utils.cc.

References CD_MASK_ALL, CurvesGeometry::curve_data, blender::bke::CurvesGeometry::curves_num(), CustomData_init_from(), and CurvesGeometry::runtime.

Referenced by blender::geometry::convert_curves_to_bezier(), blender::geometry::convert_curves_to_catmull_rom_or_poly(), blender::geometry::convert_curves_to_nurbs(), blender::ed::greasepencil::curves_merge_by_distance(), blender::geometry::extend_curves(), blender::ed::curves::extrude_curves(), blender::geometry::fit_poly_to_bezier_curves(), blender::geometry::resample_to_count(), blender::geometry::resample_to_evaluated(), blender::geometry::resample_to_length(), blender::geometry::resample_to_uniform(), and blender::ed::curves::resize_curves().

◆ create_attribute_providers_for_curve()

◆ curve_to_point_selection()

IndexMask blender::bke::curves::curve_to_point_selection ( OffsetIndices< int > points_by_curve,
const IndexMask & curve_selection,
IndexMaskMemory & memory )

◆ decode_surface_bary_coord()

float3 blender::bke::curves::decode_surface_bary_coord ( const float2 & v)
inline

Definition at line 572 of file BKE_curves.hh.

References v.

◆ encode_surface_bary_coord()

float2 blender::bke::curves::encode_surface_bary_coord ( const float3 & v)
inline

Definition at line 566 of file BKE_curves.hh.

References BLI_assert, and v.

◆ fill_points() [1/2]

template<typename T >
void blender::bke::curves::fill_points ( const OffsetIndices< int > points_by_curve,
const IndexMask & curve_selection,
const T & value,
MutableSpan< T > dst )

Definition at line 478 of file BKE_curves_utils.hh.

References fill_points(), and value.

◆ fill_points() [2/2]

◆ foreach_curve_by_type()

void blender::bke::curves::foreach_curve_by_type ( const VArray< int8_t > & types,
const std::array< int, CURVE_TYPES_NUM > & type_counts,
const IndexMask & selection,
FunctionRef< void(IndexMask)> catmull_rom_fn,
FunctionRef< void(IndexMask)> poly_fn,
FunctionRef< void(IndexMask)> bezier_fn,
FunctionRef< void(IndexMask)> nurbs_fn )

◆ foreach_selected_point_ranges_per_curve() [1/2]

void blender::bke::curves::foreach_selected_point_ranges_per_curve ( const IndexMask & mask,
const OffsetIndices< int > points_by_curve,
SelectedCallback selected_fn )

Calls callback function for each curve having selected points.

Parameters
maskselected points.
points_by_curveThe offsets of every curve into arrays on the points domain.
selected_fncallback function called for each curve with at least one point selected.

Definition at line 147 of file curves_utils.cc.

References foreach_selected_point_ranges_per_curve_(), and mask().

Referenced by blender::ed::curves::calc_curves_extrusion(), blender::ed::curves::duplicate_points(), blender::ed::curves::separate_points(), and blender::ed::curves::split_points().

◆ foreach_selected_point_ranges_per_curve() [2/2]

void blender::bke::curves::foreach_selected_point_ranges_per_curve ( const IndexMask & mask,
const OffsetIndices< int > points_by_curve,
SelectedCallback selected_fn,
UnselectedCallback unselected_fn )

Calls callback function for each curve having selected points. Calls second callback for groups of curves with no points selected.

Parameters
maskselected points.
points_by_curveThe offsets of every curve into arrays on the points domain.
selected_fncallback function called for each curve with at least one point selected.
unselected_fncallback function called for groups of curves with no selected points.

Definition at line 154 of file curves_utils.cc.

References foreach_selected_point_ranges_per_curve_(), and mask().

◆ foreach_selected_point_ranges_per_curve_()

◆ get_attribute_accessor_functions()

const AttributeAccessorFunctions & blender::bke::curves::get_attribute_accessor_functions ( )

◆ get_curves_accessor_functions()

◆ if_has_data_call_callback()

static void blender::bke::curves::if_has_data_call_callback ( const Span< int > offset_data,
const int begin,
const int end,
UnselectedCallback callback )
static

◆ indices_for_type()

IndexMask blender::bke::curves::indices_for_type ( const VArray< int8_t > & types,
const std::array< int, CURVE_TYPES_NUM > & type_counts,
const CurveType type,
const IndexMask & selection,
IndexMaskMemory & memory )

◆ per_curve_point_offsets_range()

IndexRange blender::bke::curves::per_curve_point_offsets_range ( const IndexRange points,
const int curve_index )
inline

Return a range used to retrieve values from an array of values stored per point, but with an extra element at the end of each curve. This is useful for offsets within curves, where it is convenient to store the first 0 and have the last offset be the total result curve size, using the same rules as #OffsetIndices.

Definition at line 583 of file BKE_curves.hh.

References blender::IndexRange::size(), and blender::IndexRange::start().

Referenced by blender::bke::CurvesGeometry::bezier_evaluated_offsets_for_curve(), blender::geometry::calculate_result_offsets(), blender::geometry::calculate_result_offsets(), blender::geometry::duplicate_fillet_point_data(), and blender::geometry::subdivide_attribute_linear().

◆ segments_num()

int blender::bke::curves::segments_num ( const int points_num,
const bool cyclic )
inline

The number of segments between control points, accounting for the last segment of cyclic curves. The logic is simple, but this function should be used to make intentions clearer.

Definition at line 560 of file BKE_curves.hh.

References BLI_assert.

Referenced by blender::bke::curves::nurbs::calculate_basis_cache(), blender::bke::curves::catmull_rom::calculate_evaluated_num(), blender::bke::curves::nurbs::calculate_evaluated_num(), blender::draw::curve_eval_render_wire_verts_edges_len_get(), blender::bke::fill_mesh_topology(), blender::bke::curves::bezier::has_vector_handles(), and blender::bke::segments_num_no_duplicate_edge().

◆ tag_component_curve_types_changed()

static void blender::bke::curves::tag_component_curve_types_changed ( void * owner)
static

◆ tag_component_material_index_changed()

static void blender::bke::curves::tag_component_material_index_changed ( void * owner)
static

◆ tag_component_normals_changed()

static void blender::bke::curves::tag_component_normals_changed ( void * owner)
static

◆ tag_component_positions_changed()

static void blender::bke::curves::tag_component_positions_changed ( void * owner)
static

◆ tag_component_radii_changed()

static void blender::bke::curves::tag_component_radii_changed ( void * owner)
static

◆ tag_component_topology_changed()

static void blender::bke::curves::tag_component_topology_changed ( void * owner)
static