Fix: Use correct datatype in MSC modify_geometry_set for the frame time

The recently added `modify_geometry_set` code path [1] inside the Mesh
Sequence Cache was meant to follow what was done inside `modify_mesh`
but failed to use the correct data type for the time offset. Double is
used throughout Blender when dealing with the frame time and this was
simply missed.

This results in rounding errors and downstream consumers like USD would
re-read the wrong frames. e.g. it would read frame 4 twice because the
values provided when switching from frame 4 to frame 5 were
`4.000000119209290` and `4.999999880790710` instead of
`4.000000000000000` and `5.000000000000000` with this patch.

[1] ea256346a8

Pull Request: https://projects.blender.org/blender/blender/pulls/120790
This commit is contained in:
Jesse Yurkovich
2024-04-18 20:55:13 +02:00
committed by Jesse Yurkovich
parent f3c677887d
commit 3f8ec963e3

View File

@@ -173,7 +173,7 @@ static void modify_geometry_set(ModifierData *md,
Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
CacheFile *cache_file = mcmd->cache_file;
const float frame = DEG_get_ctime(ctx->depsgraph);
const float time = BKE_cachefile_time_offset(cache_file, frame, FPS);
const double time = BKE_cachefile_time_offset(cache_file, frame, FPS);
const char *err_str = nullptr;
if (!mcmd->reader || !STREQ(mcmd->reader_object_path, mcmd->object_path)) {