[Bf-blender-cvs] [f417a717b1d] master: Gizmo: highlighted gizmo now handles all events first

Campbell Barton noreply at git.blender.org
Thu May 23 06:27:45 CEST 2019


Commit: f417a717b1d9c576276bee12c4646a97005a35bf
Author: Campbell Barton
Date:   Thu May 23 14:20:33 2019 +1000
Branches: master
https://developer.blender.org/rBf417a717b1d9c576276bee12c4646a97005a35bf

Gizmo: highlighted gizmo now handles all events first

Only mouse events were handled by the highlighted gizmo,
this allows more flexibility with event handling.

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

M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 0208ff14e9b..07d5f4b0d59 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2732,22 +2732,19 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
           }
         }
         else {
-          /* Either we operate on a single highlighted item
-           * or groups attached to the selected gizmos. */
+          /* Handle highlight gizmo. */
+          if (gz != NULL) {
+            wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+            wmKeyMap *keymap = WM_keymap_active(wm, gzgroup->type->keymap);
+            action |= wm_handlers_do_keymap_with_gizmo_handler(
+                C, event, handlers, handler, gzgroup, keymap, do_debug_handler);
+          }
 
-          wmGizmoGroup *gzgroup_highlight = gz ? gz->parent_gzgroup : NULL;
           /* Don't use from now on. */
           gz = NULL;
 
-          if (ISMOUSE(event->type)) {
-            if (gzgroup_highlight) {
-              wmGizmoGroup *gzgroup = gzgroup_highlight;
-              wmKeyMap *keymap = WM_keymap_active(wm, gzgroup->type->keymap);
-              action |= wm_handlers_do_keymap_with_gizmo_handler(
-                  C, event, handlers, handler, gzgroup, keymap, do_debug_handler);
-            }
-          }
-          else {
+          /* Fallback to selected gizmo (when un-handled). */
+          if ((action & WM_HANDLER_BREAK) == 0) {
             if (WM_gizmomap_is_any_selected(gzmap)) {
               const ListBase *groups = WM_gizmomap_group_list(gzmap);
               for (wmGizmoGroup *gzgroup = groups->first; gzgroup; gzgroup = gzgroup->next) {



More information about the Bf-blender-cvs mailing list