From 1a9db9992a7e2e63524bb9d92467610ce2b9d4c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 31 May 2024 11:51:36 +0200 Subject: [PATCH] Fix #122451: Crash on animated viewport visibility + animated mesh positions Move the bounding box synchronization to the geometry evaluation component. This way it is ensured that it is only done when the geometry is actually evaluated, solving the problem of accessing stale data when object level flags are modified. Pull Request: https://projects.blender.org/blender/blender/pulls/122509 --- source/blender/blenkernel/intern/object_update.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/object_update.cc b/source/blender/blenkernel/intern/object_update.cc index 0a0b3229553..4f9851b3219 100644 --- a/source/blender/blenkernel/intern/object_update.cc +++ b/source/blender/blenkernel/intern/object_update.cc @@ -228,6 +228,11 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o } } } + + if (DEG_is_active(depsgraph)) { + Object *object_orig = DEG_get_original_object(ob); + object_orig->runtime->bounds_eval = BKE_object_evaluated_geometry_bounds(ob); + } } void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object) @@ -257,8 +262,6 @@ void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object) md_orig->error = BLI_strdup(md->error); } } - - object_orig->runtime->bounds_eval = BKE_object_evaluated_geometry_bounds(object); } void BKE_object_eval_uber_transform(Depsgraph * /*depsgraph*/, Object * /*object*/) {}