diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-18 03:57:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-18 03:59:29 +0300 |
commit | 4fceaf3848b6ff926a8f0ffdb8f5a7b1537da57b (patch) | |
tree | 7d748666d5577961b7009e5306408b0faf539e00 /source/blender/editors/space_view3d/view3d_gizmo_empty.c | |
parent | 7aeb24e037112c6b8a20d658c3f5c33b1e51e821 (diff) |
Fix gizmos showing for non-visible objects
Active object gizmos were showing even when the object wasn't visible
(local view or with their object type disabled).
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_empty.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_empty.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c index df1ae8c82e9..695ffc1d7ef 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c @@ -118,11 +118,14 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN return false; } - Object *ob = CTX_data_active_object(C); - - if (ob && ob->type == OB_EMPTY) { - if (ob->empty_drawtype == OB_EMPTY_IMAGE) { - return BKE_object_empty_image_is_visible_in_view3d(ob, rv3d); + ViewLayer *view_layer = CTX_data_view_layer(C); + Base *base = BASACT(view_layer); + if (BASE_VISIBLE(v3d, base)) { + Object *ob = base->object; + if (ob->type == OB_EMPTY) { + if (ob->empty_drawtype == OB_EMPTY_IMAGE) { + return BKE_object_empty_image_is_visible_in_view3d(ob, rv3d); + } } } return false; @@ -147,8 +150,9 @@ static void WIDGETGROUP_empty_image_setup(const bContext *UNUSED(C), wmGizmoGrou static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmGizmoGroup *gzgroup) { struct EmptyImageWidgetGroup *igzgroup = gzgroup->customdata; - Object *ob = CTX_data_active_object(C); wmGizmo *gz = igzgroup->gizmo; + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); copy_m4_m4(gz->matrix_basis, ob->obmat); |