Blender V5.3
blender::ed::greasepencil::trim Namespace Reference

Functions

static bool check_line_segment_lasso_intersection (const int2 &pos_a, const int2 &pos_b, const Span< int2 > mcoords)
static void check_segments_in_lasso (const Span< float2 > screen_space_positions, const Span< Bounds< float2 > > screen_space_bbox, const Span< int2 > mcoords, const Span< Segment > all_segments, const IndexMask &editable_curves, const OffsetIndices< int > segments_by_curve, MutableSpan< bool > segments_to_keep)
static bke::CurvesGeometry create_curves_from_segments (const bke::CurvesGeometry &src, const Span< Segment > segments, const Span< bool > segment_reversed, const Span< bool > cyclic, const OffsetIndices< int > segment_offsets)
bke::CurvesGeometry trim_curve_segments (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const Span< int2 > mcoords, const IndexMask &editable_curves, const IndexMask &visible_curves, const bool keep_caps)
bke::CurvesGeometry trim_curve_segment_ends (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const IndexMask &editable_curves, const IndexMask &visible_curves, const bool keep_caps)

Function Documentation

◆ check_line_segment_lasso_intersection()

bool blender::ed::greasepencil::trim::check_line_segment_lasso_intersection ( const int2 & pos_a,
const int2 & pos_b,
const Span< int2 > mcoords )
static

◆ check_segments_in_lasso()

◆ create_curves_from_segments()

◆ trim_curve_segment_ends()

bke::CurvesGeometry blender::ed::greasepencil::trim::trim_curve_segment_ends ( const bke::CurvesGeometry & src,
Span< float2 > screen_space_positions,
const IndexMask & editable_curves,
const IndexMask & visible_curves,
bool keep_caps )

Trim the editable curves from the start and end until intersection or self-intersection. If a curve does not have intersection it will be unmodified.

Note: All editable curves must also be visible.

Parameters
srcCurves geometry for target curves.
screen_space_positionsScreen-space positions computed in advance.
editable_curvesMask of all curves that can be trimmed.
visible_curvesMask of all curves that are visible.
keep_capsIf the start and end cap attributes should not be set to Flat.

Definition at line 348 of file grease_pencil_trim.cc.

References blender::offset_indices::accumulate_counts_to_offsets(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::ed::greasepencil::segment::compute_bounding_boxes(), blender::ed::greasepencil::segment::create_connections_from_curves(), create_curves_from_segments(), blender::ed::greasepencil::segment::create_segments_from_intersections(), blender::bke::CurvesGeometry::curves_num(), blender::ed::greasepencil::segment::cut_caps(), blender::ed::greasepencil::segment::find_intersections_between_all_curves(), blender::IndexRange::first(), blender::ed::greasepencil::segment::follow_segment_connections(), blender::index_mask::IndexMask::foreach_index(), blender::VArray< T >::from_single(), blender::exec_mode::grain_size(), blender::bke::CurvesGeometry::is_empty(), blender::IndexRange::last(), blender::bke::CurvesGeometry::points_by_curve(), blender::ed::greasepencil::segment::SEGMENT_CONNECTION_NULL, blender::IndexRange::size(), blender::offset_indices::OffsetIndices< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::ed::greasepencil::segment::store_segment_map_on_intersections(), and trim_curve_segment_ends().

Referenced by trim_curve_segment_ends(), and blender::ed::sculpt_paint::greasepencil::trim_stroke_ends().

◆ trim_curve_segments()

bke::CurvesGeometry blender::ed::greasepencil::trim::trim_curve_segments ( const bke::CurvesGeometry & src,
Span< float2 > screen_space_positions,
Span< int2 > mcoords,
const IndexMask & editable_curves,
const IndexMask & visible_curves,
bool keep_caps )

Trim all segments of editable curves that are inside of a given lasso region.

Note: All editable curves must also be visible.

Parameters
srcCurves geometry for target curves.
screen_space_positionsScreen-space positions computed in advance.
mcoordsScreen-space points that define the lasso region.
editable_curvesMask of all curves that can be trimmed.
visible_curvesMask of all curves that are visible.
keep_capsIf the start and end cap attributes should not be set to Flat.

Definition at line 272 of file grease_pencil_trim.cc.

References blender::offset_indices::accumulate_counts_to_offsets(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), check_segments_in_lasso(), blender::ed::greasepencil::segment::compute_bounding_boxes(), blender::ed::greasepencil::segment::create_connections_from_curves(), create_curves_from_segments(), blender::ed::greasepencil::segment::create_segments_from_intersections(), blender::bke::CurvesGeometry::curves_num(), blender::ed::greasepencil::segment::cut_caps(), blender::bke::CurvesGeometry::cyclic(), blender::ed::greasepencil::segment::find_intersections_between_all_curves(), blender::ed::greasepencil::segment::follow_segment_connections(), blender::bke::CurvesGeometry::is_empty(), blender::bke::CurvesGeometry::points_by_curve(), blender::ed::greasepencil::segment::SEGMENT_CONNECTION_NULL, blender::offset_indices::OffsetIndices< T >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::ed::greasepencil::segment::store_segment_map_on_intersections(), and trim_curve_segments().

Referenced by blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), blender::ed::greasepencil::tests::TEST_F(), and trim_curve_segments().