[Bf-blender-cvs] [ba188e72189] master: UI: Remove unecessary panel_free_block function

Hans Goudey noreply at git.blender.org
Wed Sep 2 00:29:52 CEST 2020


Commit: ba188e7218994c250c30040670fb96e70f91dc80
Author: Hans Goudey
Date:   Tue Sep 1 17:29:17 2020 -0500
Branches: master
https://developer.blender.org/rBba188e7218994c250c30040670fb96e70f91dc80

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.

===================================================================

M	source/blender/editors/interface/interface_panel.c

===================================================================

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index ade77e96bf9..bc38e177cea 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -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, &region->uiblocks) {
-    if (STREQ(block->name, block_name)) {
-      BLI_remlink(&region->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);



More information about the Bf-blender-cvs mailing list