[Bf-blender-cvs] [a284ac32130] modifier-panels-ui: Use PNL_ prefix for new panel type flags
Hans Goudey
noreply at git.blender.org
Mon Apr 13 22:01:03 CEST 2020
Commit: a284ac32130f06172524d36a8de125206df8677a
Author: Hans Goudey
Date: Mon Apr 13 15:00:53 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rBa284ac32130f06172524d36a8de125206df8677a
Use PNL_ prefix for new panel type flags
This prefix should be changed, but it's best to be consistent for now
===================================================================
M source/blender/editors/interface/interface_panel.c
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/screen/area.c
M source/blender/makesdna/DNA_screen_types.h
M source/blender/makesrna/intern/rna_ui.c
M source/blender/modifiers/intern/MOD_ui_common.c
===================================================================
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 37fe0fb5b1c..1cffc3d5b16 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -264,7 +264,7 @@ static void panel_set_expand_from_list_data_recursive(Panel *panel, short flag,
void UI_panel_set_expand_from_list_data(const bContext *C, Panel *panel)
{
BLI_assert(panel->type != NULL);
- BLI_assert(panel->type->flag & PANELTYPE_RECREATE);
+ BLI_assert(panel->type->flag & PNL_RECREATE);
short expand_flag = panel->type->get_list_data_expand_flag(C, panel);
short flag_index = 0;
@@ -305,7 +305,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, ARegion *region)
continue;
}
- if (panel->type->flag & PANELTYPE_RECREATE) {
+ if (panel->type->flag & PNL_RECREATE) {
short expand_flag;
short flag_index = 0;
get_panel_expand_flag(panel, &expand_flag, &flag_index);
@@ -569,14 +569,14 @@ Panel *UI_panel_add_recreate(
*
* We can the panel list is also the display order because the recreate panel list is rebuild
* when the order changes. */
- if (panel_type->flag & PANELTYPE_RECREATE) {
+ if (panel_type->flag & PNL_RECREATE) {
Panel *last_list_panel = NULL;
for (Panel *list_panel = panels->first; list_panel; list_panel = list_panel->next) {
if (list_panel->type == NULL) {
continue;
}
- if (list_panel->type->flag & (PANELTYPE_RECREATE_LIST_START | PANELTYPE_RECREATE)) {
+ if (list_panel->type->flag & (PNL_RECREATE_LIST_START | PNL_RECREATE)) {
last_list_panel = list_panel;
}
}
@@ -599,7 +599,7 @@ void UI_panel_set_list_index(Panel *panel, int i)
{
BLI_assert(panel->type != NULL);
if (panel->type->parent == NULL) {
- BLI_assert(panel->type->flag & PANELTYPE_RECREATE);
+ BLI_assert(panel->type->flag & PNL_RECREATE);
}
panel->runtime.list_index = i;
@@ -665,7 +665,7 @@ void UI_panels_free_recreate(ARegion *region)
while (panel != NULL) {
bool remove = false;
if (panel->type != NULL) { /* Some panels don't have a type.. */
- if (panel->type->flag & PANELTYPE_RECREATE) {
+ if (panel->type->flag & PNL_RECREATE) {
remove = true;
}
}
@@ -1352,7 +1352,7 @@ static void ui_panels_size(ScrArea *area, ARegion *region, int *r_x, int *r_y)
static void reorder_recreate_panel_list(bContext *C, ARegion *region, Panel *panel)
{
/* Only reorder the data for list recreate panels. */
- if (panel->type == NULL || !(panel->type->flag & PANELTYPE_RECREATE)) {
+ if (panel->type == NULL || !(panel->type->flag & PNL_RECREATE)) {
return;
}
/* Don't reorder if this recreate panel doesn't support drag and drop reordering. */
@@ -1367,7 +1367,7 @@ static void reorder_recreate_panel_list(bContext *C, ARegion *region, Panel *pan
for (Panel *list_panel = region->panels.first; list_panel; list_panel = list_panel->next) {
if (list_panel->type) {
if ((strcmp(list_panel->type->context, context) == 0)) {
- if (list_panel->type->flag & PANELTYPE_RECREATE) {
+ if (list_panel->type->flag & PNL_RECREATE) {
list_panels_len++;
}
}
@@ -1380,7 +1380,7 @@ static void reorder_recreate_panel_list(bContext *C, ARegion *region, Panel *pan
for (Panel *list_panel = region->panels.first; list_panel; list_panel = list_panel->next) {
if (list_panel->type) {
if ((strcmp(list_panel->type->context, context) == 0)) {
- if (list_panel->type->flag & PANELTYPE_RECREATE) {
+ if (list_panel->type->flag & PNL_RECREATE) {
sort_index->panel = MEM_dupallocN(list_panel);
sort_index->orig = list_panel;
sort_index++;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 85614b2c8c4..9f02e3f6ac8 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1843,7 +1843,7 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
ModifierData *md = ob->modifiers.first;
Panel *panel = region->panels.first;
while (panel != NULL) {
- if (panel->type != NULL && panel->type->flag & PANELTYPE_RECREATE) {
+ if (panel->type != NULL && panel->type->flag & PNL_RECREATE) {
/* The panels were reordered by drag and drop. */
if (panel->flag & PNL_RECREATE_ORDER_CHANGED) {
modifiers_changed = true;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 90dd1b51f32..71d577ba419 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2605,7 +2605,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 & PANELTYPE_RECREATE) {
+ if (pt->flag & PNL_RECREATE) {
has_recreate_panel = true;
continue;
}
@@ -2623,7 +2623,7 @@ void ED_region_panels_layout_ex(const bContext *C,
if (has_recreate_panel) {
for (Panel *panel = region->panels.first; panel; panel = panel->next) {
if (panel->type != NULL) { /* Some panels don't have a type.. */
- if (panel->type->flag & PANELTYPE_RECREATE) {
+ if (panel->type->flag & PNL_RECREATE) {
/* Use a unique identifier for recreate panels, otherwise an old block for a different
* panel of the same type might be found. */
char unique_panel_str[8];
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index cdfb31bbb6e..4005eb9bd1f 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -550,12 +550,10 @@ enum {
#define PNL_DEFAULT_CLOSED (1 << 0)
#define PNL_NO_HEADER (1 << 1)
#define PNL_LAYOUT_VERT_BAR (1 << 2)
-enum {
- /** Delete panel after drawing, don't search for panel by type. */
- PANELTYPE_RECREATE = (1 << 3),
- /** This panel marks the start of a recreate panel list. Not recreated on list change. */
- PANELTYPE_RECREATE_LIST_START = (1 << 4),
-};
+/** Delete panel after drawing, don't search for panel by type. */
+#define PNL_RECREATE (1 << 3)
+/** This panel marks the start of a recreate panel list. Not recreated on list change. */
+#define PNL_RECREATE_LIST_START (1 << 4)
/* Fallback panel category (only for old scripts which need updating) */
#define PNL_CATEGORY_FALLBACK "Misc"
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index bbc4ffff732..ddd2a9e50ff 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -1285,13 +1285,13 @@ static void rna_def_panel(BlenderRNA *brna)
"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)"},
- {PANELTYPE_RECREATE,
+ {PNL_RECREATE,
"RECREATE",
0,
"Recreate 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 modifier stack and other stacks."},
- {PANELTYPE_RECREATE_LIST_START,
+ {PNL_RECREATE_LIST_START,
"RECREATE_LIST_START",
0,
"Recreate List Start",
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index 139b6070920..56aff2737ea 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -342,7 +342,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, const char *name, P
/* Give the panel the special flag that says it was built here and corresponds to a
* modifer rather than a PanelType. */
- panel_type->flag = PANELTYPE_RECREATE;
+ panel_type->flag = PNL_RECREATE;
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;
More information about the Bf-blender-cvs
mailing list