Outliner/visibility: revert changes for now until we find better solutions.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 28 Nov 2018 13:05:08 +0000 (14:05 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 28 Nov 2018 13:34:13 +0000 (14:34 +0100)
See T57857 for discussion. This reverts:

"Outliner: Do not gray out empty collections"
4521d3e7074d2e08ca813e1f4a2297f5000f335b.

"Remove eye column from the outliner"
fd16b359977c8932ada8db4ff0e43d0402fdc280.

Fix/workaround issues in pose and edit mode"
6d2e2e30d50c40f302b62d3601b5742d7c7056c6.

"Per view-layer collection visibility"
4de6a210c69fe254518ca8d6c860782c54f03749.

13 files changed:
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_layer.h
source/blender/blenkernel/intern/layer.c
source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
source/blender/editors/object/object_edit.c
source/blender/editors/screen/screen_context.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_intern.h
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/transform/transform_conversions.c
source/blender/makesdna/DNA_layer_types.h
source/blender/makesrna/intern/rna_layer.c

index 2ae8c911a6d5f69acb1dcfe5bdf5d71af117cba5..77f9c2332ac5217f68a37f9169aed3008b64623f 100644 (file)
@@ -4078,8 +4078,11 @@ class VIEW3D_PT_collections(Panel):
             sub = row.split()
             subrow = sub.row(align=True)
             subrow.alignment = 'RIGHT'
-            subrow.active = collection.is_visible # Parent collection runtime visibility
-            subrow.prop(child, "hide_viewport", text="", emboss=False)
+            icon = 'HIDE_OFF' if has_visible_objects else 'HIDE_ON'
+            props = subrow.operator("object.hide_collection", text="", icon=icon, emboss=False)
+            props.collection_index = index
+            props.toggle = True
+            subrow.prop(child.collection, "hide_select", text="", emboss=False)
 
         for child in collection.children:
             index = self._draw_collection(layout, view_layer, child, index)
index 5e0d3f6c5a5b7cda6ef57799c2ef709c08b81c5c..e98fa189379bc147297d1ffab9e7c527dcb01f45 100644 (file)
@@ -113,8 +113,6 @@ bool BKE_layer_collection_objects_select(
         struct ViewLayer *view_layer, struct LayerCollection *lc, bool deselect);
 bool BKE_layer_collection_has_selected_objects(
         struct ViewLayer *view_layer, struct LayerCollection *lc);
-bool BKE_layer_collection_has_layer_collection(
-        struct LayerCollection *lc_parent, struct LayerCollection *lc_child);
 
 void BKE_base_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, bool extend);
 void BKE_layer_collection_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend);
