Blender V5.3
blender::ed::sculpt_paint::CutOperationExecutor Struct Reference

Public Member Functions

 CutOperationExecutor (const PaintStroke &stroke)
void execute (CutOperation &self, const StrokeExtension &stroke_extension)
void find_projected_points_in_stroke_with_symmetry (MutableSpan< BrushProjectionInfo > r_brush_projection_info)
void find_projected_points_in_stroke (const float4x4 &brush_transform_inv, const int brush_transform_index, MutableSpan< BrushProjectionInfo > r_brush_projection_info)
void find_spherical_points_in_stroke_with_symmetry (MutableSpan< BrushProjectionInfo > r_brush_projection_info)
void find_spherical_points_in_stroke (const int brush_transform_index, const float3 &brush_pos_cu, MutableSpan< BrushProjectionInfo > r_brush_projection_info)
bool should_point_be_cut (const int point_i, const uint32_t stroke_hash)
float3 find_projected_cut_boundary (const float3 &point_outside_cu, const float3 &point_inside_cu, const float2 &brush_pos_re, const float brush_radius_re, const float4x4 &transform_cu_to_re)
float intersect_line_segment_sphere_2d (const float2 &line_segment_start, const float2 &line_segment_end, const float2 &sphere_position, const float sphere_radius)
float3 find_spherical_cut_boundary (const float3 &point_outside_cu, const float3 &point_inside_cu, const float3 &brush_pos_cu, const float brush_radius_cu)
void cut_curves (const Span< BrushProjectionInfo > brush_projection_info, MutableSpan< bool > r_curves_to_keep, MutableSpan< float > r_ends)

Public Attributes

CutOperation * self_ = nullptr
CurvesSculptCommonContext ctx_
Object * object_ = nullptr
Curves * curves_id_ = nullptr
CurvesGeometry * curves_ = nullptr
VArray< float > point_factors_
IndexMaskMemory selected_curve_memory_
IndexMask curve_selection_
CurvesSculpt * curves_sculpt_ = nullptr
const Brush * brush_ = nullptr
float brush_radius_base_re_
float brush_radius_factor_
float2 brush_pos_re_
float brush_strength_
CurvesSurfaceTransforms transforms_

Detailed Description

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 56 of file sculpt_cut.cc.

Constructor & Destructor Documentation

◆ CutOperationExecutor()

blender::ed::sculpt_paint::CutOperationExecutor::CutOperationExecutor ( const PaintStroke & stroke)
inline

Definition at line 77 of file sculpt_cut.cc.

References ctx_.

Member Function Documentation

◆ cut_curves()

void blender::ed::sculpt_paint::CutOperationExecutor::cut_curves ( const Span< BrushProjectionInfo > brush_projection_info,
MutableSpan< bool > r_curves_to_keep,
MutableSpan< float > r_ends )
inline

cu or re, depending on falloff shape

Only used for sphere falloff.

Definition at line 357 of file sculpt_cut.cc.

References blender::IndexRange::begin(), blender::Span< T >::begin(), BLI_assert_unreachable, brush_, brush_pos_re_, brush_radius_base_re_, brush_radius_factor_, blender::ed::sculpt_paint::BrushProjectionInfo::brush_transform_index, ctx_, curve_selection_, curves_, curves_id_, blender::bke::CurvesSurfaceTransforms::curves_to_world, blender::ed::sculpt_paint::CurvesSculptCommonContext::depsgraph, blender::ed::sculpt_paint::BrushProjectionInfo::distance, blender::math::distance(), blender::ED_view3d_ob_project_mat_get(), blender::ED_view3d_win_to_3d(), blender::IndexRange::end(), blender::Span< T >::end(), blender::Brush::falloff_shape, find_projected_cut_boundary(), find_spherical_cut_boundary(), blender::index_mask::IndexMask::foreach_index(), blender::index_mask::IndexMask::foreach_segment(), blender::bke::crazyspace::get_evaluated_curves_deformation(), blender::ed::sculpt_paint::get_symmetry_brush_transforms(), blender::exec_mode::grain_size(), blender::noise::hash(), blender::VecBase< T, Size >::hash(), blender::noise::hash_float(), blender::IndexRange::index_range(), blender::math::invert(), object_, blender::PAINT_FALLOFF_SHAPE_SPHERE, blender::PAINT_FALLOFF_SHAPE_TUBE, blender::bke::CurvesGeometry::points_by_curve(), blender::bke::CurvesGeometry::points_num(), blender::ed::sculpt_paint::CurvesBrush3D::position_cu, blender::bke::crazyspace::GeometryDeformation::positions, blender::bke::CurvesGeometry::positions(), blender::pow2f(), blender::ed::sculpt_paint::CurvesBrush3D::radius_cu, blender::ed::sculpt_paint::CurvesSculptCommonContext::region, blender::ed::sculpt_paint::CurvesSculptCommonContext::rv3d, self_, should_point_be_cut(), blender::Span< T >::slice(), blender::math::transform_point(), transforms_, blender::ed::sculpt_paint::CurvesSculptCommonContext::v3d, and blender::bke::CurvesSurfaceTransforms::world_to_curves.

