Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc')
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc b/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
index b40aebcaaf1..cc5a5e7ae8a 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
@@ -66,7 +66,7 @@ struct SelectionPaintOperationExecutor {
float2 brush_pos_re_;
- CurvesSculptTransforms transforms_;
+ CurvesSurfaceTransforms transforms_;
SelectionPaintOperationExecutor(const bContext &C) : ctx_(C)
{
@@ -104,7 +104,7 @@ struct SelectionPaintOperationExecutor {
}
}
- transforms_ = CurvesSculptTransforms(*object_, curves_id_->surface);
+ transforms_ = CurvesSurfaceTransforms(*object_, curves_id_->surface);
const eBrushFalloffShape falloff_shape = static_cast<eBrushFalloffShape>(
brush_->falloff_shape);
@@ -140,6 +140,7 @@ struct SelectionPaintOperationExecutor {
* selection is handled as a generic attribute for now. */
DEG_id_tag_update(&curves_id_->id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, &curves_id_->id);
+ ctx_.rv3d->rflag &= ~RV3D_PAINTING;
ED_region_tag_redraw(ctx_.region);
}
@@ -160,14 +161,15 @@ struct SelectionPaintOperationExecutor {
float4x4 projection;
ED_view3d_ob_project_mat_get(ctx_.rv3d, object_, projection.values);
- Span<float3> positions_cu = curves_->positions();
+ const bke::crazyspace::GeometryDeformation deformation =
+ bke::crazyspace::get_evaluated_curves_deformation(*ctx_.depsgraph, *object_);
const float brush_radius_re = brush_radius_base_re_ * brush_radius_factor_;
const float brush_radius_sq_re = pow2f(brush_radius_re);
threading::parallel_for(curves_->points_range(), 1024, [&](const IndexRange point_range) {
for (const int point_i : point_range) {
- const float3 pos_cu = brush_transform_inv * positions_cu[point_i];
+ const float3 pos_cu = brush_transform_inv * deformation.positions[point_i];
/* Find the position of the point in screen space. */
float2 pos_re;
@@ -214,14 +216,15 @@ struct SelectionPaintOperationExecutor {
void paint_point_selection_spherical(MutableSpan<float> selection, const float3 &brush_cu)
{
- Span<float3> positions_cu = curves_->positions();
+ const bke::crazyspace::GeometryDeformation deformation =
+ bke::crazyspace::get_evaluated_curves_deformation(*ctx_.depsgraph, *object_);
const float brush_radius_cu = self_->brush_3d_.radius_cu;
const float brush_radius_sq_cu = pow2f(brush_radius_cu);
threading::parallel_for(curves_->points_range(), 1024, [&](const IndexRange point_range) {
for (const int i : point_range) {
- const float3 pos_old_cu = positions_cu[i];
+ const float3 pos_old_cu = deformation.positions[i];
/* Compute distance to the brush. */
const float distance_to_brush_sq_cu = math::distance_squared(pos_old_cu, brush_cu);
@@ -255,9 +258,11 @@ struct SelectionPaintOperationExecutor {
void paint_curve_selection_projected(const float4x4 &brush_transform,
MutableSpan<float> selection)
{
- const Span<float3> positions_cu = curves_->positions();
const float4x4 brush_transform_inv = brush_transform.inverted();
+ const bke::crazyspace::GeometryDeformation deformation =
+ bke::crazyspace::get_evaluated_curves_deformation(*ctx_.depsgraph, *object_);
+
float4x4 projection;
ED_view3d_ob_project_mat_get(ctx_.rv3d, object_, projection.values);
@@ -273,8 +278,8 @@ struct SelectionPaintOperationExecutor {
[&](const IndexRange segment_range, const float init) {
float max_weight = init;
for (const int segment_i : segment_range) {
- 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 pos1_cu = brush_transform_inv * deformation.positions[segment_i];
+ const float3 pos2_cu = brush_transform_inv * deformation.positions[segment_i + 1];
float2 pos1_re;
float2 pos2_re;
@@ -322,7 +327,8 @@ struct SelectionPaintOperationExecutor {
void paint_curve_selection_spherical(MutableSpan<float> selection, const float3 &brush_cu)
{
- const Span<float3> positions_cu = curves_->positions();
+ const bke::crazyspace::GeometryDeformation deformation =
+ bke::crazyspace::get_evaluated_curves_deformation(*ctx_.depsgraph, *object_);
const float brush_radius_cu = self_->brush_3d_.radius_cu;
const float brush_radius_sq_cu = pow2f(brush_radius_cu);
@@ -336,8 +342,8 @@ struct SelectionPaintOperationExecutor {
[&](const IndexRange segment_range, const float init) {
float max_weight = init;
for (const int segment_i : segment_range) {
- const float3 &pos1_cu = positions_cu[segment_i];
- const float3 &pos2_cu = positions_cu[segment_i + 1];
+ const float3 &pos1_cu = deformation.positions[segment_i];
+ const float3 &pos2_cu = deformation.positions[segment_i + 1];
const float distance_sq_cu = dist_squared_to_line_segment_v3(
brush_cu, pos1_cu, pos2_cu);