From ba4a2a4c8b827201b18e97d9dd025ef93a4db754 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 2 Sep 2020 14:13:26 -0500 Subject: 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 --- source/blender/editors/screen/area.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/screen/area.c') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 921cc92299e..8ec58b4c75e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2564,11 +2564,11 @@ static void ed_panel_draw(const bContext *C, /* Draw panel. */ - char block_name[BKE_ST_MAXNAME + LIST_PANEL_UNIQUE_STR_LEN]; + char block_name[BKE_ST_MAXNAME + INSTANCED_PANEL_UNIQUE_STR_LEN]; strncpy(block_name, pt->idname, BKE_ST_MAXNAME); if (unique_panel_str != NULL) { /* Instanced panels should have already been added at this point. */ - strncat(block_name, unique_panel_str, LIST_PANEL_UNIQUE_STR_LEN); + strncat(block_name, unique_panel_str, INSTANCED_PANEL_UNIQUE_STR_LEN); } uiBlock *block = UI_block_begin(C, region, block_name, UI_EMBOSS); @@ -2837,7 +2837,7 @@ void ED_region_panels_layout_ex(const bContext *C, /* Use a unique identifier for instanced panels, otherwise an old block for a different * panel of the same type might be found. */ - char unique_panel_str[8]; + char unique_panel_str[INSTANCED_PANEL_UNIQUE_STR_LEN]; UI_list_panel_unique_str(panel, unique_panel_str); ed_panel_draw(C, region, -- cgit v1.2.3