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.
This commit is contained in:
Hans Goudey 2023-12-10 15:07:19 -05:00
parent ae70d25959
commit 4eee57fc3b
3 changed files with 3 additions and 3 deletions

@ -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<float3>> 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];

@ -366,7 +366,7 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
const Bounds<float3> 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) {

@ -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<float3>> 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];