Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-27 19:14:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-27 19:41:59 +0300
commit08dff7b40bc6a93b4826f6abf8bdc2b9a8bae12e (patch)
treeac9b0c79c0d0b352822287627e2e80c3b2b88f8f /source/blender/editors/space_view3d/view3d_gizmo_navigate.c
parentd83d376c02412b14dd16493ea09ac77a27a9ca30 (diff)
Gizmo: add per gizmo keymaps
Remove click-drag support for tweak gizmo, rely on keymap events instead. This is needed for some gizmos to use modifiers keys without having all gizmos use all modifier keys (see: T63996).
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_navigate.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 5af6fd8b04b..ef4d0683818 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -131,7 +131,7 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
return true;
}
-static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
+static void WIDGETGROUP_navigate_setup(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NavigateWidgetGroup *navgroup = MEM_callocN(sizeof(struct NavigateWidgetGroup), __func__);
@@ -225,14 +225,33 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
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. */
- gz->drag_part = 0;
+ {
+ 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);
}
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;
@@ -326,6 +345,7 @@ 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;
}