index 76960fbc0884d052ee4f5280f5da7a9d2627837e..9931c29a8c2083384977a42b8f45dcf7b0ef5510 100644 (file)
@@ -610,7 +610,7 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
 static short layer_collection_sync(
         ViewLayer *view_layer, const ListBase *lb_scene,
         ListBase *lb_layer, ListBase *new_object_bases,
-        short parent_exclude, short parent_restrict, short parent_layer_restrict)
+        short parent_exclude, short parent_restrict)
 {
        /* TODO: support recovery after removal of intermediate collections, reordering, ..
         * For local edits we can make editing operating do the appropriate thing, but for
@@ -655,17 +655,15 @@ static short layer_collection_sync(
 
                /* Collection restrict is inherited. */
                short child_restrict = parent_restrict;
-               short child_layer_restrict = parent_layer_restrict;
                if (!(collection->flag & COLLECTION_IS_MASTER)) {
                        child_restrict |= collection->flag;
-                       child_layer_restrict |= lc->flag;
                }
 
                /* Sync child collections. */
                short child_runtime_flag = layer_collection_sync(
                        view_layer, &collection->children,
                        &lc->layer_collections, new_object_bases,
-                       lc->flag, child_restrict, child_layer_restrict);
+                       lc->flag, child_restrict);
 
                /* Layer collection exclude is not inherited. */
                if (lc->flag & LAYER_COLLECTION_EXCLUDE) {
@@ -676,10 +674,6 @@ static short layer_collection_sync(
                        lc->runtime_flag = child_runtime_flag;
                }
 
-               if ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) {
-                       lc->runtime_flag |= LAYER_COLLECTION_VISIBLE;
-               }
-
                /* Sync objects, except if collection was excluded. */
                for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
                        if (cob->ob == NULL) {
@@ -707,7 +701,6 @@ static short layer_collection_sync(
                        int object_restrict = base->object->restrictflag;
 
                        if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
-                           ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) &&
                            ((object_restrict & OB_RESTRICT_VIEW) == 0))
                        {
                                base->flag |= BASE_VISIBLE | BASE_ENABLED | BASE_ENABLED_VIEWPORT;
@@ -721,6 +714,7 @@ static short layer_collection_sync(
 
                        if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
                            ((object_restrict & OB_RESTRICT_RENDER) == 0))
+
                        {
                                base->flag |= BASE_ENABLED_RENDER;
                        }
@@ -797,11 +791,11 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
        const ListBase collections = {&child, &child};
        ListBase new_object_bases = {NULL, NULL};
 
-       const short parent_exclude = 0, parent_restrict = 0, parent_layer_restrict = 0;
+       const short parent_exclude = 0, parent_restrict = 0;
        layer_collection_sync(
                view_layer, &collections,
                &view_layer->layer_collections, &new_object_bases,
-               parent_exclude, parent_restrict, parent_layer_restrict);
+               parent_exclude, parent_restrict);
 
        /* Any remaning object bases are to be removed. */
        for (Base *base = view_layer->object_bases.first; base; base = base->next) {
@@ -925,7 +919,7 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
                for (CollectionObject *cob = lc->collection->gobject.first; cob; cob = cob->next) {
                        Base *base = BKE_view_layer_base_find(view_layer, cob->ob);
 
-                       if (base && (base->flag & BASE_SELECTED) && (base->flag & BASE_VISIBLE)) {
+                       if (base && (base->flag & BASE_SELECTED)) {
                                return true;
                        }
                }
@@ -940,20 +934,6 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
        return false;
 }
 
-bool BKE_layer_collection_has_layer_collection(LayerCollection *lc_parent, LayerCollection *lc_child)
-{
-       if (lc_parent == lc_child) {
-               return true;
-       }
-
-       for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-               if (BKE_layer_collection_has_layer_collection(lc_iter, lc_child)) {
-                       return true;
-               }
-       }
-       return false;
-}
-
 /* ---------------------------------------------------------------------- */
 
 /* Update after toggling visibility of an object base. */
@@ -975,62 +955,44 @@ void BKE_base_set_visible(Scene *scene, ViewLayer *view_layer, Base *base, bool
        BKE_layer_collection_sync(scene, view_layer);
 }
 
-static void layer_collection_flag_set_recursive(LayerCollection *lc, const int flag)
-{
-       lc->flag |= flag;
-       for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-               layer_collection_flag_set_recursive(lc_iter, flag);
-       }
-}
-
-static void layer_collection_flag_unset_recursive(LayerCollection *lc, const int flag)
-{
-       lc->flag &= ~flag;
-       for (LayerCollection *lc_iter = lc->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-               layer_collection_flag_unset_recursive(lc_iter, flag);
-       }
-}
-
-/**
- * Set collection per-view layer visiblity.
- * When not extending, we show all the direct parents and all children of the layer collection.
- */
 void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
 {
        if (!extend) {
-               /* Make only this collection visible. */
-               for (LayerCollection *lc_iter = view_layer->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-                       layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
-               }
-
-               /* Make all the direct parents visible. */
-               LayerCollection *lc_parent = lc;
-               LayerCollection *lc_master = view_layer->layer_collections.first;
-               for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-                       if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
-                               lc_parent = lc_iter;
-                               break;
-                       }
+               /* Make only objects from one collection visible. */
+               for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+                       base->flag |= BASE_HIDDEN;
                }
 
-               while (lc_parent != lc) {
-                       lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+               FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
+               {
+                       Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
 
-                       for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
-                               if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) {
-                                       lc_parent = lc_iter;
-                                       break;
-                               }
+                       if (base) {
+                               base->flag &= ~BASE_HIDDEN;
                        }
                }
