Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-12-17 06:49:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-17 06:49:16 +0300
commit21c1c3c59c2309512293619cc58f9fe5a1edef2e (patch)
tree9c82e77882597a1be457a4c0dedaedddd9ad9704 /source/blender/blenkernel/intern/object.c
parent365ef098155fddbdcf0beac60c171bd9e486c747 (diff)
3D View: empty image option to show front/back
Only back was possible.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 56843899ff6..498658765b6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2672,9 +2672,18 @@ 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) != 0) {
- if (dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]) < 0.0f) {
- return false;
+ if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
+ /* TODO: this isn't correct with perspective projection. */
+ const float dot = dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]);
+ if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) {
+ if (dot < 0.0f) {
+ return false;
+ }
+ }
+ if (visibility_flag & OB_EMPTY_IMAGE_HIDE_FRONT) {
+ if (dot > 0.0f) {
+ return false;
+ }
}
}