From 897e047374fa3d3ceef35aa2cdb3372b6a7cc64a Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 30 Nov 2018 02:24:06 -0200 Subject: Outliner visibility unification: Implement 3 levels of viewport visibility Now collection and objects can be either: * Disabled for all the view layers. * Hidden for a view layer but not necessarily for all others. * Visible for a view layer but not necessarily for all others. Regarding icons: Whatever we decide to use for the "Hidden for all view layers" needs to be a toggle-like icon. Because when viewing "Scenes" instead of "View Layer" in the outliner we should be able to edit the collection "Hidden for all the view layers" as an on/off option. The operators are accessible via a Visibility context menu or shortcuts: * Ctrl + Click: Isolate collection (use shift to extend). * Alt + Click: Disable collection. * Shift + Click: Hide/Show collection and its children (objects and collections) Things yet to be tackled: * Object outliner context menu can also get a Visibility sub-menu. * Get better icons for viewport enable/disable. Note: * When using emulate 3 button mouse alt+click is used for 2d panning. In this case users have to use the operator from the menu. See T57857 for discussion. Patch: https://developer.blender.org/D4011 Reviewers: brecht and sergey Thanks to the reviewers and William Reynish and Julien Kasper in particular for the feedback. --- .../editors/space_outliner/outliner_collections.c | 342 +++++++++++++++++++++ .../blender/editors/space_outliner/outliner_draw.c | 148 +++++---- .../editors/space_outliner/outliner_intern.h | 13 +- .../blender/editors/space_outliner/outliner_ops.c | 10 + 4 files changed, 459 insertions(+), 54 deletions(-) (limited to 'source/blender/editors/space_outliner') diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index 772f3f8b3ff..0d8c88ecede 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -820,6 +820,348 @@ void OUTLINER_OT_collection_indirect_only_clear(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +/************************** Visibility Operators ******************************/ + +static int collection_isolate_exec(bContext *C, wmOperator *op) { + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + SpaceOops *soops = CTX_wm_space_outliner(C); + const bool extend = RNA_boolean_get(op->ptr, "extend"); + bool depsgraph_changed = false; + struct CollectionEditData data = {.scene = scene, .soops = soops,}; + data.collections_to_edit = BLI_gset_ptr_new(__func__); + + /* Hide all collections before the isolate function - needed in order to support. */ + if (!extend) { + for (LayerCollection *lc_iter = view_layer->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + lc_iter->flag |= LAYER_COLLECTION_RESTRICT_VIEW; + layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW); + } + } + + outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data); + + GSetIterator collections_to_edit_iter; + GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { + LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); + depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, layer_collection, true); + } + BLI_gset_free(data.collections_to_edit, NULL); + + BKE_layer_collection_sync(scene, view_layer); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); + + if (depsgraph_changed) { + DEG_relations_tag_update(CTX_data_main(C)); + } + + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); + return OPERATOR_FINISHED; +} + +static int collection_isolate_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "extend"); + if (!RNA_property_is_set(op->ptr, prop) && (event->shift)) { + RNA_property_boolean_set(op->ptr, prop, true); + } + return collection_isolate_exec(C, op); +} + +void OUTLINER_OT_collection_isolate(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Isolate Collection"; + ot->idname = "OUTLINER_OT_collection_isolate"; + ot->description = "Hide all but this collection and its parents"; + + /* api callbacks */ + ot->exec = collection_isolate_exec; + ot->invoke = collection_isolate_invoke; + ot->poll = ED_outliner_collections_editor_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + PropertyRNA *prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend current visible collections"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); +} + +static bool collection_show_poll(bContext *C) +{ + return collections_view_layer_poll(C, true, LAYER_COLLECTION_RESTRICT_VIEW); +} + +static bool collection_hide_poll(bContext *C) +{ + return collections_view_layer_poll(C, false, LAYER_COLLECTION_RESTRICT_VIEW); +} + +static bool collection_inside_poll(bContext *C) +{ + if (!ED_outliner_collections_editor_poll(C)) { + return false; + } + return outliner_active_layer_collection(C) != NULL; +} + +static int collection_visibility_exec(bContext *C, wmOperator *op) { + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + SpaceOops *soops = CTX_wm_space_outliner(C); + const bool is_inside = strstr(op->idname, "inside") != NULL; + const bool show = strstr(op->idname, "show") != NULL; + bool depsgraph_changed = false; + struct CollectionEditData data = {.scene = scene, .soops = soops,}; + data.collections_to_edit = BLI_gset_ptr_new(__func__); + + outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data); + + GSetIterator collections_to_edit_iter; + GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { + LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); + depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, layer_collection, show, is_inside); + } + BLI_gset_free(data.collections_to_edit, NULL); + + BKE_layer_collection_sync(scene, view_layer); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); + + if (depsgraph_changed) { + DEG_relations_tag_update(CTX_data_main(C)); + } + + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); + return OPERATOR_FINISHED; +} + +void OUTLINER_OT_collection_show(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Show Collection"; + ot->idname = "OUTLINER_OT_collection_show"; + ot->description = "Show the collection in this view layer"; + + /* api callbacks */ + ot->exec = collection_visibility_exec; + ot->poll = collection_show_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_hide(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Hide Collection"; + ot->idname = "OUTLINER_OT_collection_hide"; + ot->description = "Hide the collection in this view layer"; + + /* api callbacks */ + ot->exec = collection_visibility_exec; + ot->poll = collection_hide_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_show_inside(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Show Inside Collection"; + ot->idname = "OUTLINER_OT_collection_show_inside"; + ot->description = "Show all the objects and collections inside the collection"; + + /* api callbacks */ + ot->exec = collection_visibility_exec; + ot->poll = collection_inside_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_hide_inside(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Hide Inside Collection"; + ot->idname = "OUTLINER_OT_collection_hide_inside"; + ot->description = "Hide all the objects and collections inside the collection"; + + /* api callbacks */ + ot->exec = collection_visibility_exec; + ot->poll = collection_inside_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +static bool collection_flag_poll(bContext *C, bool clear, int flag) +{ + if (!ED_outliner_collections_editor_poll(C)) { + return false; + } + + TreeElement *te = outliner_active_collection(C); + if (te == NULL) { + return false; + } + + Collection *collection = outliner_collection_from_tree_element(te); + if (collection == NULL) { + return false; + } + + if (clear && (collection->flag & flag)) { + return true; + } + else if (!clear && !(collection->flag & flag)) { + return true; + } + + return false; +} + +static bool collection_enable_poll(bContext *C) +{ + return collection_flag_poll(C, true, COLLECTION_RESTRICT_VIEW); +} + +static bool collection_disable_poll(bContext *C) +{ + return collection_flag_poll(C, false, COLLECTION_RESTRICT_VIEW); +} + +static bool collection_enable_render_poll(bContext *C) +{ + return collection_flag_poll(C, true, COLLECTION_RESTRICT_RENDER); +} + +static bool collection_disable_render_poll(bContext *C) +{ + return collection_flag_poll(C, false, COLLECTION_RESTRICT_RENDER); +} + +static int collection_flag_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + SpaceOops *soops = CTX_wm_space_outliner(C); + const bool is_render = strstr(op->idname, "render"); + const bool clear = strstr(op->idname, "show") || strstr(op->idname, "enable"); + int flag = is_render ? COLLECTION_RESTRICT_RENDER : COLLECTION_RESTRICT_VIEW; + struct CollectionEditData data = {.scene = scene, .soops = soops,}; + data.collections_to_edit = BLI_gset_ptr_new(__func__); + const bool has_layer_collection = soops->outlinevis == SO_VIEW_LAYER; + + if (has_layer_collection) { + outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data); + GSetIterator collections_to_edit_iter; + GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { + LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); + Collection *collection = layer_collection->collection; + + if (clear) { + collection->flag &= ~flag; + } + else { + collection->flag |= flag; + } + + /* Make sure (at least for this view layer) the collection is visible. */ + if (clear && !is_render) { + layer_collection->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW; + } + } + BLI_gset_free(data.collections_to_edit, NULL); + } + else { + outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data); + GSetIterator collections_to_edit_iter; + GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { + Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); + + if (clear) { + collection->flag &= ~flag; + } + else { + collection->flag |= flag; + } + } + BLI_gset_free(data.collections_to_edit, NULL); + } + + BKE_layer_collection_sync(scene, view_layer); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); + + if (!is_render) { + DEG_relations_tag_update(CTX_data_main(C)); + } + + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); + return OPERATOR_FINISHED; +} + +void OUTLINER_OT_collection_enable(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Enable Collection"; + ot->idname = "OUTLINER_OT_collection_enable"; + ot->description = "Enable viewport drawing in the view layers"; + + /* api callbacks */ + ot->exec = collection_flag_exec; + ot->poll = collection_enable_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_disable(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Disable Collection"; + ot->idname = "OUTLINER_OT_collection_disable"; + ot->description = "Disable viewport drawing in the view layers"; + + /* api callbacks */ + ot->exec = collection_flag_exec; + ot->poll = collection_disable_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_enable_render(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Enable Collection in Render"; + ot->idname = "OUTLINER_OT_collection_enable_render"; + ot->description = "Render the collection"; + + /* api callbacks */ + ot->exec = collection_flag_exec; + ot->poll = collection_enable_render_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void OUTLINER_OT_collection_disable_render(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Disable Collection in Render"; + ot->idname = "OUTLINER_OT_collection_disable_render"; + ot->description = "Do not render this collection"; + + /* api callbacks */ + ot->exec = collection_flag_exec; + ot->poll = collection_disable_render_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /** * Populates the \param objects: ListBase with all the outliner selected objects * We store it as (Object *)LinkData->data diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 7a2ac82cf54..f0befd1df49 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -267,41 +267,72 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2) { + Main *bmain = CTX_data_main(C); 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); + Object *ob = base->object; + bool freeze = (CTX_wm_window(C)->eventstate->alt != 0); + bool changed_restrict_view = false; - if (!extend && (base->flag & BASE_VISIBLE)) { - /* Auto select solo-ed object. */ - ED_object_base_select(base, BA_SELECT); - view_layer->basact = base; + if (freeze) { + ob->restrictflag |= OB_RESTRICT_VIEW; + changed_restrict_view = true; + } + else if (ob->restrictflag & OB_RESTRICT_VIEW) { + ob->restrictflag &= ~OB_RESTRICT_VIEW; + base->flag &= ~BASE_HIDDEN; + changed_restrict_view = true; + } + else { + base->flag ^= BASE_HIDDEN; } - DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + if (changed_restrict_view) { + BKE_main_collection_sync(bmain); + DEG_id_tag_update(&ob->id, LIB_TAG_COPIED_ON_WRITE); + DEG_relations_tag_update(bmain); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id); + } + if (!freeze) { + BKE_layer_collection_sync(scene, view_layer); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + } } static void hidebutton_layer_collection_flag_cb(bContext *C, void *poin, void *poin2) { + wmWindow *win = CTX_wm_window(C); 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->flag ^= LAYER_COLLECTION_RESTRICT_VIEW; - - BKE_layer_collection_set_visible(scene, view_layer, lc, extend); + Collection *collection = lc->collection; + bool do_disable = (win->eventstate->alt != 0); + bool do_isolate = (win->eventstate->ctrl != 0) && !do_disable; + bool extend = (win->eventstate->shift != 0); + bool depsgraph_changed = false; + + if (do_disable) { + collection->flag |= COLLECTION_RESTRICT_VIEW; + depsgraph_changed = true; + } + else if (do_isolate) { + depsgraph_changed |= BKE_layer_collection_isolate(scene, view_layer, lc, extend); + } + else { + bool make_visible = ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0) || + ((collection->flag & COLLECTION_RESTRICT_VIEW) != 0); + depsgraph_changed |= BKE_layer_collection_set_visible(view_layer, lc, make_visible, extend); + } - DEG_relations_tag_update(CTX_data_main(C)); + BKE_layer_collection_sync(scene, view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + + if (depsgraph_changed) { + DEG_relations_tag_update(CTX_data_main(C)); + } + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); } static void namebutton_cb(bContext *C, void *tsep, char *oldname) @@ -517,27 +548,32 @@ static void outliner_draw_restrictbuts( UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); } else if (tselem->type == 0 && te->idcode == ID_OB) { + PointerRNA ptr; Object *ob = (Object *)tselem->id; + RNA_pointer_create(&ob->id, &RNA_Object, ob, &ptr); 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)")); + int icon = ICON_RESTRICT_VIEW_ON; + if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0) { + icon = (base->flag & BASE_HIDDEN) != 0 ? + ICON_HIDE_ON : + ICON_HIDE_OFF; + } + bt = uiDefIconBut( + block, UI_BTYPE_ICON_TOGGLE, 0, icon, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, + NULL, 0, 0, 0, 0, + TIP_("Hide object in viewport (Alt to disable for all viewports)")); 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); - - bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, - &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL); - UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + else { + bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, + &ptr, props.object_hide_viewport, -1, 0, 0, -1, -1, NULL); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + } bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, 0, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, @@ -641,23 +677,34 @@ static void outliner_draw_restrictbuts( if ((!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) && !(collection->flag & COLLECTION_IS_MASTER)) { - bt = uiDefIconButBitS( - block, UI_BTYPE_ICON_TOGGLE, LAYER_COLLECTION_RESTRICT_VIEW, 0, ICON_HIDE_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X, - UI_UNIT_Y, &lc->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); - bt = uiDefIconButR_prop( - block, UI_BTYPE_ICON_TOGGLE, 0, 0, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, - UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL); - UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + if (lc != NULL) { + int icon = ICON_RESTRICT_VIEW_ON; + if ((collection->flag & COLLECTION_RESTRICT_VIEW) == 0) { + icon = (lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0 ? + ICON_HIDE_ON : + ICON_HIDE_OFF; + } + bt = uiDefIconBut( + block, UI_BTYPE_TOGGLE, 0, icon, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, + NULL, 0, 0, 0, 0, + TIP_("Hide collection in viewport\n" + "* Alt to disable for all viewports\n" + "* Ctrl to isolate visibility\n" + "* Shift to hide inside objects and collections")); + UI_but_func_set(bt, hidebutton_layer_collection_flag_cb, view_layer, lc); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + } + else { + bt = uiDefIconButR_prop( + block, UI_BTYPE_ICON_TOGGLE, 0, 0, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, + UI_UNIT_Y, &collection_ptr, props.collection_hide_viewport, -1, 0, 0, 0, 0, NULL); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + } bt = uiDefIconButR_prop( block, UI_BTYPE_ICON_TOGGLE, 0, 0, @@ -2115,10 +2162,7 @@ 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, 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); + immBegin(GPU_PRIM_LINES, 6); 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); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 96399d3c129..d978acb6062 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -123,12 +123,11 @@ 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_HIDEX +#define OL_TOGW OL_TOG_RESTRICT_SELECTX #define OL_RNA_COLX (UI_UNIT_X * 15) #define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f) @@ -329,6 +328,16 @@ void OUTLINER_OT_collection_holdout_clear(struct wmOperatorType *ot); void OUTLINER_OT_collection_indirect_only_set(struct wmOperatorType *ot); void OUTLINER_OT_collection_indirect_only_clear(struct wmOperatorType *ot); +void OUTLINER_OT_collection_isolate(struct wmOperatorType *ot); +void OUTLINER_OT_collection_show(struct wmOperatorType *ot); +void OUTLINER_OT_collection_hide(struct wmOperatorType *ot); +void OUTLINER_OT_collection_show_inside(struct wmOperatorType *ot); +void OUTLINER_OT_collection_hide_inside(struct wmOperatorType *ot); +void OUTLINER_OT_collection_enable(struct wmOperatorType *ot); +void OUTLINER_OT_collection_disable(struct wmOperatorType *ot); +void OUTLINER_OT_collection_enable_render(struct wmOperatorType *ot); +void OUTLINER_OT_collection_disable_render(struct wmOperatorType *ot); + /* outliner_utils.c ---------------------------------------------- */ TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase *tree, float view_co_y); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index d01fa066500..3334206beac 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -105,6 +105,16 @@ void outliner_operatortypes(void) WM_operatortype_append(OUTLINER_OT_collection_holdout_clear); WM_operatortype_append(OUTLINER_OT_collection_indirect_only_set); WM_operatortype_append(OUTLINER_OT_collection_indirect_only_clear); + + WM_operatortype_append(OUTLINER_OT_collection_isolate); + WM_operatortype_append(OUTLINER_OT_collection_disable); + WM_operatortype_append(OUTLINER_OT_collection_enable); + WM_operatortype_append(OUTLINER_OT_collection_hide); + WM_operatortype_append(OUTLINER_OT_collection_show); + WM_operatortype_append(OUTLINER_OT_collection_disable_render); + WM_operatortype_append(OUTLINER_OT_collection_enable_render); + WM_operatortype_append(OUTLINER_OT_collection_hide_inside); + WM_operatortype_append(OUTLINER_OT_collection_show_inside); } void outliner_keymap(wmKeyConfig *keyconf) -- cgit v1.2.3