Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | void delete_projected(const float4x4 &brush_transform, MutableSpan<bool> curves_to_delete) | ||||
| Span<float3> positions_cu = curves_->positions(); | Span<float3> positions_cu = curves_->positions(); | ||||
| const float brush_radius_sq_re = pow2f(brush_radius_re_); | const float brush_radius_sq_re = pow2f(brush_radius_re_); | ||||
| threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { | threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { | ||||
| for (const int curve_i : curve_range) { | for (const int curve_i : curve_range) { | ||||
| const IndexRange points = curves_->points_for_curve(curve_i); | const IndexRange points = curves_->points_for_curve(curve_i); | ||||
| if (points.size() == 1) { | |||||
| const float3 pos_cu = brush_transform_inv * positions_cu[points.first()]; | |||||
| float2 pos_re; | |||||
| ED_view3d_project_float_v2_m4(region_, pos_cu, pos_re, projection.values); | |||||
| if (math::distance_squared(brush_pos_re_, pos_re) <= brush_radius_sq_re) { | |||||
| curves_to_delete[curve_i] = true; | |||||
| } | |||||
| continue; | |||||
| } | |||||
| for (const int segment_i : points.drop_back(1)) { | for (const int segment_i : points.drop_back(1)) { | ||||
| const float3 pos1_cu = brush_transform_inv * positions_cu[segment_i]; | const float3 pos1_cu = brush_transform_inv * positions_cu[segment_i]; | ||||
| const float3 pos2_cu = brush_transform_inv * positions_cu[segment_i + 1]; | const float3 pos2_cu = brush_transform_inv * positions_cu[segment_i + 1]; | ||||
| float2 pos1_re, pos2_re; | float2 pos1_re, pos2_re; | ||||
| ED_view3d_project_float_v2_m4(region_, pos1_cu, pos1_re, projection.values); | ED_view3d_project_float_v2_m4(region_, pos1_cu, pos1_re, projection.values); | ||||
| ED_view3d_project_float_v2_m4(region_, pos2_cu, pos2_re, projection.values); | ED_view3d_project_float_v2_m4(region_, pos2_cu, pos2_re, projection.values); | ||||
| Show All 34 Lines | void delete_spherical(const float3 &brush_cu, MutableSpan<bool> curves_to_delete) | ||||
| Span<float3> positions_cu = curves_->positions(); | Span<float3> positions_cu = curves_->positions(); | ||||
| const float brush_radius_cu = self_->brush_3d_.radius_cu; | const float brush_radius_cu = self_->brush_3d_.radius_cu; | ||||
| const float brush_radius_sq_cu = pow2f(brush_radius_cu); | const float brush_radius_sq_cu = pow2f(brush_radius_cu); | ||||
| threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { | threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { | ||||
| for (const int curve_i : curve_range) { | for (const int curve_i : curve_range) { | ||||
| const IndexRange points = curves_->points_for_curve(curve_i); | const IndexRange points = curves_->points_for_curve(curve_i); | ||||
| if (points.size() == 1) { | |||||
| const float3 &pos_cu = positions_cu[points.first()]; | |||||
| const float distance_sq_cu = math::distance_squared(pos_cu, brush_cu); | |||||
| if (distance_sq_cu < brush_radius_sq_cu) { | |||||
| curves_to_delete[curve_i] = true; | |||||
| } | |||||
| continue; | |||||
| } | |||||
| for (const int segment_i : points.drop_back(1)) { | for (const int segment_i : points.drop_back(1)) { | ||||
| const float3 &pos1_cu = positions_cu[segment_i]; | const float3 &pos1_cu = positions_cu[segment_i]; | ||||
| const float3 &pos2_cu = positions_cu[segment_i + 1]; | const float3 &pos2_cu = positions_cu[segment_i + 1]; | ||||
| const float distance_sq_cu = dist_squared_to_line_segment_v3(brush_cu, pos1_cu, pos2_cu); | const float distance_sq_cu = dist_squared_to_line_segment_v3(brush_cu, pos1_cu, pos2_cu); | ||||
| if (distance_sq_cu > brush_radius_sq_cu) { | if (distance_sq_cu > brush_radius_sq_cu) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| curves_to_delete[curve_i] = true; | curves_to_delete[curve_i] = true; | ||||
| break; | |||||
JacquesLucke: Why is this removed? | |||||
HooglyBooglyAuthorUnsubmitted Done Inline ActionsErr, not sure, thanks for catching that. HooglyBoogly: Err, not sure, thanks for catching that. | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| void initialize_spherical_brush_reference_point() | void initialize_spherical_brush_reference_point() | ||||
| { | { | ||||
| std::optional<CurvesBrush3D> brush_3d = sample_curves_3d_brush( | std::optional<CurvesBrush3D> brush_3d = sample_curves_3d_brush( | ||||
| Show All 20 Lines | |||||
Why is this removed?