diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-04-05 18:17:03 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-04-21 11:36:06 +0300 |
commit | 2e3edb6995d31c762382aa0ad6781807bac30377 (patch) | |
tree | 5d55ce3d5865233dd4b4cf30326c0247306bd58e | |
parent | 298e9c7ebd3b7f67042a4782487e0c9a51f3c975 (diff) |
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
-rw-r--r-- | source/blender/blenkernel/intern/object.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index cc68337e570..bafdbb6bb7e 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -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; |