Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-12-08 19:57:16 +0300
committerBastien Montagne <bastien@blender.org>2021-01-11 19:59:21 +0300
commit2a8b987e9e4dacd788ce955966d28c04ed91caf3 (patch)
tree3d55baaab4acbb89753228eb92836a108a7c13d2 /source/blender/blenkernel/intern/object_update.c
parente44e0e4e78bed21846c4c2455f81d678f61d212e (diff)
Fix T83422: Dimensions incorrect after undoing if it has modified geometry.
Root of the issue is that `BKE_object_eval_boundbox` (that ports back evaluated bbox to orig object during active depsgraph evaluation) is only called when object's geometry actually is evaluated. However, with new undo, often Object itself can be changed by undo, without requiring its geometry to be re-evaluated, which was leading to the evaluated bbox not being copied back into orig object anymore. Fixing that by moving bbox copying-to-orig code into `BKE_object_sync_to_original` instead, which is always executed when object is evaluated (as hinted by the comment above `BKE_object_eval_boundbox` actually). Also allows to cleanup code for armature eval, apparently. Maniphest Tasks: T83422 Differential Revision: https://developer.blender.org/D9789
Diffstat (limited to 'source/blender/blenkernel/intern/object_update.c')
-rw-r--r--source/blender/blenkernel/intern/object_update.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 1b4dc98252a..1d79f871fa2 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -268,25 +268,17 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
}
}
}
- BKE_object_eval_boundbox(depsgraph, ob);
}
-/**
- * TODO(sergey): Ensure that bounding box is already calculated, and move this
- * into #BKE_object_sync_to_original().
- */
-void BKE_object_eval_boundbox(Depsgraph *depsgraph, Object *object)
+/** Bounding box from evaluated geometry. */
+static void object_sync_boundbox_to_original(Object *object_orig, Object *object_eval)
{
- if (!DEG_is_active(depsgraph)) {
- return;
- }
- Object *ob_orig = DEG_get_original_object(object);
- BoundBox *bb = BKE_object_boundbox_get(object);
+ BoundBox *bb = BKE_object_boundbox_get(object_eval);
if (bb != NULL) {
- if (ob_orig->runtime.bb == NULL) {
- ob_orig->runtime.bb = MEM_mallocN(sizeof(*ob_orig->runtime.bb), __func__);
+ if (object_orig->runtime.bb == NULL) {
+ object_orig->runtime.bb = MEM_mallocN(sizeof(*object_orig->runtime.bb), __func__);
}
- *ob_orig->runtime.bb = *bb;
+ *object_orig->runtime.bb = *bb;
}
}
@@ -315,6 +307,8 @@ void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object)
md_orig->error = BLI_strdup(md->error);
}
}
+
+ object_sync_boundbox_to_original(object_orig, object);
}
bool BKE_object_eval_proxy_copy(Depsgraph *depsgraph, Object *object)