40using blender::bke::CurvesGeometry;
128 new_deformed_positions.
extend(
129 self_->deformed_positions_.as_span().slice(points_by_curve[
i]));
131 self_->deformed_positions_ = std::move(new_deformed_positions);
144 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
156 const float brush_radius_sq_re =
pow2f(brush_radius_re);
160 for (
const int curve_i : segment) {
161 const IndexRange points = points_by_curve[curve_i];
162 if (points.
size() == 1) {
168 curves_to_keep[curve_i] =
false;
173 for (
const int segment_i : points.
drop_back(1)) {
175 self_->deformed_positions_[segment_i]);
177 self_->deformed_positions_[segment_i + 1]);
184 if (dist_sq_re <= brush_radius_sq_re) {
185 curves_to_keep[curve_i] =
false;
207 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
215 const float brush_radius_sq_cu =
pow2f(brush_radius_cu);
219 for (
const int curve_i : segment) {
220 const IndexRange points = points_by_curve[curve_i];
222 if (points.
size() == 1) {
225 if (distance_sq_cu < brush_radius_sq_cu) {
226 curves_to_keep[curve_i] =
false;
231 for (
const int segment_i : points.
drop_back(1)) {
232 const float3 &pos1_cu =
self_->deformed_positions_[segment_i];
233 const float3 &pos2_cu =
self_->deformed_positions_[segment_i + 1];
236 if (distance_sq_cu > brush_radius_sq_cu) {
239 curves_to_keep[curve_i] =
false;
255 if (brush_3d.has_value()) {
256 self_->brush_3d_ = *brush_3d;
268 executor.
execute(*
this,
C, stroke_extension);
273 return std::make_unique<DeleteOperation>();
float BKE_brush_radius_get(const Paint *paint, const Brush *brush)
Object * CTX_data_active_object(const bContext *C)
Low-level operations for curves.
const Brush * BKE_paint_brush_for_read(const Paint *paint)
#define BLI_assert_unreachable()
MINLINE float pow2f(float x)
float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3])
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void DEG_id_tag_update(ID *id, unsigned int flags)
@ PAINT_FALLOFF_SHAPE_SPHERE
@ PAINT_FALLOFF_SHAPE_TUBE
Object is a sort of wrapper for general info.
void ED_region_tag_redraw(ARegion *region)
blender::float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const blender::float4x4 &mat)
void ED_view3d_win_to_3d(const View3D *v3d, const ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
constexpr int64_t first() const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t size() const
void extend(Span< T > array)
void on_stroke_extended(const bContext &C, const StrokeExtension &stroke_extension) override
friend struct DeleteOperationExecutor
void foreach_index(Fn &&fn) const
GeometryDeformation get_evaluated_curves_deformation(const Object *ob_eval, const Object &ob_orig)
CurvesGeometry curves_copy_curve_selection(const CurvesGeometry &curves, const IndexMask &curves_to_copy, const AttributeFilter &attribute_filter)
IndexMask retrieve_selected_curves(const bke::CurvesGeometry &curves, IndexMaskMemory &memory)
std::optional< CurvesBrush3D > sample_curves_3d_brush(const Depsgraph &depsgraph, const ARegion ®ion, const View3D &v3d, const RegionView3D &rv3d, const Object &curves_object, const float2 &brush_pos_re, const float brush_radius_re)
void remember_stroke_position(CurvesSculpt &curves_sculpt, const float3 &brush_position_wo)
std::unique_ptr< CurvesSculptStrokeOperation > new_delete_operation()
Vector< float4x4 > get_symmetry_brush_transforms(const eCurvesSymmetryType symmetry)
float brush_radius_factor(const Brush &brush, const StrokeExtension &stroke_extension)
CartesianBasis invert(const CartesianBasis &basis)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
VecBase< float, 3 > float3
void delete_projected(const float4x4 &brush_transform, MutableSpan< bool > curves_to_keep)
DeleteOperationExecutor(const bContext &C)
float brush_radius_base_re_
CurvesSurfaceTransforms transforms_
void delete_spherical_with_symmetry(MutableSpan< bool > curves_to_keep)
CurvesSculpt * curves_sculpt_
void execute(DeleteOperation &self, const bContext &C, const StrokeExtension &stroke_extension)
IndexMaskMemory selected_curve_memory_
void delete_projected_with_symmetry(MutableSpan< bool > curves_to_keep)
IndexMask curve_selection_
void delete_spherical(const float3 &brush_cu, MutableSpan< bool > curves_to_keep)
void initialize_spherical_brush_reference_point()
float brush_radius_factor_
CurvesSculptCommonContext ctx_
void WM_main_add_notifier(uint type, void *reference)