|
Blender V4.3
|
Classes | |
| struct | EraserRing |
Public Member Functions | |
| EraseOperationExecutor (const bContext &) | |
| int8_t | segment_intersections_and_points_sides (const int2 &point, const int2 &point_after, const int64_t squared_radius, float &r_mu0, float &r_mu1, PointCircleSide &r_point_side, PointCircleSide &r_point_after_side) const |
| int | curves_intersections_and_points_sides (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, const Span< EraserRing > rings, MutableSpan< std::pair< int, PointCircleSide > > r_point_ring, MutableSpan< SegmentCircleIntersection > r_intersections) const |
| bool | hard_eraser (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, bke::CurvesGeometry &dst, const bool keep_caps) const |
| Vector< EraserRing > | compute_piecewise_linear_falloff () const |
| bool | soft_eraser (const blender::bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, blender::bke::CurvesGeometry &dst, const bool keep_caps) |
| bool | stroke_eraser (const bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, bke::CurvesGeometry &dst) const |
| void | execute (EraseOperation &self, const bContext &C, const InputSample &extension_sample) |
Static Public Member Functions | |
| static int8_t | intersections_segment_circle_integers (const int2 &s0, const int2 &s1, const int2 ¢er, const int64_t radius_2, int64_t &r_mu0, int64_t &r_mu1) |
Public Attributes | |
| float2 | mouse_position |
| float | eraser_radius |
| float | eraser_strength |
| Brush * | brush_ |
| int2 | mouse_position_pixels |
| int64_t | eraser_squared_radius_pixels |
Static Public Attributes | |
| static constexpr float | opacity_threshold = 0.05f |
Utility class that actually executes the update when the stroke is updated. That's useful because it avoids passing a very large number of parameters between functions.
Definition at line 86 of file grease_pencil_erase.cc.
|
inline |
Definition at line 99 of file grease_pencil_erase.cc.
|
inline |
Definition at line 542 of file grease_pencil_erase.cc.
References blender::math::abs(), BKE_brush_curve_strength(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::math::interpolate(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::opacity, blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::radius, blender::Vector< T, InlineBufferCapacity, Allocator >::remove(), blender::math::round(), sample, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Compute intersections between the eraser and the input src Curves Geometry. Also computes if the points of the geometry lie inside/outside, or in the boundary of the eraser.
| screen_space_positions | 2D positions of the geometry in screen space. |
| intersections_max_per_segment | maximum number of intersections per-segment. |
| r_point_side | (output) for each point in the source, enum describing where the point lies relatively to the eraser: inside, outside or at the boundary of the eraser. |
| r_intersections | (output) array containing all the intersections found in the curves geometry. The size of the array should be src.points_num*intersections_max_per_segment. Initially all intersections are set as invalid, and the function fills valid intersections at an offset of src_point*intersections_max_per_segment. |
Definition at line 313 of file grease_pencil_erase.cc.
References blender::bke::CurvesGeometry::cyclic(), blender::threading::parallel_for(), blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), and blender::Span< T >::size().
|
inline |
Definition at line 852 of file grease_pencil_erase.cc.
References BKE_brush_use_alpha_pressure(), BKE_brush_use_size_pressure(), BKE_curvemapping_evaluateF(), BKE_paint_brush(), BKE_paint_eraser_brush(), CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_scene(), CTX_wm_region(), BrushGpencilSettings::curve_strength, Object::data, DEG_get_evaluated_object(), depsgraph, GP_BRUSH_ERASER_HARD, GP_BRUSH_ERASER_SOFT, GP_BRUSH_ERASER_STROKE, GPAINT_BRUSH_TYPE_DRAW, Brush::gpencil_brush_type, Brush::gpencil_settings, int2, blender::ed::sculpt_paint::InputSample::mouse_position, blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::ed::sculpt_paint::InputSample::pressure, round_fl_to_int(), and self.
Referenced by blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_extended().
|
inline |
Definition at line 476 of file grease_pencil_erase.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), blender::IndexRange::first(), blender::IndexRange::last(), blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inlinestatic |
Computes the intersections between a 2D line segment and a circle with integer values.
| s0,s1 | endpoints of the segment. |
| center | center of the circle, |
| radius_2 | squared radius of the circle. |
| r_mu0 | (output) signed distance from s0 to the first intersection, if it exists. |
| r_mu1 | (output) signed distance from s0 to the second intersection, if it exists. |
All intersections with the infinite line of the segment are considered.
Definition at line 122 of file grease_pencil_erase.cc.
References b, blender::math::distance(), blender::math::distance_squared(), blender::math::dot(), blender::math::round(), and blender::math::sqrt().
Referenced by segment_intersections_and_points_sides().
|
inline |
Computes the intersection between the eraser brush and a 2D segment, using integer values. Also computes if the endpoints of the segment lie inside/outside, or in the boundary of the eraser.
| point,point_after | coordinates of the first (resp. second) endpoint in the segment. |
| squared_radius | squared radius of the brush in pixels. |
| r_mu0,r_mu0 | (output) factor of the two intersections if they exists, otherwise (-1). |
| point_side,point_after_side | (output) enum describing where the first (resp. second) endpoint lies relatively to the eraser: inside, outside or at the boundary of the eraser. |
Note that the eraser is represented as a circle, and thus there can be only 0, 1 or 2 intersections with a segment.
Definition at line 201 of file grease_pencil_erase.cc.
References blender::math::distance(), float, blender::ed::sculpt_paint::greasepencil::Inside, blender::ed::sculpt_paint::greasepencil::InsideOutsideBoundary, intersections_segment_circle_integers(), blender::ed::sculpt_paint::greasepencil::Outside, and blender::ed::sculpt_paint::greasepencil::OutsideInsideBoundary.
|
inline |
The soft eraser decreases the opacity of the points it hits. The new opacity is computed as a minimum between the current opacity and a falloff function of the distance of the point to the center of the eraser. If the opacity of a point falls below a threshold, then the point is removed from the curves.
Definition at line 659 of file grease_pencil_erase.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::bke::CurvesGeometry::attributes(), blender::bke::CurvesGeometry::attributes_for_write(), b, blender::Array< T, InlineBufferCapacity, Allocator >::begin(), BKE_brush_curve_strength(), brush_strength(), blender::math::clamp(), blender::bke::CurvesGeometry::curves_range(), blender::math::distance(), blender::IndexRange::first(), blender::math::interpolate(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::IndexRange::last(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span(), blender::bke::AttributeAccessor::lookup_or_default(), blender::math::max(), blender::math::min(), blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_last(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Definition at line 800 of file grease_pencil_erase.cc.
References blender::bke::CurvesGeometry::curves_num(), blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), dist_to_line_segment_v2(), blender::IndexRange::drop_back(), blender::IndexRange::first(), blender::IndexRange::last(), blender::bke::CurvesGeometry::points_by_curve(), blender::index_mask::IndexMask::size(), and blender::IndexRange::size().
| Brush* blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::brush_ |
Definition at line 91 of file grease_pencil_erase.cc.
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_radius |
Definition at line 89 of file grease_pencil_erase.cc.
| int64_t blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_squared_radius_pixels |
Definition at line 94 of file grease_pencil_erase.cc.
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_strength |
Definition at line 90 of file grease_pencil_erase.cc.
| float2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position |
Definition at line 88 of file grease_pencil_erase.cc.
| int2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position_pixels |
Definition at line 93 of file grease_pencil_erase.cc.
|
staticconstexpr |
Definition at line 97 of file grease_pencil_erase.cc.