|
Blender V5.0
|
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 (Object &ob, 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 (Object &ob, const blender::bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, blender::bke::CurvesGeometry &dst, const bool keep_caps) |
| bool | stroke_eraser (Object &ob, 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) |
| static bool | skip_strokes_with_locked_material (Object &ob, const int src_curve, const IndexRange &src_points, const VArray< int > stroke_material, const VArray< float > &point_opacity, Array< Vector< ed::greasepencil::PointTransferData > > &src_to_dst_points) |
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 90 of file grease_pencil_erase.cc.
|
inline |
Definition at line 103 of file grease_pencil_erase.cc.
|
inline |
Definition at line 583 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, opacity_threshold, blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::radius, blender::ed::greasepencil::ramer_douglas_peucker_simplify(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove(), blender::math::round(), sample, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::squared_radius.
Referenced by soft_eraser().
|
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 317 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().
Referenced by hard_eraser(), and soft_eraser().
|
inline |
Definition at line 916 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(), C, CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_scene(), CTX_wm_region(), Object::data, DEG_get_evaluated(), depsgraph, blender::bke::crazyspace::get_evaluated_grease_pencil_drawing_deformation(), GP_BRUSH_ERASER_HARD, GP_BRUSH_ERASER_SOFT, GP_BRUSH_ERASER_STROKE, ToolSettings::gp_paint, GPAINT_BRUSH_TYPE_DRAW, hard_eraser(), blender::ed::sculpt_paint::InputSample::mouse_position, GpPaint::paint, blender::threading::parallel_for(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::ed::sculpt_paint::InputSample::pressure, round_fl_to_int(), self, soft_eraser(), stroke_eraser(), and Scene::toolsettings.
Referenced by blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_extended().
|
inline |
Definition at line 504 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::ed::greasepencil::compute_topology_change(), blender::bke::Curve, curves_intersections_and_points_sides(), blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), blender::IndexRange::first(), blender::ed::sculpt_paint::greasepencil::Inside, blender::ed::sculpt_paint::greasepencil::InsideOutsideBoundary, blender::IndexRange::last(), blender::bke::AttributeAccessor::lookup_or_default(), blender::ed::sculpt_paint::greasepencil::Outside, blender::bke::Point, blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and skip_strokes_with_locked_material().
Referenced by execute().
|
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 126 of file grease_pencil_erase.cc.
References b, blender::math::distance(), blender::math::distance_squared(), blender::math::dot(), i, 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 205 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.
|
inlinestatic |
Definition at line 476 of file grease_pencil_erase.cc.
References BKE_gpencil_material_settings(), blender::IndexRange::first(), MaterialGPencilStyle::flag, GP_MATERIAL_LOCKED, and blender::IndexRange::last().
Referenced by hard_eraser(), and soft_eraser().
|
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 700 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(), compute_piecewise_linear_falloff(), blender::bke::Curve, curves_intersections_and_points_sides(), blender::bke::CurvesGeometry::curves_range(), blender::math::distance(), distance(), blender::IndexRange::first(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::hard_erase, blender::ed::sculpt_paint::greasepencil::Inside, blender::ed::sculpt_paint::greasepencil::InsideOutsideBoundary, 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::ed::sculpt_paint::greasepencil::EraseOperationExecutor::EraserRing::opacity, blender::ed::sculpt_paint::greasepencil::Outside, blender::threading::parallel_for(), blender::bke::Point, blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_last(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and skip_strokes_with_locked_material().
Referenced by execute().
|
inline |
Definition at line 854 of file grease_pencil_erase.cc.
References blender::bke::CurvesGeometry::attributes(), BKE_gpencil_material_settings(), blender::bke::Curve, blender::bke::curves_copy_curve_selection(), blender::bke::CurvesGeometry::curves_num(), blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), dist_to_line_segment_v2(), blender::math::distance(), blender::IndexRange::drop_back(), eraser_radius, blender::IndexRange::first(), MaterialGPencilStyle::flag, IndexMask::from_predicate(), GP_MATERIAL_LOCKED, blender::IndexRange::last(), blender::bke::AttributeAccessor::lookup_or_default(), blender::bke::CurvesGeometry::points_by_curve(), and blender::IndexRange::size().
Referenced by execute().
| Brush* blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::brush_ |
Definition at line 95 of file grease_pencil_erase.cc.
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_radius |
Definition at line 93 of file grease_pencil_erase.cc.
Referenced by stroke_eraser().
| int64_t blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_squared_radius_pixels |
Definition at line 98 of file grease_pencil_erase.cc.
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_strength |
Definition at line 94 of file grease_pencil_erase.cc.
| float2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position |
Definition at line 92 of file grease_pencil_erase.cc.
| int2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position_pixels |
Definition at line 97 of file grease_pencil_erase.cc.
|
staticconstexpr |
Definition at line 101 of file grease_pencil_erase.cc.
Referenced by compute_piecewise_linear_falloff().