From c427590c4eb60a7187d9f340066ff837f9179cd5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 12 Mar 2019 18:24:33 +0100 Subject: Fix T62388: object.visible_get() not affected by object.hide_viewport. After recent changes BASE_VISIBLE was not always disabled properly when the object is hidden. This refactors the code a bit to hopefully be more clear. --- source/blender/blenkernel/intern/object_update.c | 25 ++++++++---------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'source/blender/blenkernel/intern/object_update.c') diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 304c9985f10..5558443afb8 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -425,27 +425,18 @@ void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph, DEG_debug_print_eval(depsgraph, __func__, object->id.name, object); - /* Visibility based on depsgraph mode. */ - const eEvaluationMode mode = DEG_get_mode(depsgraph); - const int base_enabled_flag = (mode == DAG_EVAL_VIEWPORT) - ? BASE_ENABLED_VIEWPORT - : BASE_ENABLED_RENDER; - + /* Set base flags based on collection and object restriction. */ BKE_base_eval_flags(base); - /* Compute visibility for depsgraph evaluation mode. */ - if (base->flag & base_enabled_flag) { - /* When rendering, visibility is controlled by the enable/disable option. */ - if (mode == DAG_EVAL_RENDER) { + /* For render, compute base visibility again since BKE_base_eval_flags + * assumed viewport visibility. Selectability does not matter here. */ + if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) { + if (base->flag & BASE_ENABLED_RENDER) { base->flag |= BASE_VISIBLE; } - } - else { - base->flag &= ~(BASE_VISIBLE | BASE_SELECTABLE); - } - /* If base is not selectable, clear select. */ - if ((base->flag & BASE_SELECTABLE) == 0) { - base->flag &= ~BASE_SELECTED; + else { + base->flag &= ~BASE_VISIBLE; + } } /* Copy flags and settings from base. */ -- cgit v1.2.3