From 4eee57fc3b7eacd8aa1e86fd4bbdf515728100de Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sun, 10 Dec 2023 15:07:19 -0500 Subject: [PATCH] Fix #115979: Object bounds display type doubled size The "size" of a bounding box that used to be calculated by `BKE_boundbox_calc_size_aabb` was actually the dimensions divided by two. --- source/blender/draw/engines/gpencil/gpencil_cache_utils.cc | 2 +- source/blender/draw/engines/overlay/overlay_extra.cc | 2 +- source/blender/draw/engines/overlay/overlay_outline.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.cc b/source/blender/draw/engines/gpencil/gpencil_cache_utils.cc index 019c0f1fb8e..4fb0c19f84f 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.cc +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.cc @@ -68,7 +68,7 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob) * computationally heavy and should go into the GPData evaluation. */ const std::optional> bounds = BKE_gpencil_data_minmax(gpd).value_or( Bounds(float3(0))); - float3 size = bounds->max - bounds->min; + float3 size = (bounds->max - bounds->min) * 0.5f; float3 center = math::midpoint(bounds->min, bounds->max); /* Convert bbox to matrix */ float mat[4][4]; diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc b/source/blender/draw/engines/overlay/overlay_extra.cc index d067d71a708..28dc97323fd 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.cc +++ b/source/blender/draw/engines/overlay/overlay_extra.cc @@ -366,7 +366,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb, const Bounds bounds = BKE_object_boundbox_get(ob).value_or( Bounds(float3(-1.0f), float3(1.0f))); - float3 size = bounds.max - bounds.min; + float3 size = (bounds.max - bounds.min) * 0.5f; const float3 center = around_origin ? float3(0) : math::midpoint(bounds.min, bounds.max); switch (boundtype) { diff --git a/source/blender/draw/engines/overlay/overlay_outline.cc b/source/blender/draw/engines/overlay/overlay_outline.cc index 92b2588e017..5c78e19e832 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.cc +++ b/source/blender/draw/engines/overlay/overlay_outline.cc @@ -38,7 +38,7 @@ static void gpencil_depth_plane(Object *ob, float r_plane[4]) * computationally heavy and should go into the GPData evaluation. */ const std::optional> bounds = BKE_object_boundbox_get(ob).value_or( Bounds(float3(0))); - float3 size = bounds->max - bounds->min; + float3 size = (bounds->max - bounds->min) * 0.5f; float3 center = math::midpoint(bounds->min, bounds->max); /* Convert bbox to matrix */ float mat[4][4];