Commit: 8eb5aa1c355736e1f1e53dbfd93dbf37238221c5
Author: Antony Riakiotakis
Date:   Fri Jun 20 04:11:43 2014 +0300
https://developer.blender.org/rB8eb5aa1c355736e1f1e53dbfd93dbf37238221c5

Fix recursive menus respawning on selection

Fix here is a bit hacky, we do not draw the menu and we simply await for
key release to stop the handler, or else the pie menu gets respawned
immediately.

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

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

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

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index c16abca..0e8ff0a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1278,6 +1278,10 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
        rcti rect;
        int multisample_enabled;
        
+       /* early exit if cancelled */
+       if (block->flag & UI_BLOCK_RADIAL && block->pie_data.flags & 
UI_PIE_CANCELLED)
+               return;
+
        /* get menu region or area region */
        ar = CTX_wm_menu(C);
        if (!ar)
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index cae0a38..0fad988 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8308,9 +8308,15 @@ static int ui_handle_menu_return_submenu(bContext *C, 
const wmEvent *event, uiPo
                ui_mouse_motion_towards_reinit(menu, &event->x);
        }
 
-       if (menu->menuretval)
+       if (menu->menuretval) {
+               /* pie menus should not close but wait for release instead */
+               if (block->flag & UI_BLOCK_RADIAL) {
+                       menu->menuretval = 0;
+                       block->pie_data.flags |= UI_PIE_CANCELLED;
+               }
+
                return WM_UI_HANDLER_CONTINUE;
-       else
+       } else
                return WM_UI_HANDLER_BREAK;
 }
 
@@ -8395,6 +8401,14 @@ static int ui_handler_pie(bContext *C, const wmEvent 
*event, uiPopupBlockHandle
 
        ui_block_calculate_pie_segment(block, mx, my);
 
+       if (block->pie_data.flags & UI_PIE_CANCELLED) {
+               if (event->type == block->pie_data.event && event->val == 
KM_RELEASE) {
+                       menu->menuretval = UI_RETURN_OK;
+               }
+
+               return WM_UI_HANDLER_BREAK;
+       }
+
        if (event->type == block->pie_data.event) {
                if (event->val != KM_RELEASE) {
                        ui_handle_menu_button(C, event, menu);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to