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:
authorAntonio Vazquez <blendergit@gmail.com>2020-09-14 16:26:17 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-09-14 16:26:29 +0300
commit6aeafacf8611af27de9dae122bc31aa4a7d613aa (patch)
tree81faf2389236a93b83daaff0d8bcdceb3131b710 /source/blender/blenkernel/intern/gpencil_geom.c
parentec6d32b238da507c258a4b571e332c5cb67a6b18 (diff)
Fix T79651: Bounding box is wrong after duplicate object
The bounding box is not updated in the original object when the function is called using evaluated object and keeps wrong while the object is not edited or the file saved. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D8565 Notes: Minor changes done in the patch following review comments.
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil_geom.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index a9b0eede055..66a7ae757a2 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -185,6 +185,19 @@ BoundBox *BKE_gpencil_boundbox_get(Object *ob)
boundbox_gpencil(ob);
+ Object *ob_orig = (Object *)DEG_get_original_id(&ob->id);
+ /* Update orig object's boundbox with re-computed evaluated values. This function can be
+ * called with the evaluated object and need update the original object bound box data
+ * to keep both values synchronized. */
+ if ((ob_orig != NULL) && (ob != ob_orig)) {
+ if (ob_orig->runtime.bb == NULL) {
+ ob_orig->runtime.bb = MEM_callocN(sizeof(BoundBox), "GPencil boundbox");
+ }
+ for (int i = 0; i < 8; i++) {
+ copy_v3_v3(ob_orig->runtime.bb->vec[i], ob->runtime.bb->vec[i]);
+ }
+ }
+
return ob->runtime.bb;
}