Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-28 16:05:08 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-28 16:34:13 +0300
commit2bd62b076fac80e073557a7d1dff0e989aaa97c1 (patch)
tree3d914dafe6a58c656fc4096dc24396cb2ef3be94 /source/blender/editors
parentcb9c4b4552d30f9c35e4d9dfe1fe007fb010de29 (diff)
Outliner/visibility: revert changes for now until we find better solutions.
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_edit.c3
-rw-r--r--source/blender/editors/screen/screen_context.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c66
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h3
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c5
-rw-r--r--source/blender/editors/transform/transform_conversions.c6
6 files changed, 74 insertions, 15 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index df1e67efb2d..5852fcff7e9 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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";
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index df7eb07c4d0..cb7d4f1fee9 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -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);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index d4abf216359..722ed393492 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -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);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 172d0b433f2..41a0dce7a38 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -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)
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 2a21b73e9bd..902235779cf 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -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;
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 47bde2a9af7..0fca84074f5 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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);