diff options
author | Hans Goudey <h.goudey@me.com> | 2020-12-01 01:43:14 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-12-02 18:44:40 +0300 |
commit | 3d0c5455edf4e32e6e8120b280710cb4b531e38a (patch) | |
tree | d55cdaa779698bdf4b856221a8f826bbf43e2ce4 | |
parent | 9281a1f4ebcbbc9ebeb1f11a9f68e45fb2dff5f1 (diff) |
Cleanup: Store "is_active" instead of pointer property in panel type
This is consistent with the way other panel type fields are stored.
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 7 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_ui_common.c | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index dea9884f508..473a684eaba 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -234,6 +234,8 @@ typedef struct PanelType { char category[BKE_ST_MAXNAME]; /* for category tabs */ char owner_id[BKE_ST_MAXNAME]; /* for work-spaces to selectively show. */ char parent_id[BKE_ST_MAXNAME]; /* parent idname for sub-panels */ + /** Boolean property identifier of the panel custom data. Used to draw a highlighted border. */ + char active_property[BKE_ST_MAXNAME]; short space_type; short region_type; /* For popovers, 0 for default. */ @@ -251,11 +253,6 @@ typedef struct PanelType { /* draw entirely, view changes should be handled here */ void (*draw)(const struct bContext *C, struct Panel *panel); - /** - * Identifier of a boolean property of the panel custom data. Used to draw a highlighted border. - */ - const char *active_property; - /* For instanced panels corresponding to a list: */ /** Reorder function, called when drag and drop finishes. */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d1e5bbcb536..b60fa40f39a 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -589,7 +589,7 @@ static bool panel_use_active_highlight(const Panel *panel) BLI_assert(UI_panel_is_active(panel)); BLI_assert(panel->type != NULL); - if (panel->type->active_property) { + if (panel->type->active_property[0] != '\0') { PointerRNA *ptr = UI_panel_custom_data_get(panel); if (ptr != NULL && !RNA_pointer_is_null(ptr)) { return RNA_boolean_get(ptr, panel->type->active_property); diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index 166d77624e8..fa5243c548f 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -409,6 +409,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, BLI_strncpy(panel_type->label, "", BKE_ST_MAXNAME); BLI_strncpy(panel_type->context, "modifier", BKE_ST_MAXNAME); BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); + BLI_strncpy(panel_type->active_property, "is_active", BKE_ST_MAXNAME); panel_type->draw_header = modifier_panel_header; panel_type->draw = draw; @@ -417,7 +418,6 @@ 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 = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED; - panel_type->active_property = "is_active"; 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; |