114 self_->deformed_positions_ = deformation.positions;
135 new_deformed_positions.
extend(
136 self_->deformed_positions_.as_span().slice(points_by_curve[i]));
138 self_->deformed_positions_ = std::move(new_deformed_positions);
151 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
163 const float brush_radius_sq_re =
pow2f(brush_radius_re);
167 for (
const int curve_i : segment) {
168 const IndexRange points = points_by_curve[curve_i];
169 if (points.size() == 1) {
171 self_->deformed_positions_[points.first()]);
175 curves_to_keep[curve_i] =
false;
180 for (
const int segment_i : points.drop_back(1)) {
182 self_->deformed_positions_[segment_i]);
184 self_->deformed_positions_[segment_i + 1]);
191 if (dist_sq_re <= brush_radius_sq_re) {
192 curves_to_keep[curve_i] =
false;
214 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
222 const float brush_radius_sq_cu =
pow2f(brush_radius_cu);
226 for (
const int curve_i : segment) {
227 const IndexRange points = points_by_curve[curve_i];
229 if (points.size() == 1) {
230 const float3 &pos_cu =
self_->deformed_positions_[points.first()];
232 if (distance_sq_cu < brush_radius_sq_cu) {
233 curves_to_keep[curve_i] =
false;
238 for (
const int segment_i : points.drop_back(1)) {
239 const float3 &pos1_cu =
self_->deformed_positions_[segment_i];
240 const float3 &pos2_cu =
self_->deformed_positions_[segment_i + 1];
243 if (distance_sq_cu > brush_radius_sq_cu) {
246 curves_to_keep[curve_i] =
false;
262 if (brush_3d.has_value()) {
263 self_->brush_3d_ = *brush_3d;
272 executor.
execute(*
this, C, stroke_extension);
277 return std::make_unique<DeleteOperation>();
int BKE_brush_size_get(const Scene *scene, 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()
A KD-tree for nearest neighbor search.
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)
void extend(Span< T > array)
OffsetIndices< int > points_by_curve() const
const Depsgraph * depsgraph
void on_stroke_extended(const bContext &C, const StrokeExtension &stroke_extension) override
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
void foreach_index(Fn &&fn) const
void foreach_segment(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)
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)
struct ToolSettings * toolsettings
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)
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)
const CurvesSculpt * curves_sculpt_
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)