[Bf-blender-cvs] [6599d2f03b2] master: Fix: Crash with empty curves add interpolate points
Hans Goudey
noreply at git.blender.org
Wed May 11 15:40:51 CEST 2022
Commit: 6599d2f03b2af9be752cf73a8fd59a6e7a535686
Author: Hans Goudey
Date: Wed May 11 15:40:19 2022 +0200
Branches: master
https://developer.blender.org/rB6599d2f03b2af9be752cf73a8fd59a6e7a535686
Fix: Crash with empty curves add interpolate points
The neighbors for an added curve can be empty.
In that case use the constant value instead of interpolating.
===================================================================
M source/blender/editors/sculpt_paint/curves_sculpt_add.cc
===================================================================
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index feda57fff1f..f214efb44be 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -608,9 +608,14 @@ struct AddOperationExecutor {
attribute_math::DefaultMixer<int> mixer{new_offsets};
threading::parallel_for(neighbors_per_curve.index_range(), 1024, [&](IndexRange curves_range) {
for (const int i : curves_range) {
- for (const NeighborInfo &neighbor : neighbors_per_curve[i]) {
- const int neighbor_points_num = curves_->points_for_curve(neighbor.index).size();
- mixer.mix_in(i, neighbor_points_num, neighbor.weight);
+ if (neighbors_per_curve[i].is_empty()) {
+ mixer.mix_in(i, constant_points_per_curve_, 1.0f);
+ }
+ else {
+ for (const NeighborInfo &neighbor : neighbors_per_curve[i]) {
+ const int neighbor_points_num = curves_->points_for_curve(neighbor.index).size();
+ mixer.mix_in(i, neighbor_points_num, neighbor.weight);
+ }
}
}
});
More information about the Bf-blender-cvs
mailing list