Cleanup: make meaning of base visibility flags more clear
Rename, add comments, and use flag in the depsgraph to ensure the logic matches. Differential Revision: https://developer.blender.org/D15883
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user