Commit: 445433a6913fb95fe04bf69089710cab877a581b
Author: Campbell Barton
Date: Tue Feb 5 10:39:43 2019 +1100
Branches: master
https://developer.blender.org/rB445433a6913fb95fe04bf69089710cab877a581b
Fix empty object front/back display in perspective views
===================================================================
M source/blender/blenkernel/intern/object.c
===================================================================
diff --git a/source/blender/blenkernel/intern/object.c
b/source/blender/blenkernel/intern/object.c
index d8bc27fa596..5cb68a7e5bb 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2608,9 +2608,20 @@ bool BKE_object_empty_image_is_visible_in_view3d(const
Object *ob, const RegionV
char visibility_flag = ob->empty_image_visibility_flag;
if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK |
OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
- const float eps = 1e-5f;
- /* TODO: this isn't correct with perspective projection. */
- const float dot = dot_v3v3((float *)&ob->obmat[2], (float
*)&rv3d->viewinv[2]);
+ float eps, dot;
+ if (rv3d->is_persp) {
+ /* Note, we could normalize the 'view_dir' then use
'eps'
+ * however the issue with empty objects being visible
when viewed from the side
+ * is only noticeable in orthographic views. */
+ float view_dir[3];
+ sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->obmat[3]);
+ dot = dot_v3v3(ob->obmat[2], view_dir);
+ eps = 0.0f;
+ }
+ else {
+ dot = dot_v3v3(ob->obmat[2], rv3d->viewinv[2]);
+ eps = 1e-5f;
+ }
if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) {
if (dot < eps) {
return false;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs