40using bke::CurvesGeometry;
129 new_deformed_positions.
extend(
130 self_->deformed_positions_.as_span().slice(points_by_curve[i]));
132 self_->deformed_positions_ = std::move(new_deformed_positions);
145 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
157 const float brush_radius_sq_re =
pow2f(brush_radius_re);
162 for (
const int curve_i : segment) {
163 const IndexRange points = points_by_curve[curve_i];
164 if (points.
size() == 1) {
166 brush_transform_inv,
self_->deformed_positions_[points.
first()]);
170 curves_to_keep[curve_i] =
false;
175 for (
const int segment_i : points.
drop_back(1)) {
177 self_->deformed_positions_[segment_i]);
179 brush_transform_inv,
self_->deformed_positions_[segment_i + 1]);
188 if (dist_sq_re <= brush_radius_sq_re) {
189 curves_to_keep[curve_i] =
false;
212 for (
const float4x4 &brush_transform : symmetry_brush_transforms) {
220 const float brush_radius_sq_cu =
pow2f(brush_radius_cu);
225 for (
const int curve_i : segment) {
226 const IndexRange points = points_by_curve[curve_i];
228 if (points.
size() == 1) {
231 if (distance_sq_cu < brush_radius_sq_cu) {
232 curves_to_keep[curve_i] =
false;
237 for (
const int segment_i : points.
drop_back(1)) {
238 const float3 &pos1_cu =
self_->deformed_positions_[segment_i];
239 const float3 &pos2_cu =
self_->deformed_positions_[segment_i + 1];
242 brush_cu, pos1_cu, pos2_cu);
243 if (distance_sq_cu > brush_radius_sq_cu) {
246 curves_to_keep[curve_i] =
false;
263 if (brush_3d.has_value()) {
264 self_->brush_3d_ = *brush_3d;
276 executor.
execute(*
this, stroke_extension);
281 return std::make_unique<DeleteOperation>();
Low-level operations for curves.
Object is a sort of wrapper for general info.
#define BLI_assert_unreachable()
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
constexpr int64_t first() const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t size() const
void extend(Span< T > array)
OffsetIndices< int > points_by_curve() const
const Depsgraph * depsgraph
void on_stroke_extended(const PaintStroke &stroke, const StrokeExtension &stroke_extension) override
friend struct DeleteOperationExecutor
void foreach_segment(Fn &&fn, Mode mode=exec_mode::serial) const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) 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, LinearAllocator<> &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)
constexpr ParallelGrainSize grain_size(int grain_size)
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)
void WM_main_add_notifier(uint type, void *reference)
float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
float BKE_brush_radius_get(const Paint *paint, const Brush *brush)
@ PAINT_FALLOFF_SHAPE_SPHERE
@ PAINT_FALLOFF_SHAPE_TUBE
float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const float4x4 &mat)
MatBase< float, 4, 4 > float4x4
void ED_region_tag_redraw(ARegion *region)
MINLINE float pow2f(float x)
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
VecBase< float, 2 > float2
void DEG_id_tag_update(ID *id, unsigned int flags)
float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3])
const Brush * BKE_paint_brush_for_read(const Paint *paint)
VecBase< float, 3 > float3
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])
eBrushFalloffShape falloff_shape
struct ToolSettings * toolsettings
DeleteOperationExecutor(const PaintStroke &stroke)
void delete_projected(const float4x4 &brush_transform, MutableSpan< bool > curves_to_keep)
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 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_