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-06 11:58:54 +0300
committerYimingWu <xp8110@outlook.com>2022-05-10 08:58:19 +0300
commit3e7d174da10bd256cda65ba5c3d383faf077a5ee (patch)
treefbcae48b9c038c3f64e06a05248e39f711106e3f
parent7c4dad47ff3d9334cf1f1106e5684a8dc30142f3 (diff)
Fix: Handle default better in curves type count cache
When the curve types array isn't allocated, the default type is Catmull Rom. Because the type counts are calculated eagerly, they must be in a valid state.
-rw-r--r--source/blender/blenkernel/intern/curves_geometry.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index e7337d5c012..4dd0fad57d4 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -65,6 +65,8 @@ CurvesGeometry::CurvesGeometry(const int point_size, const int curve_size)
this->update_customdata_pointers();
this->runtime = MEM_new<CurvesGeometryRuntime>(__func__);
+ /* Fill the type counts with the default so they're in a valid state. */
+ this->runtime->type_counts[CURVE_TYPE_CATMULL_ROM] = curve_size;
}
/**
@@ -541,7 +543,11 @@ IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type,
if (this->curve_type_counts()[type] == this->curves_num()) {
return selection;
}
- Span<int8_t> types_span = this->curve_types().get_internal_span();
+ const VArray<int8_t> types = this->curve_types();
+ if (types.is_single()) {
+ return types.get_internal_single() == type ? IndexMask(this->curves_num()) : IndexMask(0);
+ }
+ Span<int8_t> types_span = types.get_internal_span();
return index_mask_ops::find_indices_based_on_predicate(
selection, 1024, r_indices, [&](const int index) { return types_span[index] == type; });
}