diff options
author | YimingWu <xp8110@outlook.com> | 2021-06-28 10:46:26 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2021-06-28 10:51:34 +0300 |
commit | c297769d2249b2fa3c34eb36aee7631ca5278383 (patch) | |
tree | 7ebd13bcf2a87717f034cd6eb30988d534a72437 /source/blender/editors/space_buttons/buttons_context.c | |
parent | bb2648ebf0022186bdd27e451194388d1fd4cce0 (diff) |
UI: Hide collection tab when scene master collection is active
CollectionLineart does not care about the configurations
in master collection.
Other options are not applicaple for master collection as well.
Hence hiding it.
Reviewed by Dalai Felinto (dfelinto)
Differential Revision: https://developer.blender.org/D11702
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 222d25b7d75..3a2b7f27e52 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -154,7 +154,7 @@ static bool buttons_context_path_world(ButsContextPath *path) return false; } -static bool buttons_context_path_collection(ButsContextPath *path, wmWindow *window) +static bool buttons_context_path_collection(bContext *C, ButsContextPath *path, wmWindow *window) { PointerRNA *ptr = &path->ptr[path->len - 1]; @@ -162,10 +162,19 @@ static bool buttons_context_path_collection(ButsContextPath *path, wmWindow *win if (RNA_struct_is_a(ptr->type, &RNA_Collection)) { return true; } + + Scene *scene = CTX_data_scene(C); + /* if we have a view layer, use the view layer's active collection */ if (buttons_context_path_view_layer(path, window)) { ViewLayer *view_layer = path->ptr[path->len - 1].data; Collection *c = view_layer->active_collection->collection; + + /* Do not show collection tab for master collection. */ + if (c == scene->master_collection) { + return false; + } + if (c) { RNA_id_pointer_create(&c->id, &path->ptr[path->len]); path->len++; @@ -600,7 +609,7 @@ static bool buttons_context_path( found = buttons_context_path_world(path); break; case BCONTEXT_COLLECTION: /* This is for Line Art collection flags */ - found = buttons_context_path_collection(path, window); + found = buttons_context_path_collection(C, path, window); break; case BCONTEXT_TOOL: found = true; |