From 752c6d668bcb9a6b357734f7e124a6b605ac9d9b Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Wed, 24 Nov 2021 14:32:19 -0300 Subject: Fix T90808: wrong BoundBox after undo curve selection There are two functions that recalculate the boundbox of an object: - One that considers the evaluated geometry - Another that only considers the object's `data`. Most of the time, the bound box is calculated on the final object (with modifiers), so it doesn't seem right to just rely on `ob->data` to recalculate the `ob->runtime.bb`. Be sure to calculate the BoundBox based on the final geometry and only use `ob->data` as a fallback Differential Revision: https://developer.blender.org/D12282 --- source/blender/blenkernel/intern/object_update.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/object_update.c') diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 7e15ac5de5d..34a899b2e91 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -282,7 +282,12 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o /** Bounding box from evaluated geometry. */ static void object_sync_boundbox_to_original(Object *object_orig, Object *object_eval) { - BoundBox *bb = BKE_object_boundbox_get(object_eval); + BoundBox *bb = object_eval->runtime.bb; + if (!bb || (bb->flag & BOUNDBOX_DIRTY)) { + BKE_object_boundbox_calc_from_evaluated_geometry(object_eval); + } + + bb = BKE_object_boundbox_get(object_eval); if (bb != NULL) { if (object_orig->runtime.bb == NULL) { object_orig->runtime.bb = MEM_mallocN(sizeof(*object_orig->runtime.bb), __func__); -- cgit v1.2.3