-
-               /* Make all the children visible. */
-               layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+               FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
 
                BKE_layer_collection_activate(view_layer, lc);
        }
        else {
-               lc->flag ^= LAYER_COLLECTION_RESTRICT_VIEW;
+               /* Toggle visibility of objects from collection. */
+               bool hide = (lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS) != 0;
+
+               FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
+               {
+                       Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
+
+                       if (base) {
+                               if (hide) {
+                                       base->flag |= BASE_HIDDEN;
+                               }
+                               else {
+                                       base->flag &= ~BASE_HIDDEN;
+                               }
+                       }
+               }
+               FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
        }
 
        BKE_layer_collection_sync(scene, view_layer);
@@ -1139,7 +1101,7 @@ typedef struct LayerObjectBaseIteratorData {
        Base *base;
 } LayerObjectBaseIteratorData;
 
-static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flags)
+static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int flag)
 {
        if (v3d != NULL) {
                if ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0) {
@@ -1150,12 +1112,12 @@ static bool object_bases_iterator_is_valid_ex(View3D *v3d, Base *base, const int
                        return false;
                }
        }
-       /* Any flag satisfies the condition. */
-       if (flags == ~0) {
-               return (base->flag != 0);
+
+       if ((base->flag & flag) == 0) {
+               return false;
        }
-       /* flags may be more than one flag, so we can't check != 0. */
-       return ((base->flag & flags) == flags);
+
+       return true;
 }
 
 static bool object_bases_iterator_is_valid(View3D *v3d, Base *base)
@@ -1243,12 +1205,12 @@ 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 | BASE_SELECTED);
+       objects_iterator_begin(iter, data_in, BASE_SELECTED);
 }
 
 void BKE_view_layer_selected_objects_iterator_next(BLI_Iterator *iter)
 {
-       objects_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
+       objects_iterator_next(iter, BASE_SELECTED);
 }
 
 void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *iter)
@@ -1285,7 +1247,7 @@ 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 | BASE_SELECTED);
+       objects_iterator_begin(iter, data_in, BASE_SELECTED);
        if (iter->valid) {
                if (BKE_object_is_libdata((Object *)iter->current) == false) {
                        // First object is valid (selectable and not libdata) -> all good.
@@ -1302,7 +1264,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 | BASE_SELECTED);
+               objects_iterator_next(iter, BASE_SELECTED);
        } while (iter->valid && BKE_object_is_libdata((Object *)iter->current) != false);
 }
 
@@ -1319,12 +1281,12 @@ 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 | BASE_SELECTED);
+       objects_iterator_begin(iter, data_in, BASE_SELECTED);
 }
 
 void BKE_view_layer_selected_bases_iterator_next(BLI_Iterator *iter)
 {
-       object_bases_iterator_next(iter, BASE_VISIBLE | BASE_SELECTED);
+       object_bases_iterator_next(iter, BASE_SELECTED);
 }
 
 void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *iter)
index 2fff8bae2b2e01b8f9d12b42ae5db6edab34ca8c..70bd533647caf6a72c31ef28dc8250744e9219cc 100644 (file)
@@ -71,11 +71,6 @@ void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb)
                COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
 
        for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
-               if ((graph_->mode == DAG_EVAL_VIEWPORT) &&
-                   ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0))
-               {
-                       continue;
-               }
                if (lc->collection->flag & restrict_flag) {
                        continue;
                }
index 6c85803dabef51ae98792a4d81e06353b69b299e..999508cffed7bbb6543f92e455edb5789ad7794e 100644 (file)
@@ -75,11 +75,6 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
                COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
 
        for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
-               if ((graph_->mode == DAG_EVAL_VIEWPORT) &&
-                   ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0))
-               {
-                       continue;
-               }
                if ((lc->collection->flag & restrict_flag)) {
                        continue;
                }
index df1e67efb2dc49a7a82148fc4b21e76551dfe9bc..5852fcff7e933be7534996df7d0c4a51eef62367 100644 (file)
@@ -295,7 +295,6 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op)
 
        BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
 
-       DEG_relations_tag_update(CTX_data_main(C));
        DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
@@ -369,7 +368,7 @@ static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEv
 void OBJECT_OT_hide_collection(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name = "Hide Collection";
+       ot->name = "Hide Objects By Collection";
        ot->description = "Show only objects in collection (Shift to extend)";
        ot->idname = "OBJECT_OT_hide_collection";
 
index df7eb07c4d0a1cdc83a4c66b221fa5e8f239e540..cb7d4f1fee9ce02574b924ed3072fd5de1d8b189 100644 (file)
@@ -203,9 +203,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                        if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
                                continue;
                        }
