diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-28 06:26:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-28 06:36:43 +0300 |
commit | 2e22cfd08a0d589e8894e322ed29d5c3227ca04d (patch) | |
tree | 1dea3f566ce6ee8bdefaa5ca78cec1844662d2b8 /source/blender/editors/space_view3d/view3d_gizmo_navigate.c | |
parent | 219e6a98c66a00673395d5c420ff35ad86eef846 (diff) |
Gizmo: changes to internal drag logic
Minor changes to recent gizmo click/drag logic 08dff7b40bc6a
Changing the gizmos highlighted part in the invoke_prepare
callback is too error prone since it needs to run
before it's known which operator will execute.
Add back 'drag_part', since it simplifies click-drag use.
While this isn't essential with custom keymaps per gizmo
it avoids having to define a keymap in the case a drag
event needs a different action.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_navigate.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_navigate.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c index ef4d0683818..40c13e21cc7 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c @@ -225,33 +225,17 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, wmGizmoGroup *gzgroup) PointerRNA *ptr = WM_gizmo_operator_set(gz, part_index + 1, ot_view_axis, NULL); RNA_enum_set(ptr, "type", mapping[part_index]); } - } - { + /* When dragging an axis, use this instead. */ wmWindowManager *wm = CTX_wm_manager(C); - wmGizmo *gz = navgroup->gz_array[GZ_INDEX_ROTATE]; gz->keymap = WM_keymap_ensure( wm->defaultconf, "Generic Gizmos Click Drag", SPACE_EMPTY, RGN_TYPE_WINDOW); + gz->drag_part = 0; } gzgroup->customdata = navgroup; } -static void WIDGETGROUP_navigate_invoke_prepare(const bContext *UNUSED(C), - wmGizmoGroup *gzgroup, - wmGizmo *gz, - const wmEvent *event) -{ - struct NavigateWidgetGroup *navgroup = gzgroup->customdata; - wmGizmo *gz_rotate = navgroup->gz_array[GZ_INDEX_ROTATE]; - if (gz_rotate == gz) { - if (ISTWEAK(event->type)) { - /* When dragging an axis, use this instead. */ - gz->highlight_part = 0; - } - } -} - static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup) { struct NavigateWidgetGroup *navgroup = gzgroup->customdata; @@ -345,7 +329,6 @@ void VIEW3D_GGT_navigate(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_navigate_poll; gzgt->setup = WIDGETGROUP_navigate_setup; - gzgt->invoke_prepare = WIDGETGROUP_navigate_invoke_prepare; gzgt->draw_prepare = WIDGETGROUP_navigate_draw_prepare; } |