diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-02 22:13:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-02 22:13:26 +0300 |
commit | ba4a2a4c8b827201b18e97d9dd025ef93a4db754 (patch) | |
tree | a71d6b72aaf0616ebda671bf4b011880b49bb280 /source/blender/editors/include | |
parent | ff7d74235023d0c927c0ad3f4d72d1c5dd41b240 (diff) |
UI: Use instanced panel custom data instead of list index
For modifier shortcuts we added a "custom_data" field to panels.
This commit uses the same system for accessing the list data that
corresponds to each panel. This way the context is only used once
and the modifier for each panel can be accessed more easily later.
This ends up being mostly a cleanup commit with a few small changes
in interface_panel.c. The large changes in the UI functions are due
to the fact that the panel custom data is now passed around as a
single pointer instead of being created again for every panel.
The list_index variable in Panel.runtime is removed as it's now
unnecessary.
Differential Revision: https://developer.blender.org/D8559
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4fc537ca5c2..01e3dd22648 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1698,6 +1698,8 @@ void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_ struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname); +/* Panel custom data. */ +struct PointerRNA *UI_panel_custom_data_get(const struct Panel *panel); struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContext *C, const struct wmEvent *event); void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_data); @@ -1706,11 +1708,10 @@ void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_dat struct Panel *UI_panel_add_instanced(struct ARegion *region, struct ListBase *panels, char *panel_idname, - int list_index, struct PointerRNA *custom_data); void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region); -#define LIST_PANEL_UNIQUE_STR_LEN 4 +#define INSTANCED_PANEL_UNIQUE_STR_LEN 4 void UI_list_panel_unique_str(struct Panel *panel, char *r_name); void UI_panel_set_expand_from_list_data(const struct bContext *C, struct Panel *panel); |