Fix Empty "Only Axis Aligned" viewing angle depends on object scale

This was projecting the unnormalized z scale axis onto the plane defined
by the view vector. If object scale was very small, this made the empty
still visible at viewing angles far from the object axis.

Now use the normalized z scale axis to make this work the same at all
object scales.

Fixes T97004.

Maniphest Tasks: T97004

Differential Revision: https://developer.blender.org/D14557
This commit is contained in:
Philipp Oeser 2022-04-05 17:17:03 +02:00
parent 298e9c7ebd
commit 2e3edb6995
Notes: blender-bot 2023-02-14 02:27:56 +01:00
Referenced by issue #97004, Empty "Only Axis Aligned" viewing angle depends on object scale, stops working on very small values
1 changed files with 3 additions and 2 deletions

View File

@ -3974,8 +3974,9 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re
}
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED) {
float3 proj;
project_plane_v3_v3v3(proj, ob->obmat[2], rv3d->viewinv[2]);
float3 proj, ob_z_axis;
normalize_v3_v3(ob_z_axis, ob->obmat[2]);
project_plane_v3_v3v3(proj, ob_z_axis, rv3d->viewinv[2]);
const float proj_length_sq = len_squared_v3(proj);
if (proj_length_sq > 1e-5f) {
return false;