Event system, check which ui elements the events belong to


I am currently trying to find the code I have to edit to resolve a papercut (https://developer.blender.org/T58072). I put a few breakpoints in gizmo-related files, watched the call history, and tried to understand what each function does. Now, since the problem is event related (I have to edit when the gizmo arrows or the gizmo circle should get invoked), I tried to find the final event evaluation code section (like 'ok, we narrowed down the event to be in the 3d view [seems to happen in wm_event_do_handlers] and now we want to look which widget the mouse is on, or gizmo, or 3d object, and then even which operator we have to invoke). I can’t find the section though. This is my current call list:

1. blender.exe!gizmo_tweak_invoke(bContext * C, wmOperator * op, const wmEvent * event) Zeile 536   C

2. blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Zeile 1343    C

3. blender.exe!wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties) Zeile 2144 C

4. blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Zeile 2623    C

5. blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Zeile 2720   C

6. blender.exe!wm_event_do_handlers(bContext * C) Zeile 3141   C

7. blender.exe!WM_main(bContext * C) Zeile 421 C

8. blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Zeile 507 C

But I miss the section i described. Can somebody please enlighten me?

The gizmo transforming is setup in:

@ideasman42 correct me if I’m wrong, but in that file events aren’t actually handled, right? I found a function that sets the arrow start and length, I found draw functions, I found functions to invoke the gizmo, but I didn’t find the function that looks at the event and decides whether the mouse cursor is hovering over the arrows or the center circle. In my case, I can’t just alter the arrows length, but I have to tell the event system to not invoke the axis constrained (arrow) move, but the freeform move, if the mouse is over the circle.

Highlighting uses the drawing code, so I don’t think you would make a change in event handling (see wm_gizmomap_highlight_find if you’re interested to check it out anyway).

The gizmo used in this case is GIZMO_GT_dial_3d, I think the solution in this case would be to enable it’s FILL option (which would be done in transform_gizmo_3d.c).

If you want to tweak how this works regarding selection, see gizmo_dial_draw_select callback.

Thanks, that worked, fixed in https://developer.blender.org/D4523. Should I specify you as the reviewer?