-                       if ((base->flag & BASE_VISIBLE) == 0) {
-                               continue;
-                       }
                        if ((base->flag & BASE_SELECTED) != 0) {
                                CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
                        }
@@ -221,9 +218,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                        if (v3d && ((v3d->object_type_exclude_viewport & (1 << base->object->type)) != 0)) {
                                continue;
                        }
-                       if ((base->flag & BASE_VISIBLE) == 0) {
-                               continue;
-                       }
                        if ((base->flag & BASE_SELECTED) != 0) {
                                if (0 == BKE_object_is_libdata(base->object)) {
                                        CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
index d4abf2163596319d5b555e65083166b8c129068c..722ed3934926572a09732602665a2f8cf58582eb 100644 (file)
@@ -274,6 +274,44 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
        }
 }
 
+static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
+{
+       Scene *scene = CTX_data_scene(C);
+       ViewLayer *view_layer = poin;
+       Base *base = poin2;
+       bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
+
+       /* Undo button toggle, let function do it. */
+       base->flag ^= BASE_HIDDEN;
+
+       BKE_base_set_visible(scene, view_layer, base, extend);
+
+       if (!extend && (base->flag & BASE_VISIBLE)) {
+               /* Auto select solo-ed object. */
+               ED_object_base_select(base, BA_SELECT);
+               view_layer->basact = base;
+       }
+
+       DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+}
+
+static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2)
+{
+       Scene *scene = CTX_data_scene(C);
+       ViewLayer *view_layer = poin;
+       LayerCollection *lc = poin2;
+       bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
+
+       /* Undo button toggle, let function do it. */
+       lc->runtime_flag ^= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
+
+       BKE_layer_collection_set_visible(scene, view_layer, lc, extend);
+
+       DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+}
+
 static void namebutton_cb(bContext *C, void *tsep, char *oldname)
 {
        Main *bmain = CTX_data_main(C);
@@ -487,6 +525,18 @@ static void outliner_draw_restrictbuts(
                        }
                        else if (tselem->type == 0 && te->idcode == ID_OB) {
                                Object *ob = (Object *)tselem->id;
+                               Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+                               if (base) {
+                                       bt = uiDefIconButBitS(
+                                               block, UI_BTYPE_ICON_TOGGLE, BASE_HIDDEN, 0, ICON_HIDE_OFF,
+                                               (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
+                                               UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
+                                               TIP_("Hide object in viewport (Ctrl to isolate)"));
+                                       UI_but_func_set(bt, hidebutton_base_flag_cb, view_layer, base);
+                                       UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+                                       UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
+                               }
 
                                PointerRNA ptr;
                                RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr);
@@ -598,6 +648,17 @@ static void outliner_draw_restrictbuts(
                                if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) &&
                                    !(collection->flag & COLLECTION_IS_MASTER))
                                {
+                                       if (lc && (lc->runtime_flag & LAYER_COLLECTION_HAS_ENABLED_OBJECTS)) {
+                                               bt = uiDefIconButBitS(
+                                                       block, UI_BTYPE_ICON_TOGGLE_N, LAYER_COLLECTION_HAS_VISIBLE_OBJECTS, 0, ICON_HIDE_OFF,
+                                                       (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
+                                                       UI_UNIT_Y, &lc->runtime_flag, 0, 0, 0, 0,
+                                                       TIP_("Hide collection in viewport (Ctrl to isolate)"));
+                                               UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc);
+                                               UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+                                               UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
+                                       }
+
                                        PointerRNA collection_ptr;
                                        RNA_id_pointer_create(&collection->id, &collection_ptr);
 
@@ -2059,7 +2120,10 @@ static void outliner_draw_restrictcols(ARegion *ar)
        uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
        immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
        immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
-       immBegin(GPU_PRIM_LINES, 6);
+       immBegin(GPU_PRIM_LINES, 8);
+
+       immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymax);
+       immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymin);
 
        immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
        immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
