diff --git a/source/blender/blenkernel/BKE_fcurve.hh b/source/blender/blenkernel/BKE_fcurve.hh index cce319b59bc..220ed984c2d 100644 --- a/source/blender/blenkernel/BKE_fcurve.hh +++ b/source/blender/blenkernel/BKE_fcurve.hh @@ -478,10 +478,15 @@ bool BKE_fcurve_bezt_subdivide_handles(BezTriple *bezt, /** * Resize the FCurve 'bezt' array to fit the given length. * + * This potentially moves the entire array, and thus pointers from before this call should be + * considered invalid / dangling. + * * \param new_totvert: new number of elements in the FCurve's `bezt` array. - * Constraint: `0 <= new_totvert <= fcu->totvert` + * + * \note When increasing the size of the array, newly added elements are not initialized. That is + * left to the caller. */ -void BKE_fcurve_bezt_shrink(FCurve *fcu, int new_totvert); +void BKE_fcurve_bezt_resize(FCurve *fcu, int new_totvert); /** * Merge the two given BezTriple arrays `a` and `b` into a newly allocated BezTriple array of size diff --git a/source/blender/blenkernel/intern/fcurve.cc b/source/blender/blenkernel/intern/fcurve.cc index 366fa78f89b..0d9ee282c0c 100644 --- a/source/blender/blenkernel/intern/fcurve.cc +++ b/source/blender/blenkernel/intern/fcurve.cc @@ -1607,10 +1607,9 @@ bool BKE_fcurve_bezt_subdivide_handles(BezTriple *bezt, return true; } -void BKE_fcurve_bezt_shrink(FCurve *fcu, const int new_totvert) +void BKE_fcurve_bezt_resize(FCurve *fcu, const int new_totvert) { BLI_assert(new_totvert >= 0); - BLI_assert(new_totvert <= fcu->totvert); /* No early return when new_totvert == fcu->totvert. There is no way to know the intention of the * caller, nor the history of the FCurve so far, so `fcu->bezt` may actually have allocated space @@ -1939,7 +1938,7 @@ void BKE_fcurve_deduplicate_keys(FCurve *fcu) } } - BKE_fcurve_bezt_shrink(fcu, prev_bezt_index + 1); + BKE_fcurve_bezt_resize(fcu, prev_bezt_index + 1); } /** \} */