|
Blender V5.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 (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 bke::CurvesGeometry &src, const Span< float2 > screen_space_positions, 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.
|
inline |
|
inline |
Definition at line 587 of file erase.cc.
References blender::math::abs(), blender::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. |
| r_point_ring | (output) for each point in the source, a pair of (ring index, side) TODO: document this fully. |
| 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 320 of file 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 930 of file erase.cc.
References blender::BKE_brush_use_alpha_pressure(), blender::BKE_brush_use_size_pressure(), blender::BKE_curvemapping_evaluateF(), C, blender::CTX_data_active_object(), blender::CTX_data_depsgraph_pointer(), blender::CTX_data_scene(), blender::CTX_wm_region(), blender::BrushGpencilSettings::curve_strength, blender::Object::data, blender::DEG_get_evaluated(), blender::bke::crazyspace::get_evaluated_grease_pencil_drawing_deformation(), blender::GP_BRUSH_ERASER_HARD, blender::GP_BRUSH_ERASER_SOFT, blender::GP_BRUSH_ERASER_STROKE, blender::Brush::gpencil_settings, hard_eraser(), layer, blender::ed::sculpt_paint::InputSample::mouse_position, blender::threading::parallel_for(), blender::bke::CurvesGeometry::points_num(), blender::bke::CurvesGeometry::points_range(), blender::ed::sculpt_paint::InputSample::pressure, blender::round_fl_to_int(), soft_eraser(), and stroke_eraser().
Referenced by blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_extended().
|
inline |
Definition at line 508 of file 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 129 of file 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_mu1 | (output) factor of the two intersections if they exists, otherwise (-1). |
| r_point_side,r_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 210 of file 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 480 of file erase.cc.
References blender::BKE_gpencil_material_settings(), blender::IndexRange::first(), blender::MaterialGPencilStyle::flag, blender::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 704 of file 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(), blender::BKE_brush_curve_strength(), blender::BLI_assert(), 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 868 of file erase.cc.
References blender::bke::CurvesGeometry::attributes(), blender::bke::Curve, blender::bke::CurvesGeometry::curves_range(), blender::bke::CurvesGeometry::cyclic(), blender::IndexMask::from_predicate(), blender::if(), blender::bke::AttributeAccessor::lookup_or_default(), and blender::bke::CurvesGeometry::points_by_curve().
Referenced by execute().
| Brush* blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::brush_ |
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_radius |
| int64_t blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_squared_radius_pixels |
| float blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::eraser_strength |
| float2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position |
| int2 blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::mouse_position_pixels |
|
staticconstexpr |
Definition at line 104 of file erase.cc.
Referenced by compute_piecewise_linear_falloff().