From 350366b25f0cd124e8677687d610bd974a226a4d Mon Sep 17 00:00:00 2001 From: YimingWu Date: Thu, 25 May 2023 12:23:05 +0800 Subject: [PATCH] Fix #108229: Wider tolerance shuffling NLA strips In `transdata_get_time_shuffle_offset_side`, the tolerance for terminating the loop is too tight, sometimes it will lead to a infinite loop due to non-integral start/end values. Now fixed. --- source/blender/editors/transform/transform_convert_nla.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index c7ba989f37b..51cc3f6f8a6 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -117,7 +117,9 @@ static float transdata_get_time_shuffle_offset_side(ListBase *trans_datas, const } total_offset += offset; - } while (!IS_EQF(offset, 0.0f)); + } while (!IS_EQT(offset, 0.0f, 1e-4)); + /* Needs a eps greater than FLT_EPS because strip->start/end could be non-integral, and after + * those calculations, `offset` could fall outside of FLT_EPS. */ return total_offset; } -- 2.30.2