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:
authorHans Goudey <h.goudey@me.com>2022-05-11 16:40:19 +0300
committerHans Goudey <h.goudey@me.com>2022-05-11 16:40:49 +0300
commit6599d2f03b2af9be752cf73a8fd59a6e7a535686 (patch)
tree9bfcfcc574634eb6f1a7c19f1630761d31789c00
parente354ba701a0090abf131f25f49565660d8a70d0b (diff)
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.
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_add.cc11
1 files changed, 8 insertions, 3 deletions
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);
+ }
}
}
});