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:
authorHans Goudey <h.goudey@me.com>2020-08-12 19:56:10 +0300
committerHans Goudey <h.goudey@me.com>2020-08-12 19:56:10 +0300
commit1da053956a920c34324917becbfe1455b929c824 (patch)
tree4823a94ba21015edd1e3275cf479e7c1f004fb86 /source/blender/editors/interface/interface_panel.c
parent6238eabcd4340893c1c52dcd9a0ffbc7658abe67 (diff)
UI: Category support for instanced panels
This adds support for panel categories to the instanced panel system used for modifiers and others. The change is pulled from D7997 where it is needed for FCurve modifiers, but it is unused now. The change is simple and basically amounts to checking the panel category where it was overlooked before.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r--source/blender/editors/interface/interface_panel.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 799a3b7fd5e..1b48ed8a7a1 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -117,7 +117,9 @@ typedef struct PanelSort {
static int get_panel_real_size_y(const Panel *panel);
static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelState state);
static int compare_panel(const void *a1, const void *a2);
-static bool panel_type_context_poll(PanelType *panel_type, const char *context);
+static bool panel_type_context_poll(ARegion *region,
+ const PanelType *panel_type,
+ const char *context);
static void panel_title_color_get(bool show_background, uchar color[4])
{
@@ -460,14 +462,17 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
return;
}
- char *context = drag_panel->type->context;
+ char *context = NULL;
+ if (!UI_panel_category_is_visible(region)) {
+ context = drag_panel->type->context;
+ }
/* Find how many instanced panels with this context string. */
int list_panels_len = 0;
LISTBASE_FOREACH (Panel *, panel, &region->panels) {
if (panel->type) {
- if (panel_type_context_poll(panel->type, context)) {
- if (panel->type->flag & PNL_INSTANCED) {
+ if (panel->type->flag & PNL_INSTANCED) {
+ if (panel_type_context_poll(region, panel->type, context)) {
list_panels_len++;
}
}
@@ -479,8 +484,8 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
PanelSort *sort_index = panel_sort;
LISTBASE_FOREACH (Panel *, panel, &region->panels) {
if (panel->type) {
- if (panel_type_context_poll(panel->type, context)) {
- if (panel->type->flag & PNL_INSTANCED) {
+ if (panel->type->flag & PNL_INSTANCED) {
+ if (panel_type_context_poll(region, panel->type, context)) {
sort_index->panel = MEM_dupallocN(panel);
sort_index->orig = panel;
sort_index++;
@@ -657,11 +662,18 @@ static void panels_collapse_all(const bContext *C,
set_panels_list_data_expand_flag(C, region);
}
-static bool panel_type_context_poll(PanelType *panel_type, const char *context)
+static bool panel_type_context_poll(ARegion *region,
+ const PanelType *panel_type,
+ const char *context)
{
+ if (UI_panel_category_is_visible(region)) {
+ return STREQ(panel_type->category, UI_panel_category_active_get(region, false));
+ }
+
if (panel_type->context[0] && STREQ(panel_type->context, context)) {
return true;
}
+
return false;
}