[Bf-blender-cvs] [afa83b5bcec] fcurve-modifier-panels: List panel system: Support regions with categories
Hans Goudey
noreply at git.blender.org
Mon Oct 19 04:44:59 CEST 2020
Commit: afa83b5bcec78565c49f34e10e3490c9d9951069
Author: Hans Goudey
Date: Thu Jun 11 11:11:30 2020 -0400
Branches: fcurve-modifier-panels
https://developer.blender.org/rBafa83b5bcec78565c49f34e10e3490c9d9951069
List panel system: Support regions with categories
===================================================================
M source/blender/editors/interface/interface_panel.c
===================================================================
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 5f56a93c5eb..16f468fd8d5 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -117,7 +117,7 @@ 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, PanelType *panel_type, const char *context);
static void panel_title_color_get(bool show_background, uchar color[4])
{
@@ -427,14 +427,17 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
return;
}
- char *context = drag_panel->type->context;
+ char *context;
+ 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, ®ion->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++;
}
}
@@ -446,8 +449,8 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
PanelSort *sort_index = panel_sort;
LISTBASE_FOREACH (Panel *, panel, ®ion->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++;
@@ -605,12 +608,17 @@ 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, PanelType *panel_type, const char *context)
{
- if (panel_type->context[0] && STREQ(panel_type->context, context)) {
- return true;
+ if (UI_panel_category_is_visible(region)) {
+ return STREQ(panel_type->category, UI_panel_category_active_get(region, false));
+ }
+ else {
+ if (panel_type->context[0] && STREQ(panel_type->context, context)) {
+ return true;
+ }
+ return false;
}
- return false;
}
Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)
More information about the Bf-blender-cvs
mailing list