[Bf-blender-cvs] [10e093b30d1] blender-v2.92-release: Fix T83539: 'activate_init' fails with buttons that have popups

Campbell Barton noreply at git.blender.org
Thu Jan 28 06:20:06 CET 2021


Commit: 10e093b30d17149008a10df3f52d39744577f17b
Author: Campbell Barton
Date:   Thu Jan 28 16:12:43 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rB10e093b30d17149008a10df3f52d39744577f17b

Fix T83539: 'activate_init' fails with buttons that have popups

Activating buttons was running too early, before the popup was
positioned on the screen,
causing data-selectors to be positioned incorrectly.

As the early button activation isn't needed, remove this call.

Ensure this doesn't happen again with an assert.

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

M	source/blender/editors/interface/interface.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e53dfa83867..5928a622298 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -988,6 +988,11 @@ bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBu
  */
 bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block)
 {
+
+  /* Running this command before end-block has run, means buttons that open menus
+   * wont have those menus correctly positioned, see T83539. */
+  BLI_assert(block->endblock != 0);
+
   bool done = false;
   LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
     if (but->flag & UI_BUT_ACTIVATE_ON_INIT) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 5a64b42a653..e82f6cc9d76 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1403,8 +1403,6 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *userD
   UI_block_bounds_set_popup(
       block, 6 * U.dpi_fac, (const int[2]){data->width / -2, data->height / 2});
 
-  UI_block_active_only_flagged_buttons(C, region, block);
-
   return block;
 }



More information about the Bf-blender-cvs mailing list