Commit: 6aeafacf8611af27de9dae122bc31aa4a7d613aa Author: Antonio Vazquez Date: Mon Sep 14 15:26:17 2020 +0200 Branches: master https://developer.blender.org/rB6aeafacf8611af27de9dae122bc31aa4a7d613aa
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. =================================================================== M source/blender/blenkernel/intern/gpencil_geom.c =================================================================== 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; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs