diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-15 00:36:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-20 13:35:25 +0300 |
commit | 0619f960c2999873ed2e9a24a1f5d77eac03e64d (patch) | |
tree | e06cbd56d4fcbc4746ce51a28b7e9d82795ff552 /source/blender/editors/space_outliner/outliner_draw.c | |
parent | c17ba4a9032246cc674cdc03a2f39b91b32fecd9 (diff) |
Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.
This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.
Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.
In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.
Remaining design issues:
* For lamps we probably still want to keep their effect on the scene,
currently they are fully disabled by hiding. Arguably mesh lights or
even objects being reflected or casting shadows are not that different
but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
for render or animation preview where you want to see the entire scene
while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
it's probably convenient to support this again?
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index e4f551b0004..5108843ebfa 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -278,6 +278,16 @@ 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 = poin; + ViewLayer *view_layer = poin2; + + BKE_layer_collection_sync(scene, view_layer); + 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); @@ -435,7 +445,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) } static void outliner_draw_restrictbuts( - uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb) + uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *ar, SpaceOops *soops, ListBase *lb) { uiBut *bt; @@ -455,15 +465,28 @@ static void outliner_draw_restrictbuts( if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) { /* View layer render toggle. */ - ViewLayer *view_layer = te->directdata; + ViewLayer *layer = te->directdata; bt = uiDefIconButBitS( block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, - UI_UNIT_Y, &view_layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering")); + UI_UNIT_Y, &layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering")); UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); } + else if (tselem->type == 0 && te->idcode == ID_OB) { + ob = (Object *)tselem->id; + Base *base = BKE_view_layer_base_find(view_layer, ob); + + if (base) { + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, BASE_HIDE, 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")); + UI_but_func_set(bt, hidebutton_base_flag_cb, scene, view_layer); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + } + } else if (tselem->type == TSE_MODIFIER) { ModifierData *md = (ModifierData *)te->directdata; Object *ob = (Object *)tselem->id; @@ -489,7 +512,7 @@ static void outliner_draw_restrictbuts( Object *ob = (Object *)tselem->id; bt = uiDefIconButBitI( - block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, + block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 0, ICON_HIDE_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); @@ -527,7 +550,7 @@ static void outliner_draw_restrictbuts( bGPDlayer *gpl = (bGPDlayer *)te->directdata; bt = uiDefIconButBitS( - block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_RESTRICT_VIEW_OFF, + block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_HIDE_OFF, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); @@ -576,7 +599,7 @@ static void outliner_draw_restrictbuts( } if (TSELEM_OPEN(tselem, soops)) { - outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); + outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree); } } } @@ -1999,7 +2022,7 @@ void draw_outliner(const bContext *C) /* draw restriction columns */ outliner_draw_restrictcols(ar); - outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); + outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &soops->tree); } /* draw edit buttons if nessecery */ |