Cleanup: Make panel type flag names more clear
The overlap with the `Panel` flags that start with "PNL" was quite confusing because wasn't clear which enum a flag was from. The new names are a bit longer, but the clarity is worth it.
This commit is contained in:
parent
4c193f731e
commit
9d28353b52
|
@ -280,15 +280,15 @@ typedef struct PanelType {
|
|||
|
||||
/* #PanelType.flag */
|
||||
enum {
|
||||
PNL_DEFAULT_CLOSED = (1 << 0),
|
||||
PNL_NO_HEADER = (1 << 1),
|
||||
PANEL_TYPE_DEFAULT_CLOSED = (1 << 0),
|
||||
PANEL_TYPE_NO_HEADER = (1 << 1),
|
||||
/** Makes buttons in the header shrink/stretch to fill full layout width. */
|
||||
PNL_LAYOUT_HEADER_EXPAND = (1 << 2),
|
||||
PNL_LAYOUT_VERT_BAR = (1 << 3),
|
||||
PANEL_TYPE_HEADER_EXPAND = (1 << 2),
|
||||
PANEL_TYPE_LAYOUT_VERT_BAR = (1 << 3),
|
||||
/** This panel type represents data external to the UI. */
|
||||
PNL_INSTANCED = (1 << 4),
|
||||
PANEL_TYPE_INSTANCED = (1 << 4),
|
||||
/** Draw panel like a box widget. */
|
||||
PNL_DRAW_BOX = (1 << 6),
|
||||
PANEL_TYPE_DRAW_BOX = (1 << 6),
|
||||
};
|
||||
|
||||
/* uilist types */
|
||||
|
|
|
@ -1997,7 +1997,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
|
|||
else if (block->panel) {
|
||||
bool show_background = region->alignment != RGN_ALIGN_FLOAT;
|
||||
if (show_background) {
|
||||
if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (block->panel->type && (block->panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
if (region->regiontype == RGN_TYPE_TOOLS) {
|
||||
/* We never want a background around active tools. */
|
||||
show_background = false;
|
||||
|
|
|
@ -336,7 +336,7 @@ void UI_list_panel_unique_str(Panel *panel, char *r_name)
|
|||
* and is freed by #UI_panels_free_instanced.
|
||||
*
|
||||
* \note The only panels that should need to be deleted at runtime are panels with the
|
||||
* #PNL_INSTANCED flag set.
|
||||
* #PANEL_TYPE_INSTANCED flag set.
|
||||
*/
|
||||
static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, Panel *panel)
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ void UI_panels_free_instanced(const bContext *C, ARegion *region)
|
|||
{
|
||||
/* Delete panels with the instanced flag. */
|
||||
LISTBASE_FOREACH_MUTABLE (Panel *, panel, ®ion->panels) {
|
||||
if ((panel->type != NULL) && (panel->type->flag & PNL_INSTANCED)) {
|
||||
if ((panel->type != NULL) && (panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
/* Make sure the panel's handler is removed before deleting it. */
|
||||
if (C != NULL && panel->activedata != NULL) {
|
||||
panel_activate_state(C, panel, PANEL_STATE_EXIT);
|
||||
|
@ -407,7 +407,7 @@ bool UI_panel_list_matches_data(ARegion *region,
|
|||
|
||||
int i = 0;
|
||||
LISTBASE_FOREACH (Panel *, panel, ®ion->panels) {
|
||||
if (panel->type != NULL && panel->type->flag & PNL_INSTANCED) {
|
||||
if (panel->type != NULL && panel->type->flag & PANEL_TYPE_INSTANCED) {
|
||||
/* The panels were reordered by drag and drop. */
|
||||
if (panel->flag & PNL_INSTANCED_LIST_ORDER_CHANGED) {
|
||||
return false;
|
||||
|
@ -458,7 +458,7 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
|
|||
int list_panels_len = 0;
|
||||
LISTBASE_FOREACH (const Panel *, panel, ®ion->panels) {
|
||||
if (panel->type) {
|
||||
if (panel->type->flag & PNL_INSTANCED) {
|
||||
if (panel->type->flag & PANEL_TYPE_INSTANCED) {
|
||||
if (panel_type_context_poll(region, panel->type, context)) {
|
||||
list_panels_len++;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ 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->flag & PNL_INSTANCED) {
|
||||
if (panel->type->flag & PANEL_TYPE_INSTANCED) {
|
||||
if (panel_type_context_poll(region, panel->type, context)) {
|
||||
sort_index->panel = panel;
|
||||
sort_index++;
|
||||
|
@ -524,7 +524,7 @@ static bool panel_set_expand_from_list_data_recursive(Panel *panel, short flag,
|
|||
static void panel_set_expansion_from_list_data(const bContext *C, Panel *panel)
|
||||
{
|
||||
BLI_assert(panel->type != NULL);
|
||||
BLI_assert(panel->type->flag & PNL_INSTANCED);
|
||||
BLI_assert(panel->type->flag & PANEL_TYPE_INSTANCED);
|
||||
if (panel->type->get_list_data_expand_flag == NULL) {
|
||||
/* Instanced panel doesn't support loading expansion. */
|
||||
return;
|
||||
|
@ -547,7 +547,7 @@ static void region_panels_set_expansion_from_list_data(const bContext *C, ARegio
|
|||
LISTBASE_FOREACH (Panel *, panel, ®ion->panels) {
|
||||
if (panel->runtime_flag & PANEL_ACTIVE) {
|
||||
PanelType *panel_type = panel->type;
|
||||
if (panel_type != NULL && panel->type->flag & PNL_INSTANCED) {
|
||||
if (panel_type != NULL && panel->type->flag & PANEL_TYPE_INSTANCED) {
|
||||
panel_set_expansion_from_list_data(C, panel);
|
||||
}
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r
|
|||
}
|
||||
|
||||
/* Check for #PANEL_ACTIVE so we only set the expand flag for active panels. */
|
||||
if (panel_type->flag & PNL_INSTANCED && panel->runtime_flag & PANEL_ACTIVE) {
|
||||
if (panel_type->flag & PANEL_TYPE_INSTANCED && panel->runtime_flag & PANEL_ACTIVE) {
|
||||
short expand_flag;
|
||||
short flag_index = 0;
|
||||
get_panel_expand_flag(panel, &expand_flag, &flag_index);
|
||||
|
@ -636,7 +636,7 @@ static void panels_collapse_all(ARegion *region, const Panel *from_panel)
|
|||
PanelType *pt = panel->type;
|
||||
|
||||
/* Close panels with headers in the same context. */
|
||||
if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) {
|
||||
if (pt && from_pt && !(pt->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
if (!pt->context[0] || !from_pt->context[0] || STREQ(pt->context, from_pt->context)) {
|
||||
if ((panel->flag & PNL_PIN) || !category || !pt->category[0] ||
|
||||
STREQ(pt->category, category)) {
|
||||
|
@ -690,7 +690,7 @@ Panel *UI_panel_begin(
|
|||
panel->type = pt;
|
||||
BLI_strncpy(panel->panelname, idname, sizeof(panel->panelname));
|
||||
|
||||
if (pt->flag & PNL_DEFAULT_CLOSED) {
|
||||
if (pt->flag & PANEL_TYPE_DEFAULT_CLOSED) {
|
||||
panel->flag |= PNL_CLOSED;
|
||||
panel->runtime_flag |= PANEL_WAS_CLOSED;
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ static void panel_set_expansion_from_seach_filter_recursive(const bContext *C,
|
|||
{
|
||||
/* This has to run on inactive panels that may not have a type,
|
||||
* but we can prevent running on header-less panels in some cases. */
|
||||
if (panel->type == NULL || !(panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type == NULL || !(panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
SET_FLAG_FROM_TEST(panel->runtime_flag, use_search_closed, PANEL_USE_CLOSED_FROM_SEARCH);
|
||||
}
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ static void region_panels_remove_invisible_layouts(ARegion *region)
|
|||
bool UI_panel_is_closed(const Panel *panel)
|
||||
{
|
||||
/* Header-less panels can never be closed, otherwise they could disappear. */
|
||||
if (panel->type && panel->type->flag & PNL_NO_HEADER) {
|
||||
if (panel->type && panel->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
|
|||
* can't be dragged. This may be changed in future. */
|
||||
show_background);
|
||||
const int panel_col = is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK;
|
||||
const bool draw_box_style = (panel->type && panel->type->flag & PNL_DRAW_BOX);
|
||||
const bool draw_box_style = (panel->type && panel->type->flag & PANEL_TYPE_DRAW_BOX);
|
||||
|
||||
/* Use the theme for box widgets for box-style panels. */
|
||||
uiWidgetColors *box_wcol = NULL;
|
||||
|
@ -1122,7 +1122,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
|
|||
const uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type && (panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
if (show_background) {
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformThemeColor(panel_col);
|
||||
|
@ -1578,7 +1578,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
|||
|
||||
static int get_panel_size_y(const Panel *panel)
|
||||
{
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type && (panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
return panel->sizey;
|
||||
}
|
||||
|
||||
|
@ -1589,7 +1589,7 @@ static int get_panel_real_size_y(const Panel *panel)
|
|||
{
|
||||
const int sizey = UI_panel_is_closed(panel) ? 0 : panel->sizey;
|
||||
|
||||
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
|
||||
if (panel->type && (panel->type->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
return sizey;
|
||||
}
|
||||
|
||||
|
@ -1633,13 +1633,13 @@ static int find_highest_panel(const void *a, const void *b)
|
|||
|
||||
/* Stick uppermost header-less panels to the top of the region -
|
||||
* prevent them from being sorted (multiple header-less panels have to be sorted though). */
|
||||
if (panel_a->type->flag & PNL_NO_HEADER && panel_b->type->flag & PNL_NO_HEADER) {
|
||||
if (panel_a->type->flag & PANEL_TYPE_NO_HEADER && panel_b->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
/* Skip and check for `ofsy` and #Panel.sortorder below. */
|
||||
}
|
||||
if (panel_a->type->flag & PNL_NO_HEADER) {
|
||||
if (panel_a->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
return -1;
|
||||
}
|
||||
if (panel_b->type->flag & PNL_NO_HEADER) {
|
||||
if (panel_b->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ static bool uiAlignPanelStep(ARegion *region, const float factor, const bool dra
|
|||
const int region_offset_x = panel_region_offset_x_get(region);
|
||||
for (int i = 0; i < active_panels_len; i++) {
|
||||
PanelSort *ps = &panel_sort[i];
|
||||
const bool use_box = ps->panel->type->flag & PNL_DRAW_BOX;
|
||||
const bool use_box = ps->panel->type->flag & PANEL_TYPE_DRAW_BOX;
|
||||
ps->panel->runtime.region_ofsx = region_offset_x;
|
||||
ps->new_offset_x = region_offset_x + ((use_box) ? UI_PANEL_BOX_STYLE_MARGIN : 0);
|
||||
}
|
||||
|
@ -1748,7 +1748,7 @@ static bool uiAlignPanelStep(ARegion *region, const float factor, const bool dra
|
|||
PanelSort *ps = &panel_sort[i];
|
||||
y -= get_panel_real_size_y(ps->panel);
|
||||
|
||||
const bool use_box = ps->panel->type->flag & PNL_DRAW_BOX;
|
||||
const bool use_box = ps->panel->type->flag & PANEL_TYPE_DRAW_BOX;
|
||||
if (use_box) {
|
||||
y -= UI_PANEL_BOX_STYLE_MARGIN;
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ static void ui_panel_drag_collapse(const bContext *C,
|
|||
float xy_b_block[2] = {UNPACK2(xy_dst)};
|
||||
Panel *panel = block->panel;
|
||||
|
||||
if (panel == NULL || (panel->type && (panel->type->flag & PNL_NO_HEADER))) {
|
||||
if (panel == NULL || (panel->type && (panel->type->flag & PANEL_TYPE_NO_HEADER))) {
|
||||
continue;
|
||||
}
|
||||
const int oldflag = panel->flag;
|
||||
|
@ -2102,7 +2102,7 @@ static void ui_handle_panel_header(const bContext *C,
|
|||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
BLI_assert(panel->type != NULL);
|
||||
BLI_assert(!(panel->type->flag & PNL_NO_HEADER));
|
||||
BLI_assert(!(panel->type->flag & PANEL_TYPE_NO_HEADER));
|
||||
|
||||
const bool is_subpanel = (panel->type->parent != NULL);
|
||||
const bool use_pin = UI_panel_category_is_visible(region) && !is_subpanel;
|
||||
|
@ -2401,7 +2401,7 @@ int ui_handler_panel_region(bContext *C,
|
|||
continue;
|
||||
}
|
||||
/* We can't expand or collapse panels without headers, they would disappear. */
|
||||
if (panel->type->flag & PNL_NO_HEADER) {
|
||||
if (panel->type->flag & PANEL_TYPE_NO_HEADER) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ static void hud_panels_register(ARegionType *art, int space_type, int region_typ
|
|||
pt->poll = hud_panel_operator_redo_poll;
|
||||
pt->space_type = space_type;
|
||||
pt->region_type = region_type;
|
||||
pt->flag |= PNL_DEFAULT_CLOSED;
|
||||
pt->flag |= PANEL_TYPE_DEFAULT_CLOSED;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
||||
|
|
|
@ -1931,7 +1931,7 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
}
|
||||
|
||||
/* Move to the next instanced panel corresponding to the next modifier. */
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
panel = panel->next;
|
||||
BLI_assert(panel != NULL); /* There shouldn't be fewer panels than modifiers with UIs. */
|
||||
}
|
||||
|
@ -2096,7 +2096,7 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_
|
|||
}
|
||||
|
||||
/* Move to the next instanced panel corresponding to the next constraint. */
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
panel = panel->next;
|
||||
BLI_assert(panel != NULL); /* There shouldn't be fewer panels than constraint panels. */
|
||||
}
|
||||
|
@ -2166,7 +2166,7 @@ void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
}
|
||||
|
||||
/* Move to the next instanced panel corresponding to the next modifier. */
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
panel = panel->next;
|
||||
BLI_assert(panel != NULL); /* There shouldn't be fewer panels than modifiers with UIs. */
|
||||
}
|
||||
|
@ -2237,7 +2237,7 @@ void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C)
|
|||
}
|
||||
|
||||
/* Move to the next instanced panel corresponding to the next modifier. */
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
while ((panel->type == NULL) || !(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
panel = panel->next;
|
||||
BLI_assert(panel != NULL); /* There shouldn't be fewer panels than modifiers with UIs. */
|
||||
}
|
||||
|
|
|
@ -2631,7 +2631,7 @@ static void ed_panel_draw(const bContext *C,
|
|||
int headerend = w - UI_UNIT_X;
|
||||
|
||||
UI_panel_header_buttons_begin(panel);
|
||||
if (pt->draw_header_preset && !(pt->flag & PNL_NO_HEADER)) {
|
||||
if (pt->draw_header_preset && !(pt->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
/* for preset menu */
|
||||
panel->layout = UI_block_layout(block,
|
||||
UI_LAYOUT_HORIZONTAL,
|
||||
|
@ -2651,12 +2651,12 @@ static void ed_panel_draw(const bContext *C,
|
|||
panel->layout = NULL;
|
||||
}
|
||||
|
||||
if (pt->draw_header && !(pt->flag & PNL_NO_HEADER)) {
|
||||
if (pt->draw_header && !(pt->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
int labelx, labely;
|
||||
UI_panel_label_offset(block, &labelx, &labely);
|
||||
|
||||
/* Unusual case: Use expanding layout (buttons stretch to available width). */
|
||||
if (pt->flag & PNL_LAYOUT_HEADER_EXPAND) {
|
||||
if (pt->flag & PANEL_TYPE_HEADER_EXPAND) {
|
||||
uiLayout *layout = UI_block_layout(block,
|
||||
UI_LAYOUT_VERTICAL,
|
||||
UI_LAYOUT_PANEL,
|
||||
|
@ -2690,7 +2690,7 @@ static void ed_panel_draw(const bContext *C,
|
|||
short panelContext;
|
||||
|
||||
/* panel context can either be toolbar region or normal panels region */
|
||||
if (pt->flag & PNL_LAYOUT_VERT_BAR) {
|
||||
if (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) {
|
||||
panelContext = UI_LAYOUT_VERT_BAR;
|
||||
}
|
||||
else if (region->regiontype == RGN_TYPE_TOOLS) {
|
||||
|
@ -2700,16 +2700,16 @@ static void ed_panel_draw(const bContext *C,
|
|||
panelContext = UI_LAYOUT_PANEL;
|
||||
}
|
||||
|
||||
panel->layout = UI_block_layout(block,
|
||||
UI_LAYOUT_VERTICAL,
|
||||
panelContext,
|
||||
(pt->flag & PNL_LAYOUT_VERT_BAR) ? 0 : style->panelspace,
|
||||
0,
|
||||
(pt->flag & PNL_LAYOUT_VERT_BAR) ? 0 :
|
||||
w - 2 * style->panelspace,
|
||||
em,
|
||||
0,
|
||||
style);
|
||||
panel->layout = UI_block_layout(
|
||||
block,
|
||||
UI_LAYOUT_VERTICAL,
|
||||
panelContext,
|
||||
(pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace,
|
||||
0,
|
||||
(pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : w - 2 * style->panelspace,
|
||||
em,
|
||||
0,
|
||||
style);
|
||||
|
||||
pt->draw(C, panel);
|
||||
|
||||
|
@ -2888,7 +2888,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
|||
for (LinkNode *pt_link = panel_types_stack; pt_link; pt_link = pt_link->next) {
|
||||
PanelType *pt = pt_link->link;
|
||||
|
||||
if (pt->flag & PNL_INSTANCED) {
|
||||
if (pt->flag & PANEL_TYPE_INSTANCED) {
|
||||
has_instanced_panel = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -2910,7 +2910,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
|||
®ion->panels,
|
||||
pt,
|
||||
panel,
|
||||
(pt->flag & PNL_DRAW_BOX) ? w_box_panel : w,
|
||||
(pt->flag & PANEL_TYPE_DRAW_BOX) ? w_box_panel : w,
|
||||
em,
|
||||
NULL,
|
||||
search_filter);
|
||||
|
@ -2922,7 +2922,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
|||
if (panel->type == NULL) {
|
||||
continue; /* Some panels don't have a type. */
|
||||
}
|
||||
if (!(panel->type->flag & PNL_INSTANCED)) {
|
||||
if (!(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
continue;
|
||||
}
|
||||
if (use_category_tabs && panel->type->category[0] &&
|
||||
|
@ -2944,7 +2944,7 @@ void ED_region_panels_layout_ex(const bContext *C,
|
|||
®ion->panels,
|
||||
panel->type,
|
||||
panel,
|
||||
(panel->type->flag & PNL_DRAW_BOX) ? w_box_panel : w,
|
||||
(panel->type->flag & PANEL_TYPE_DRAW_BOX) ? w_box_panel : w,
|
||||
em,
|
||||
unique_panel_str,
|
||||
search_filter);
|
||||
|
@ -3165,7 +3165,7 @@ bool ED_region_property_search(const bContext *C,
|
|||
for (LinkNode *pt_link = panel_types_stack; pt_link; pt_link = pt_link->next) {
|
||||
PanelType *panel_type = pt_link->link;
|
||||
/* Note that these checks are duplicated from #ED_region_panels_layout_ex. */
|
||||
if (panel_type->flag & PNL_INSTANCED) {
|
||||
if (panel_type->flag & PANEL_TYPE_INSTANCED) {
|
||||
has_instanced_panel = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -3188,7 +3188,7 @@ bool ED_region_property_search(const bContext *C,
|
|||
if (!has_result && has_instanced_panel) {
|
||||
LISTBASE_FOREACH (Panel *, panel, ®ion->panels) {
|
||||
/* Note that these checks are duplicated from #ED_region_panels_layout_ex. */
|
||||
if (panel->type == NULL || !(panel->type->flag & PNL_INSTANCED)) {
|
||||
if (panel->type == NULL || !(panel->type->flag & PANEL_TYPE_INSTANCED)) {
|
||||
continue;
|
||||
}
|
||||
if (use_category_tabs) {
|
||||
|
|
|
@ -1216,7 +1216,7 @@ void buttons_context_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->poll = buttons_panel_context_poll;
|
||||
pt->draw = buttons_panel_context_draw;
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->flag = PANEL_TYPE_NO_HEADER;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
||||
|
|
|
@ -609,7 +609,7 @@ static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *reg
|
|||
static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
LISTBASE_FOREACH (PanelType *, pt, ®ion->type->paneltypes) {
|
||||
pt->flag |= PNL_LAYOUT_VERT_BAR;
|
||||
pt->flag |= PANEL_TYPE_LAYOUT_VERT_BAR;
|
||||
}
|
||||
|
||||
ED_region_panels_layout(C, region);
|
||||
|
|
|
@ -95,7 +95,7 @@ void ED_clip_buttons_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->poll = metadata_panel_context_poll;
|
||||
pt->draw = metadata_panel_context_draw;
|
||||
pt->flag |= PNL_DEFAULT_CLOSED;
|
||||
pt->flag |= PANEL_TYPE_DEFAULT_CLOSED;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ void file_tool_props_region_panels_register(ARegionType *art)
|
|||
strcpy(pt->idname, "FILE_PT_operator");
|
||||
strcpy(pt->label, N_("Operator"));
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->flag = PANEL_TYPE_NO_HEADER;
|
||||
pt->poll = file_panel_operator_poll;
|
||||
pt->draw_header = file_panel_operator_header;
|
||||
pt->draw = file_panel_operator;
|
||||
|
@ -217,7 +217,7 @@ void file_execute_region_panels_register(ARegionType *art)
|
|||
strcpy(pt->idname, "FILE_PT_execution_buttons");
|
||||
strcpy(pt->label, N_("Execute Buttons"));
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->flag = PANEL_TYPE_NO_HEADER;
|
||||
pt->poll = file_panel_operator_poll;
|
||||
pt->draw = file_panel_execution_buttons_draw;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
|
|
@ -1320,6 +1320,6 @@ void image_buttons_register(ARegionType *art)
|
|||
pt->order = 10;
|
||||
pt->poll = metadata_panel_context_poll;
|
||||
pt->draw = metadata_panel_context_draw;
|
||||
pt->flag |= PNL_DEFAULT_CLOSED;
|
||||
pt->flag |= PANEL_TYPE_DEFAULT_CLOSED;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
|
|
@ -588,7 +588,7 @@ void nla_buttons_register(ARegionType *art)
|
|||
strcpy(pt->label, N_("Animation Data"));
|
||||
strcpy(pt->category, "Edited Action");
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->flag = PANEL_TYPE_NO_HEADER;
|
||||
pt->draw = nla_panel_animdata;
|
||||
pt->poll = nla_animdata_panel_poll;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
@ -598,7 +598,7 @@ void nla_buttons_register(ARegionType *art)
|
|||
strcpy(pt->label, N_("Active Strip Name"));
|
||||
strcpy(pt->category, "Strip");
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->flag = PANEL_TYPE_NO_HEADER;
|
||||
pt->draw = nla_panel_stripname;
|
||||
pt->poll = nla_strip_panel_poll;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
@ -618,7 +618,7 @@ void nla_buttons_register(ARegionType *art)
|
|||
strcpy(pt->category, "Strip");
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw = nla_panel_actclip;
|
||||
pt->flag = PNL_DEFAULT_CLOSED;
|
||||
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->poll = nla_strip_actclip_panel_poll;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
|
@ -631,7 +631,7 @@ void nla_buttons_register(ARegionType *art)
|
|||
pt->draw = nla_panel_evaluation;
|
||||
pt->draw_header = nla_panel_animated_influence_header;
|
||||
pt->parent = pt_properties;
|
||||
pt->flag = PNL_DEFAULT_CLOSED;
|
||||
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->poll = nla_strip_eval_panel_poll;
|
||||
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
@ -645,7 +645,7 @@ void nla_buttons_register(ARegionType *art)
|
|||
pt->draw = nla_panel_animated_strip_time;
|
||||
pt->draw_header = nla_panel_animated_strip_time_header;
|
||||
pt->parent = pt_properties;
|
||||
pt->flag = PNL_DEFAULT_CLOSED;
|
||||
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->poll = nla_strip_eval_panel_poll;
|
||||
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
|
|
@ -214,7 +214,7 @@ void node_buttons_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw = node_sockets_panel;
|
||||
pt->poll = node_sockets_poll;
|
||||
pt->flag |= PNL_DEFAULT_CLOSED;
|
||||
pt->flag |= PANEL_TYPE_DEFAULT_CLOSED;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype node panel tree interface");
|
||||
|
|
|
@ -118,7 +118,7 @@ void sequencer_buttons_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->poll = metadata_panel_context_poll;
|
||||
pt->draw = metadata_panel_context_draw;
|
||||
pt->flag |= PNL_DEFAULT_CLOSED;
|
||||
pt->flag |= PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->order = 10;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ PanelType *gpencil_modifier_panel_register(ARegionType *region_type,
|
|||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* modifier rather than a #PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->flag = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED;
|
||||
panel_type->reorder = gpencil_modifier_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_gpencil_modifier_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_gpencil_modifier_expand_flag;
|
||||
|
@ -420,7 +420,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
|
|||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = gpencil_modifier_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
panel_type->flag = (PANEL_TYPE_DEFAULT_CLOSED | PANEL_TYPE_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
|
|
|
@ -376,7 +376,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
|||
|
||||
for (; pt_iter; pt_iter = pt_iter->prev) {
|
||||
/* No header has priority. */
|
||||
if ((pt->flag & PNL_NO_HEADER) && !(pt_iter->flag & PNL_NO_HEADER)) {
|
||||
if ((pt->flag & PANEL_TYPE_NO_HEADER) && !(pt_iter->flag & PANEL_TYPE_NO_HEADER)) {
|
||||
continue;
|
||||
}
|
||||
if (pt_iter->order <= pt->order) {
|
||||
|
@ -1300,29 +1300,29 @@ static void rna_def_panel(BlenderRNA *brna)
|
|||
FunctionRNA *func;
|
||||
|
||||
static const EnumPropertyItem panel_flag_items[] = {
|
||||
{PNL_DEFAULT_CLOSED,
|
||||
{PANEL_TYPE_DEFAULT_CLOSED,
|
||||
"DEFAULT_CLOSED",
|
||||
0,
|
||||
"Default Closed",
|
||||
"Defines if the panel has to be open or collapsed at the time of its creation"},
|
||||
{PNL_NO_HEADER,
|
||||
{PANEL_TYPE_NO_HEADER,
|
||||
"HIDE_HEADER",
|
||||
0,
|
||||
"Hide Header",
|
||||
"If set to False, the panel shows a header, which contains a clickable "
|
||||
"arrow to collapse the panel and the label (see bl_label)"},
|
||||
{PNL_INSTANCED,
|
||||
{PANEL_TYPE_INSTANCED,
|
||||
"INSTANCED",
|
||||
0,
|
||||
"Instanced Panel",
|
||||
"Multiple panels with this type can be used as part of a list depending on data external "
|
||||
"to the UI. Used to create panels for the modifiers and other stacks"},
|
||||
{PNL_LAYOUT_HEADER_EXPAND,
|
||||
{PANEL_TYPE_HEADER_EXPAND,
|
||||
"HEADER_LAYOUT_EXPAND",
|
||||
0,
|
||||
"Expand Header Layout",
|
||||
"Allow buttons in the header to stretch and shrink to fill the entire layout width"},
|
||||
{PNL_DRAW_BOX, "DRAW_BOX", 0, "Box Style", "Draw panel with the box widget theme"},
|
||||
{PANEL_TYPE_DRAW_BOX, "DRAW_BOX", 0, "Box Style", "Draw panel with the box widget theme"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type,
|
|||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* modifier rather than a #PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->flag = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED;
|
||||
panel_type->reorder = modifier_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_modifier_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_modifier_expand_flag;
|
||||
|
@ -453,7 +453,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type,
|
|||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = modifier_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
panel_type->flag = (PANEL_TYPE_DEFAULT_CLOSED | PANEL_TYPE_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
|
|
|
@ -203,7 +203,7 @@ PanelType *shaderfx_panel_register(ARegionType *region_type, ShaderFxType type,
|
|||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* shader effect rather than a PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->flag = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED;
|
||||
panel_type->reorder = shaderfx_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_shaderfx_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_shaderfx_expand_flag;
|
||||
|
@ -240,7 +240,7 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type,
|
|||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = shaderfx_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
panel_type->flag = (PANEL_TYPE_DEFAULT_CLOSED | PANEL_TYPE_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
|
|
Loading…
Reference in New Issue