diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-31 15:35:53 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-31 15:42:33 +0300 |
commit | a3802f66e22e57115f48545a39bf41959eb16fad (patch) | |
tree | 9389d31f0f104d00b2a10b86f4afe6cfbdd84eeb /source/blender/editors/space_view3d | |
parent | 0727abf1bc70a55426716f5826532ea3ec4dd924 (diff) |
Image Empties: More visibility settings
Support for showing images in background/foreground and only in perspective/orthographic view.
Internally the depth of the image is modified in the fragment shader by setting `gl_FragDepth` explicitly.
The UI still needs some work to improve usability, see D3863 for details.
Currently there is one duplicated function, not sure how to best deduplicate it yet. (`is_image_empty_visible`)
Reviewer: fclem, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D3863
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_empty.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c index fe1129f8028..bc190355ea6 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c @@ -107,9 +107,21 @@ static void gizmo_empty_image_prop_matrix_set( ob->ima_ofs[1] = (matrix[3][1] - (0.5f * dims[1])) / dims[1]; } +static bool is_image_empty_visible(Object *ob, RegionView3D *rv3d) +{ + int visibility_flag = ob->empty_image_visibility_flag; + if (rv3d->is_persp) { + return visibility_flag & OB_EMPTY_IMAGE_VISIBLE_PERSPECTIVE; + } + else { + return visibility_flag & OB_EMPTY_IMAGE_VISIBLE_ORTHOGRAPHIC; + } +} + static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt)) { View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) @@ -120,7 +132,9 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN Object *ob = CTX_data_active_object(C); if (ob && ob->type == OB_EMPTY) { - return (ob->empty_drawtype == OB_EMPTY_IMAGE); + if (ob->empty_drawtype == OB_EMPTY_IMAGE){ + return is_image_empty_visible(ob, rv3d); + } } return false; } |