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
This commit is contained in:
parent
bb2648ebf0
commit
c297769d22
Notes:
blender-bot
2023-02-14 10:37:50 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93 Referenced by issue #89422, UI: Collection tab should hide when scene master collection is active.
|
@ -25,6 +25,10 @@ class CollectionButtonsPanel:
|
|||
bl_region_type = 'WINDOW'
|
||||
bl_context = "collection"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.collection != context.scene.collection
|
||||
|
||||
|
||||
def lineart_make_line_type_entry(col, line_type, text_disp, expand, search_from):
|
||||
col.prop(line_type, "use", text=text_disp)
|
||||
|
@ -38,12 +42,6 @@ def lineart_make_line_type_entry(col, line_type, text_disp, expand, search_from)
|
|||
class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel):
|
||||
bl_label = "Restrictions"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
vl = context.view_layer
|
||||
vlc = vl.active_layer_collection
|
||||
return (vlc.name != 'Master Collection')
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -202,11 +202,11 @@ int ED_buttons_tabs_list(SpaceProperties *sbuts, short *context_tabs_array)
|
|||
context_tabs_array[length] = BCONTEXT_WORLD;
|
||||
length++;
|
||||
}
|
||||
if (length != 0) {
|
||||
context_tabs_array[length] = -1;
|
||||
length++;
|
||||
}
|
||||
if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
|
||||
if (length != 0) {
|
||||
context_tabs_array[length] = -1;
|
||||
length++;
|
||||
}
|
||||
context_tabs_array[length] = BCONTEXT_COLLECTION;
|
||||
length++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue