[Bf-blender-cvs] [8414e79b71e] temp-pbvh-split: Fix: Crash with empty curves add interpolate points
Hans Goudey
noreply at git.blender.org
Fri Jun 3 01:16:31 CEST 2022
Commit: 8414e79b71efaa9735839ed7866692502cae031b
Author: Hans Goudey
Date: Wed May 11 15:40:19 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB8414e79b71efaa9735839ed7866692502cae031b
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