index 172d0b433f24d83110274b50b8cfe131693dbc47..41a0dce7a388dbb7f87febdb1bf4d73a57b7d5cf 100644 (file)
@@ -129,11 +129,12 @@ typedef enum {
 /* size constants */
 #define OL_Y_OFFSET 2
 
+#define OL_TOG_HIDEX            (UI_UNIT_X * 4.0f + V2D_SCROLL_WIDTH)
 #define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 3.0f + V2D_SCROLL_WIDTH)
 #define OL_TOG_RESTRICT_VIEWX   (UI_UNIT_X * 2.0f + V2D_SCROLL_WIDTH)
 #define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X + V2D_SCROLL_WIDTH)
 
-#define OL_TOGW OL_TOG_RESTRICT_SELECTX
+#define OL_TOGW OL_TOG_HIDEX
 
 #define OL_RNA_COLX         (UI_UNIT_X * 15)
 #define OL_RNA_COL_SIZEX    (UI_UNIT_X * 7.5f)
index 2a21b73e9bd9b5dc2add21b4c0717799883789b1..902235779cfb5a3e469a32c40c685cd5d08ebf56 100644 (file)
@@ -1314,7 +1314,10 @@ static void outliner_add_layer_collections_recursive(
                ten->directdata = lc;
 
                const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
-               if (exclude) {
+               if (exclude ||
+                   ((layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
+                    !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)))
+               {
                        ten->flag |= TE_DISABLED;
                }
 
index 47bde2a9af764935f2287437729d9a38594c1db8..0fca84074f5b0e9641fe311543609dedf8bde4c0 100644 (file)
@@ -5906,8 +5906,7 @@ static int count_proportional_objects(TransInfo *t)
                for (Base *base = view_layer->object_bases.first; base; base = base->next) {
                        /* all base not already selected or marked that is editable */
                        if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
-                           ((base->flag & BASE_VISIBLE) != 0 &&
-                            (base->flag & BASE_SELECTED) == 0) &&
+                           (base->flag & BASE_SELECTED) == 0 &&
                            (BASE_EDITABLE_BGMODE(v3d, base)))
                        {
                                mark_children(base->object);
@@ -5921,8 +5920,7 @@ static int count_proportional_objects(TransInfo *t)
                 * selection and it is editable.
                 */
                if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
-                   ((base->flag & BASE_VISIBLE) != 0 &&
-                    (base->flag & BASE_SELECTED) == 0) &&
+                   (base->flag & BASE_SELECTED) == 0 &&
                    (BASE_EDITABLE_BGMODE(v3d, base)))
                {
                        flush_trans_object_base_deps_flag(depsgraph, ob);
index 8cc305d92036da804e6740f999625fe1fe2666d6..c3e819c55385d50c2520e76861d3f45ddac5d4a3 100644 (file)
@@ -117,7 +117,6 @@ enum {
        LAYER_COLLECTION_EXCLUDE = (1 << 4),
        LAYER_COLLECTION_HOLDOUT = (1 << 5),
        LAYER_COLLECTION_INDIRECT_ONLY = (1 << 6),
-       LAYER_COLLECTION_RESTRICT_VIEW = (1 << 7),
 };
 
 /* Layer Collection->runtime_flag */
@@ -126,7 +125,6 @@ enum {
        LAYER_COLLECTION_HAS_VISIBLE_OBJECTS = (1 << 1),
        LAYER_COLLECTION_HAS_HIDDEN_OBJECTS = (1 << 2),
        LAYER_COLLECTION_HAS_ENABLED_OBJECTS = (1 << 3),
-       LAYER_COLLECTION_VISIBLE = (1 << 4),
 };
 
 /* ViewLayer->flag */
index cdb87169a45f1a2c9747672530774dc8bca8cf68..46d1f5bef7dba1c1430402ffb8b9c189c4e74f61 100644 (file)
@@ -297,19 +297,6 @@ static void rna_def_layer_collection(BlenderRNA *brna)
                                 "in the view layer");
        RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
 
-       prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW);
-       RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-       RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
-       RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport for this view layer");
-       RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_use_update");
-
-       prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Visible",
-                                "Whether this collection is visible, take into account the collection parent");
-
        func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
        RNA_def_function_ui_description(func, "");
        RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));