[Bf-blender-cvs] [770cc66f756] master: UI: Avoid redundant loops in region panel handler
Hans Goudey
noreply at git.blender.org
Thu Aug 27 21:36:21 CEST 2020
Commit: 770cc66f75628d832fc3c3bff62057c7e9bd751a
Author: Hans Goudey
Date: Thu Aug 27 14:36:01 2020 -0500
Branches: master
https://developer.blender.org/rB770cc66f75628d832fc3c3bff62057c7e9bd751a
UI: Avoid redundant loops in region panel handler
Currently the panel handler loops through every block and every button
for every single panel. This commit moves that check to happen a single
time at the beginning.
===================================================================
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 fe8e2eabea1..c49b61c53b7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -2388,6 +2388,8 @@ int ui_handler_panel_region(bContext *C,
return retval;
}
+ const bool region_has_active_button = (ui_region_find_active_but(region) != NULL);
+
LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
Panel *panel = block->panel;
if (panel == NULL || panel->type == NULL) {
@@ -2402,7 +2404,7 @@ int ui_handler_panel_region(bContext *C,
int my = event->y;
ui_window_to_block(region, block, &mx, &my);
- uiPanelMouseState mouse_state = ui_panel_mouse_state_get(block, panel, mx, my);
+ const uiPanelMouseState mouse_state = ui_panel_mouse_state_get(block, panel, mx, my);
/* The panel collapse / expand key "A" is special as it takes priority over
* active button handling. */
@@ -2415,7 +2417,7 @@ int ui_handler_panel_region(bContext *C,
}
/* Don't do any other panel handling with an active button. */
- if (ui_region_find_active_but(region) != NULL) {
+ if (region_has_active_button) {
continue;
}
More information about the Bf-blender-cvs
mailing list