[Bf-blender-cvs] [0609aee] master: Fix T41639, hierarchical pie menu - popup interaction is buggy.
Antony Riakiotakis
noreply at git.blender.org
Thu Oct 9 18:38:24 CEST 2014
Commit: 0609aee4db0da33dcdb404d8285b093b21325deb
Author: Antony Riakiotakis
Date: Thu Oct 9 18:37:54 2014 +0200
Branches: master
https://developer.blender.org/rB0609aee4db0da33dcdb404d8285b093b21325deb
Fix T41639, hierarchical pie menu - popup interaction is buggy.
Basically, this commit changes pie menu click interaction so that
confirmation is done on left click release instead of press. This allows
dragging on the pie menu to select different items, but most
importantly, there should be no left over click events passed on to
subsequent menus/pies. This means that pie menus should now be able to
spawn popups safely. Also, left clicking to spawn a second pie menu now
sets that menu to click style by default allowing for better interaction
between hierarhies of pie menus.
===================================================================
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/interface/interface_regions.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2af034c..2f9734f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8687,7 +8687,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
mul_v2_fl(vec, pie_radius);
add_v2_v2(vec, center);
- mul_v2_fl(vec, fac);
+ mul_v2_fl(vec, fac);
add_v2_v2(vec, block->pie_data.pie_center_spawned);
BLI_rctf_recenter(&but->rect, vec[0], vec[1]);
@@ -8718,7 +8718,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
return WM_UI_HANDLER_BREAK;
}
- if (event->type == block->pie_data.event) {
+ if (event->type == block->pie_data.event && !is_click_style) {
if (event->val != KM_RELEASE) {
ui_handle_menu_button(C, event, menu);
@@ -8734,7 +8734,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
block->pie_data.flags |= UI_PIE_CLICK_STYLE;
}
- else if (!is_click_style) {
+ else {
uiBut *but = ui_but_find_activated(menu->region);
retval = ui_but_pie_menu_apply(C, menu, but, true, is_click_style);
@@ -8747,7 +8747,8 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
switch (event->type) {
case MOUSEMOVE:
- if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) {
+ if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ &&
+ !is_click_style) {
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
ui_handle_menu_button(C, event, menu);
@@ -8757,7 +8758,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
break;
case LEFTMOUSE:
- if (event->val == KM_PRESS) {
+ if (event->val == KM_RELEASE) {
uiBut *but = ui_but_find_activated(menu->region);
retval = ui_but_pie_menu_apply(C, menu, but, false, is_click_style);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9b450b8..5739ebe 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2720,6 +2720,11 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const
pie->block_radial->flag |= UI_BLOCK_RADIAL;
pie->block_radial->pie_data.event = event->type;
+ /* if pie is spawned by a left click, it is always assumed to be click style */
+ if (event->type == LEFTMOUSE) {
+ pie->block_radial->flag |= UI_PIE_CLICK_STYLE;
+ }
+
pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
pie->mx = event->x;
pie->my = event->y;
More information about the Bf-blender-cvs
mailing list