Referenced by execute().

◆ execute()

void blender::ed::sculpt_paint::CutOperationExecutor::execute ( CutOperation & self,
const StrokeExtension & stroke_extension )
inline

Definition at line 79 of file sculpt_cut.cc.

References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), blender::bke::CurvesGeometry::attributes(), blender::BKE_brush_radius_get(), blender::BKE_paint_brush_for_read(), BLI_assert_unreachable, brush_, brush_pos_re_, brush_radius_base_re_, blender::ed::sculpt_paint::brush_radius_factor(), brush_radius_factor_, brush_strength_, blender::ed::sculpt_paint::brush_strength_get(), ctx_, curve_selection_, curves_, blender::bke::curves_copy_curve_selection(), curves_id_, blender::bke::CurvesGeometry::curves_num(), blender::ToolSettings::curves_sculpt, curves_sculpt_, blender::ed::sculpt_paint::CurvesSurfaceTransforms::CurvesSurfaceTransforms(), cut_curves(), blender::bke::CurvesGeometry::cyclic(), blender::Object::data, blender::DEG_id_tag_update(), blender::ed::sculpt_paint::CurvesSculptCommonContext::depsgraph, blender::ED_region_tag_redraw(), blender::Brush::falloff_shape, find_projected_points_in_stroke_with_symmetry(), find_spherical_points_in_stroke_with_symmetry(), blender::IndexMask::from_bools(), blender::IndexMask::from_bools_inverse(), blender::VArray< T >::from_single(), blender::VArray< T >::from_span(), blender::array_utils::gather(), blender::GEO_NODE_CURVE_SAMPLE_LENGTH, blender::ID_RECALC_GEOMETRY, blender::IndexMask::IndexMask(), blender::bke::CurvesGeometry::is_empty(), blender::index_mask::IndexMask::is_empty(), blender::ed::sculpt_paint::StrokeExtension::is_first, blender::bke::AttributeAccessor::lookup_or_default(), blender::ed::sculpt_paint::StrokeExtension::mouse_position, NC_GEOM, ND_DATA, blender::ed::sculpt_paint::CurvesSculptCommonContext::object, object_, blender::CurvesSculpt::paint, blender::PAINT_FALLOFF_SHAPE_SPHERE, blender::PAINT_FALLOFF_SHAPE_TUBE, blender::bke::Point, point_factors_, blender::bke::CurvesGeometry::points_num(), blender::ed::sculpt_paint::CurvesBrush3D::position_cu, blender::ed::sculpt_paint::CurvesSculptCommonContext::region, blender::ed::sculpt_paint::remember_stroke_position(), blender::ed::sculpt_paint::report_cyclic_not_supported(), blender::ed::sculpt_paint::StrokeExtension::reports, blender::ed::curves::retrieve_selected_curves(), blender::ed::sculpt_paint::CurvesSculptCommonContext::rv3d, blender::ed::sculpt_paint::sample_curves_3d_brush(), blender::ed::sculpt_paint::CurvesSculptCommonContext::scene, selected_curve_memory_, self_, blender::index_mask::IndexMask::size(), blender::Scene::toolsettings, blender::math::transform_point(), transforms_, blender::geometry::trim_curves(), blender::U, blender::USER_ORBIT_SELECTION, blender::ed::sculpt_paint::CurvesSculptCommonContext::v3d, and blender::WM_main_add_notifier().

Referenced by blender::ed::sculpt_paint::CutOperation::on_stroke_extended().

◆ find_projected_cut_boundary()

float3 blender::ed::sculpt_paint::CutOperationExecutor::find_projected_cut_boundary ( const float3 & point_outside_cu,
const float3 & point_inside_cu,
const float2 & brush_pos_re,
const float brush_radius_re,
const float4x4 & transform_cu_to_re )
inline

Finds the position where the brush (represented as an infinite cylinder aligned with the view) intersects with a line segment. This code works under the assumption that there is going to be an intersection.

Definition at line 280 of file sculpt_cut.cc.

References ctx_, blender::ED_view3d_project_float_v2_m4(), intersect_line_segment_sphere_2d(), and blender::ed::sculpt_paint::CurvesSculptCommonContext::region.

