diff options
Diffstat (limited to 'source/blender')
21 files changed, 95 insertions, 55 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 49dc87629d6..8bc89c56450 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -245,8 +245,8 @@ void BKE_layer_collection_set_flag(struct LayerCollection *lc, int flag, bool va /** * Applies object's restrict flags on top of flags coming from the collection - * and stores those in `base->flag`. #BASE_VISIBLE_DEPSGRAPH ignores viewport flags visibility - * (i.e., restriction and local collection). + * and stores those in `base->flag`. #BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT ignores viewport + * flags visibility (i.e., restriction and local collection). */ void BKE_base_eval_flags(struct Base *base); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 53a9b6d469d..2b49da6dbe9 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -56,7 +56,8 @@ static CLG_LogRef LOG = {"bke.layercollection"}; /* Set of flags which are dependent on a collection settings. */ -static const short g_base_collection_flags = (BASE_VISIBLE_DEPSGRAPH | BASE_VISIBLE_VIEWLAYER | +static const short g_base_collection_flags = (BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | + BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT | BASE_SELECTABLE | BASE_ENABLED_VIEWPORT | BASE_ENABLED_RENDER | BASE_HOLDOUT | BASE_INDIRECT_ONLY); @@ -998,9 +999,10 @@ static void layer_collection_objects_sync(ViewLayer *view_layer, } if ((collection_restrict & COLLECTION_HIDE_VIEWPORT) == 0) { - base->flag_from_collection |= (BASE_ENABLED_VIEWPORT | BASE_VISIBLE_DEPSGRAPH); + base->flag_from_collection |= (BASE_ENABLED_VIEWPORT | + BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT); if ((layer_restrict & LAYER_COLLECTION_HIDE) == 0) { - base->flag_from_collection |= BASE_VISIBLE_VIEWLAYER; + base->flag_from_collection |= BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT; } if (((collection_restrict & COLLECTION_HIDE_SELECT) == 0)) { base->flag_from_collection |= BASE_SELECTABLE; @@ -1452,7 +1454,8 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle LISTBASE_FOREACH (CollectionObject *, cob, &lc->collection->gobject) { Base *base = BKE_view_layer_base_find(view_layer, cob->ob); - if (base && (base->flag & BASE_SELECTED) && (base->flag & BASE_VISIBLE_DEPSGRAPH)) { + if (base && (base->flag & BASE_SELECTED) && + (base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT)) { return true; } } @@ -1508,12 +1511,12 @@ void BKE_base_set_visible(Scene *scene, ViewLayer *view_layer, Base *base, bool bool BKE_base_is_visible(const View3D *v3d, const Base *base) { - if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) { + if ((base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) == 0) { return false; } if (v3d == NULL) { - return base->flag & BASE_VISIBLE_VIEWLAYER; + return base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT; } if ((v3d->localvd) && ((v3d->local_view_uuid & base->local_view_bits) == 0)) { @@ -1528,7 +1531,7 @@ bool BKE_base_is_visible(const View3D *v3d, const Base *base) return (v3d->local_collections_uuid & base->local_collections_bits) != 0; } - return base->flag & BASE_VISIBLE_VIEWLAYER; + return base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT; } bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object *ob) @@ -1554,7 +1557,7 @@ bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object *o /* If not using local collection the object may still be in a hidden collection. */ if ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0) { - return (ob->base_flag & BASE_VISIBLE_VIEWLAYER) != 0; + return (ob->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) != 0; } return true; @@ -2011,12 +2014,13 @@ static void objects_iterator_end(BLI_Iterator *iter) void BKE_view_layer_selected_objects_iterator_begin(BLI_Iterator *iter, void *data_in) { - objects_iterator_begin(iter, data_in, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + objects_iterator_begin( + iter, data_in, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); } void BKE_view_layer_selected_objects_iterator_next(BLI_Iterator *iter) { - objects_iterator_next(iter, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + objects_iterator_next(iter, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); } void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter) @@ -2053,7 +2057,8 @@ void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *iter) void BKE_view_layer_selected_editable_objects_iterator_begin(BLI_Iterator *iter, void *data_in) { - objects_iterator_begin(iter, data_in, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + objects_iterator_begin( + iter, data_in, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); if (iter->valid) { if (BKE_object_is_libdata((Object *)iter->current) == false) { /* First object is valid (selectable and not libdata) -> all good. */ @@ -2070,7 +2075,7 @@ void BKE_view_layer_selected_editable_objects_iterator_next(BLI_Iterator *iter) /* Search while there are objects and the one we have is not editable (editable = not libdata). */ do { - objects_iterator_next(iter, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + objects_iterator_next(iter, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); } while (iter->valid && BKE_object_is_libdata((Object *)iter->current) != false); } @@ -2087,12 +2092,13 @@ void BKE_view_layer_selected_editable_objects_iterator_end(BLI_Iterator *iter) void BKE_view_layer_selected_bases_iterator_begin(BLI_Iterator *iter, void *data_in) { - objects_iterator_begin(iter, data_in, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + objects_iterator_begin( + iter, data_in, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); } void BKE_view_layer_selected_bases_iterator_next(BLI_Iterator *iter) { - object_bases_iterator_next(iter, BASE_VISIBLE_DEPSGRAPH | BASE_SELECTED); + object_bases_iterator_next(iter, BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_SELECTED); } void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter) @@ -2219,7 +2225,8 @@ void BKE_base_eval_flags(Base *base) * can change these again, but for tools we always want the viewport * visibility to be in sync regardless if depsgraph was evaluated. */ if (!(base->flag & BASE_ENABLED_VIEWPORT) || (base->flag & BASE_HIDDEN)) { - base->flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_VISIBLE_VIEWLAYER | BASE_SELECTABLE); + base->flag &= ~(BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | + BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT | BASE_SELECTABLE); } /* Deselect unselectable objects. */ diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 4c3b32b6ae0..94bbd8f506a 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -2040,7 +2040,7 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode) int BKE_object_visibility(const Object *ob, const int dag_eval_mode) { - if ((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) == 0) { + if ((ob->base_flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) == 0) { return 0; } diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 5656a9f6c92..91170060fee 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -407,10 +407,10 @@ void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph, * assumed viewport visibility. Select-ability does not matter here. */ if (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER) { if (base->flag & BASE_ENABLED_RENDER) { - base->flag |= BASE_VISIBLE_DEPSGRAPH; + base->flag |= BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT; } else { - base->flag &= ~BASE_VISIBLE_DEPSGRAPH; + base->flag &= ~BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT; } } diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 2d2ee5dc4b4..bcae5de1e1e 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -182,7 +182,7 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) } /* Duplicated elements shouldn't care whether their original collection is visible or not. */ - temp_dupli_object->base_flag |= BASE_VISIBLE_DEPSGRAPH; + temp_dupli_object->base_flag |= BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT; int ob_visibility = BKE_object_visibility(temp_dupli_object, data->eval_mode); if ((ob_visibility & (OB_VISIBLE_SELF | OB_VISIBLE_PARTICLES)) == 0) { diff --git a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc index e35e992fc8b..515c9a197d7 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_visibility.cc @@ -36,8 +36,7 @@ void deg_evaluate_object_node_visibility(::Depsgraph *depsgraph, IDNode *id_node bool is_enabled; if (graph->mode == DAG_EVAL_VIEWPORT) { - is_enabled = (object->base_flag & BASE_ENABLED_VIEWPORT) && - ((object->base_flag & BASE_HIDDEN) == 0); + is_enabled = (object->base_flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT); } else { is_enabled = (object->base_flag & BASE_ENABLED_RENDER); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 6e05572a20b..8212b38e74d 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -181,7 +181,7 @@ static void drw_task_graph_deinit(void) bool DRW_object_is_renderable(const Object *ob) { - BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0); + BLI_assert((ob->base_flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) != 0); if (ob->type == OB_MESH) { if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) { @@ -2479,7 +2479,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, } if (use_pose_exception && (ob->mode & OB_MODE_POSE)) { - if ((ob->base_flag & BASE_VISIBLE_VIEWLAYER) == 0) { + if ((ob->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { continue; } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2442a5910a0..6dc11292a3a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1876,8 +1876,8 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) { /* Layer visibility - we check both object and base, * since these may not be in sync yet. */ - if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0 || - (base->flag & BASE_VISIBLE_VIEWLAYER) == 0) { + if ((base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) == 0 || + (base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { continue; } @@ -3089,7 +3089,8 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, */ if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) { /* layer visibility - we check both object and base, since these may not be in sync yet */ - if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0 || (base->flag & BASE_VISIBLE_VIEWLAYER) == 0) { + if ((base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) == 0 || + (base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { return false; } diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 1068da6816f..ddd54aa7953 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -3573,7 +3573,7 @@ static Base *object_add_duplicate_internal(Main *bmain, DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); base = BKE_view_layer_base_find(view_layer, ob); - if ((base != nullptr) && (base->flag & BASE_VISIBLE_DEPSGRAPH)) { + if ((base != nullptr) && (base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT)) { BKE_collection_object_add_from(bmain, scene, ob, obn); } else { diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 8db699cceb8..f7b66241081 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -1409,7 +1409,8 @@ static int bake(const BakeAPIRender *bkr, else { ob_cage_eval = DEG_get_evaluated_object(depsgraph, ob_cage); ob_cage_eval->visibility_flag |= OB_HIDE_RENDER; - ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); + ob_cage_eval->base_flag &= ~(BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | + BASE_ENABLED_RENDER); } } } @@ -1509,7 +1510,8 @@ static int bake(const BakeAPIRender *bkr, highpoly[i].ob = ob_iter; highpoly[i].ob_eval = DEG_get_evaluated_object(depsgraph, ob_iter); highpoly[i].ob_eval->visibility_flag &= ~OB_HIDE_RENDER; - highpoly[i].ob_eval->base_flag |= (BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); + highpoly[i].ob_eval->base_flag |= (BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | + BASE_ENABLED_RENDER); highpoly[i].me = BKE_mesh_new_from_object(NULL, highpoly[i].ob_eval, false, false); /* Low-poly to high-poly transformation matrix. */ @@ -1525,10 +1527,11 @@ static int bake(const BakeAPIRender *bkr, if (ob_cage != NULL) { ob_cage_eval->visibility_flag |= OB_HIDE_RENDER; - ob_cage_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); + ob_cage_eval->base_flag &= ~(BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | + BASE_ENABLED_RENDER); } ob_low_eval->visibility_flag |= OB_HIDE_RENDER; - ob_low_eval->base_flag &= ~(BASE_VISIBLE_DEPSGRAPH | BASE_ENABLED_RENDER); + ob_low_eval->base_flag &= ~(BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT | BASE_ENABLED_RENDER); /* populate the pixel arrays with the corresponding face data for each high poly object */ pixel_array_high = MEM_mallocN(sizeof(BakePixel) * targets.pixels_num, diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 1bfb0c5f260..cc16b58fa72 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -287,7 +287,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) /* Hide selected or unselected objects. */ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { - if (!(base->flag & BASE_VISIBLE_VIEWLAYER)) { + if (!(base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT)) { continue; } diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 82c39d38d74..2ce00490273 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -203,7 +203,7 @@ bool ED_object_base_deselect_all(ViewLayer *view_layer, View3D *v3d, int action) static int get_base_select_priority(Base *base) { - if (base->flag & BASE_VISIBLE_DEPSGRAPH) { + if (base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) { if (base->flag & BASE_SELECTABLE) { return 3; } diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc index 157c9bc7222..7583d329de1 100644 --- a/source/blender/editors/render/render_internal.cc +++ b/source/blender/editors/render/render_internal.cc @@ -856,7 +856,7 @@ static void screen_render_cancel(bContext *C, wmOperator *op) static void clean_viewport_memory_base(Base *base) { - if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) { + if ((base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) == 0) { return; } diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index 5e23458e8bb..7d1ac079d08 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -550,7 +550,7 @@ static Scene *preview_prepare_scene( } } else if (base->object->type == OB_LAMP) { - base->flag |= BASE_VISIBLE_DEPSGRAPH; + base->flag |= BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT; } } } diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index a796ed5a817..0169acc36b7 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -130,7 +130,7 @@ static void stats_object(Object *ob, SceneStats *stats, GSet *objects_gset) { - if ((ob->base_flag & BASE_VISIBLE_VIEWLAYER) == 0) { + if ((ob->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { return; } @@ -365,7 +365,7 @@ static void stats_update(Depsgraph *depsgraph, if (obedit) { /* Edit Mode. */ FOREACH_OBJECT_BEGIN (view_layer, ob_iter) { - if (ob_iter->base_flag & BASE_VISIBLE_VIEWLAYER) { + if (ob_iter->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) { if (ob_iter->mode & OB_MODE_EDIT) { stats_object_edit(ob_iter, stats); stats->totobjsel++; @@ -385,7 +385,7 @@ static void stats_update(Depsgraph *depsgraph, else if (ob && (ob->mode & OB_MODE_POSE)) { /* Pose Mode. */ FOREACH_OBJECT_BEGIN (view_layer, ob_iter) { - if (ob_iter->base_flag & BASE_VISIBLE_VIEWLAYER) { + if (ob_iter->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) { if (ob_iter->mode & OB_MODE_POSE) { stats_object_pose(ob_iter, stats); stats->totobjsel++; diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 3f99b19cd16..d8c94d8ee6c 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -3216,7 +3216,8 @@ static bool element_should_draw_faded(const TreeViewContext *tvc, const Base *base = (te->directdata) ? (const Base *)te->directdata : BKE_view_layer_base_find( (ViewLayer *)tvc->view_layer, (Object *)ob); - const bool is_visible = (base != nullptr) && (base->flag & BASE_VISIBLE_VIEWLAYER); + const bool is_visible = (base != nullptr) && + (base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT); if (!is_visible) { return true; } diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index 17e78ece941..071b244bd3d 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -191,7 +191,8 @@ void outliner_item_mode_toggle(bContext *C, Base *base = BKE_view_layer_base_find(tvc->view_layer, ob); /* Hidden objects can be removed from the mode. */ - if (!base || (!(base->flag & BASE_VISIBLE_DEPSGRAPH) && (ob->mode != tvc->obact->mode))) { + if (!base || (!(base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) && + (ob->mode != tvc->obact->mode))) { return; } @@ -239,7 +240,7 @@ static void do_outliner_object_select_recursive(ViewLayer *view_layer, { LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; - if ((((base->flag & BASE_VISIBLE_DEPSGRAPH) != 0) && + if ((((base->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) != 0) && BKE_object_is_child_recursive(ob_parent, ob))) { ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT); } diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index 070df284c6f..a8f469c135a 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -1459,7 +1459,7 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, bool is_visible = true; if (exclude_filter & SO_FILTER_OB_STATE_VISIBLE) { - if ((base->flag & BASE_VISIBLE_VIEWLAYER) == 0) { + if ((base->flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { is_visible = false; } } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 86c796e6be4..30acfdbf7d8 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1892,7 +1892,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes if (view_layer->basact) { Object *ob = view_layer->basact->object; /* if hidden but in edit mode, we still display, can happen with animation */ - if ((view_layer->basact->flag & BASE_VISIBLE_DEPSGRAPH) != 0 || + if ((view_layer->basact->flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) != 0 || (ob->mode != OB_MODE_OBJECT)) { CTX_data_id_pointer_set(result, &ob->id); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7ae1b86806a..efc8b4a8502 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2152,7 +2152,7 @@ static void validate_object_select_id(struct Depsgraph *depsgraph, return; } - if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) { + if (obact_eval && ((obact_eval->base_flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) != 0)) { Base *base = BKE_view_layer_base_find(view_layer, obact); DRW_select_buffer_context_create(&base, 1, -1); } diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 345fa141514..2176df7f4ec 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -198,16 +198,44 @@ enum { BASE_HIDDEN = (1 << 8), /* Object is hidden for editing. */ /* Runtime evaluated flags. */ - BASE_VISIBLE_DEPSGRAPH = (1 << 1), /* Object is enabled and visible for the depsgraph. */ - BASE_SELECTABLE = (1 << 2), /* Object can be selected. */ - BASE_FROM_DUPLI = (1 << 3), /* Object comes from duplicator. */ - BASE_VISIBLE_VIEWLAYER = (1 << 4), /* Object is enabled and visible for the viewlayer. */ - BASE_FROM_SET = (1 << 5), /* Object comes from set. */ - BASE_ENABLED_VIEWPORT = (1 << 6), /* Object is enabled in viewport. */ - BASE_ENABLED_RENDER = (1 << 7), /* Object is enabled in final render */ + + /* Object is enabled and potentially visible in a viewport. Layer collection + * visibility, local collection visibility, and local view are not part of this + * and may cause the object to be hidden depending on the 3D viewport settings. + * + * Objects with this flag will be considered visible by the viewport depsgraph + * and be evaluated as a result. + * + * This implies BASE_ENABLED_VIEWPORT. */ + BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT = (1 << 1), + + /* Object can be selected. */ + BASE_SELECTABLE = (1 << 2), + + /* Object comes from a duplicator. */ + BASE_FROM_DUPLI = (1 << 3), + + /* Object is enabled and visible in a viewport with default viewport settings, + * (so without any local view or local collection visibility overrides). Used + * when editors other than the 3D viewport need to know if an object is visible. */ + BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT = (1 << 4), + + /* Object comes from a scene set. */ + BASE_FROM_SET = (1 << 5), + + /* Object is enabled for viewport or final render respectively. Only enabled + * objects can be pulled into the depsgraph for evaluation, either through being + * directly visible, as a dependency of another object, or as part of colliders + * and effectors for physics. */ + BASE_ENABLED_VIEWPORT = (1 << 6), + BASE_ENABLED_RENDER = (1 << 7), + /* BASE_DEPRECATED = (1 << 9), */ - BASE_HOLDOUT = (1 << 10), /* Object masked out from render */ - BASE_INDIRECT_ONLY = (1 << 11), /* Object only contributes indirectly to render */ + + /* Object masked out from render */ + BASE_HOLDOUT = (1 << 10), + /* Object only contributes indirectly to render */ + BASE_INDIRECT_ONLY = (1 << 11), }; /* LayerCollection->flag */ |