UI: Remove unecessary panel_free_block function
This function was called when the modifier list changes and the panel list has to be rebuilt. Originally I thought it was necessary to to remove the block immediately when the panel was removed, but we can just leave it and it will be removed later in the UI drawing process. Removing this results in fewer string lookups.
This commit is contained in:
parent
f6ab6dd91a
commit
ba188e7218
|
@ -287,29 +287,6 @@ void UI_list_panel_unique_str(Panel *panel, char *r_name)
|
|||
snprintf(r_name, LIST_PANEL_UNIQUE_STR_LEN, "%d", panel->runtime.list_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the #uiBlock corresponding to a panel. The lookup is needed because panels don't store
|
||||
* a reference to their corresponding #uiBlock.
|
||||
*/
|
||||
static void panel_free_block(const bContext *C, ARegion *region, Panel *panel)
|
||||
{
|
||||
BLI_assert(panel->type);
|
||||
|
||||
char block_name[BKE_ST_MAXNAME + LIST_PANEL_UNIQUE_STR_LEN];
|
||||
strncpy(block_name, panel->type->idname, BKE_ST_MAXNAME);
|
||||
char unique_panel_str[LIST_PANEL_UNIQUE_STR_LEN];
|
||||
UI_list_panel_unique_str(panel, unique_panel_str);
|
||||
strncat(block_name, unique_panel_str, LIST_PANEL_UNIQUE_STR_LEN);
|
||||
|
||||
LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
|
||||
if (STREQ(block->name, block_name)) {
|
||||
BLI_remlink(®ion->uiblocks, block);
|
||||
UI_block_free(C, block);
|
||||
break; /* Only delete one block for this panel. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a panel and it's children. Custom data is shared by the panel and its children
|
||||
* and is freed by #UI_panels_free_instanced.
|
||||
|
@ -325,8 +302,6 @@ static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, P
|
|||
}
|
||||
BLI_freelistN(&panel->children);
|
||||
|
||||
panel_free_block(C, region, panel);
|
||||
|
||||
BLI_remlink(panels, panel);
|
||||
if (panel->activedata) {
|
||||
MEM_freeN(panel->activedata);
|
||||
|
|
Loading…
Reference in New Issue