Referenced by cut_curves().

◆ find_projected_points_in_stroke()

◆ find_projected_points_in_stroke_with_symmetry()

void blender::ed::sculpt_paint::CutOperationExecutor::find_projected_points_in_stroke_with_symmetry ( MutableSpan< BrushProjectionInfo > r_brush_projection_info)
inline

◆ find_spherical_cut_boundary()

float3 blender::ed::sculpt_paint::CutOperationExecutor::find_spherical_cut_boundary ( const float3 & point_outside_cu,
const float3 & point_inside_cu,
const float3 & brush_pos_cu,
const float brush_radius_cu )
inline

Finds the position where the brush (represented as a sphere) intersects with a line segment. This code works under the assumption that there is going to be an intersection.

Definition at line 332 of file sculpt_cut.cc.

References b, blender::math::dot(), blender::math::max(), and sqrtf.

Referenced by cut_curves().

◆ find_spherical_points_in_stroke()

◆ find_spherical_points_in_stroke_with_symmetry()

◆ intersect_line_segment_sphere_2d()

float blender::ed::sculpt_paint::CutOperationExecutor::intersect_line_segment_sphere_2d ( const float2 & line_segment_start,
const float2 & line_segment_end,
const float2 & sphere_position,
const float sphere_radius )
inline

Finds the position where a line segment intersects a sphere, as seen in 2d space. Returns the factor "t" that describes how far along the line segment to travel (where 0 is the line segment's start and 1 is its end). This code works under the assumption that there is going to be an intersection.

Definition at line 306 of file sculpt_cut.cc.

References b, blender::math::dot(), blender::math::max(), and sqrtf.

Referenced by find_projected_cut_boundary().

◆ should_point_be_cut()

bool blender::ed::sculpt_paint::CutOperationExecutor::should_point_be_cut ( const int point_i,
const uint32_t stroke_hash )
inline
Parameters
stroke_hashA hash which should try to return different results for each iteration of the cut. Used for "blunt scissors" mode, based on brush strength.

Definition at line 259 of file sculpt_cut.cc.

References brush_strength_, blender::noise::hash_to_float(), and point_factors_.

Referenced by cut_curves().

Member Data Documentation

◆ brush_

const Brush* blender::ed::sculpt_paint::CutOperationExecutor::brush_ = nullptr

Definition at line 69 of file sculpt_cut.cc.

Referenced by cut_curves(), and execute().

◆ brush_pos_re_

float2 blender::ed::sculpt_paint::CutOperationExecutor::brush_pos_re_

◆ brush_radius_base_re_

float blender::ed::sculpt_paint::CutOperationExecutor::brush_radius_base_re_

Definition at line 70 of file sculpt_cut.cc.

Referenced by cut_curves(), and execute().

◆ brush_radius_factor_

float blender::ed::sculpt_paint::CutOperationExecutor::brush_radius_factor_

Definition at line 71 of file sculpt_cut.cc.

Referenced by cut_curves(), and execute().

◆ brush_strength_

float blender::ed::sculpt_paint::CutOperationExecutor::brush_strength_

Definition at line 73 of file sculpt_cut.cc.

Referenced by execute(), and should_point_be_cut().

◆ ctx_

◆ curve_selection_

IndexMask blender::ed::sculpt_paint::CutOperationExecutor::curve_selection_

◆ curves_

CurvesGeometry* blender::ed::sculpt_paint::CutOperationExecutor::curves_ = nullptr

◆ curves_id_

Curves* blender::ed::sculpt_paint::CutOperationExecutor::curves_id_ = nullptr

◆ curves_sculpt_

CurvesSculpt* blender::ed::sculpt_paint::CutOperationExecutor::curves_sculpt_ = nullptr

Definition at line 68 of file sculpt_cut.cc.

Referenced by execute().

◆ object_

Object* blender::ed::sculpt_paint::CutOperationExecutor::object_ = nullptr

◆ point_factors_

VArray<float> blender::ed::sculpt_paint::CutOperationExecutor::point_factors_

Definition at line 64 of file sculpt_cut.cc.

Referenced by execute(), and should_point_be_cut().

◆ selected_curve_memory_

IndexMaskMemory blender::ed::sculpt_paint::CutOperationExecutor::selected_curve_memory_

Definition at line 65 of file sculpt_cut.cc.

Referenced by execute().

◆ self_

CutOperation* blender::ed::sculpt_paint::CutOperationExecutor::self_ = nullptr

◆ transforms_

CurvesSurfaceTransforms blender::ed::sculpt_paint::CutOperationExecutor::transforms_

The documentation for this struct was generated from the following file: