[Bf-blender-cvs] [26564ff] master: Event system: Let event pass through after menu poll fails

Julian Eisel noreply at git.blender.org
Sat Apr 23 17:24:29 CEST 2016


Commit: 26564ff3430d1d8b199c09192c3078071552788e
Author: Julian Eisel
Date:   Sat Apr 23 16:49:34 2016 +0200
Branches: master
https://developer.blender.org/rB26564ff3430d1d8b199c09192c3078071552788e

Event system: Let event pass through after menu poll fails

Part 2 of Fix for T48200. Without this, it's not possible to exit GPencil edit mode using tab key with pies enabled.

Menus are somehow similar to operators, which let the event pass through too after operator poll returns 0. So think we should handle them similar here.
Can't guarantee this is totally safe though ;)

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

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

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

diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index b3972be..9e49d7e 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -3006,7 +3006,8 @@ int UI_pie_menu_invoke(struct bContext *C, const char *idname, const wmEvent *ev
 	}
 
 	if (mt->poll && mt->poll(C, mt) == 0)
-		return OPERATOR_CANCELLED;
+		/* cancel but allow event to pass through, just like operators do */
+		return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
 
 	pie = UI_pie_menu_begin(C, IFACE_(mt->label), ICON_NONE, event);
 	layout = UI_pie_menu_layout(pie);
@@ -3237,7 +3238,8 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports)
 	}
 
 	if (mt->poll && mt->poll(C, mt) == 0)
-		return OPERATOR_CANCELLED;
+		/* cancel but allow event to pass through, just like operators do */
+		return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
 
 	pup = UI_popup_menu_begin(C, IFACE_(mt->label), ICON_NONE);
 	layout = UI_popup_menu_layout(pup);




More information about the Bf-blender-cvs mailing list