diff options
Diffstat (limited to 'source/blender')
12 files changed, 40 insertions, 18 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c index 2749eab0548..a1b01ed8d15 100644 --- a/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c +++ b/source/blender/editors/gizmo_library/gizmo_group_types/value2d_gizmo_group.c @@ -152,7 +152,7 @@ static void WM_GGT_value_operator_redo(wmGizmoGroupType *gzgt) gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW; gzgt->setup = WIDGETGROUP_value_operator_redo_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_value_operator_redo_refresh; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index d01bd9f29a8..66a56399883 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -461,7 +461,7 @@ static void IMAGE_GGT_gizmo2d(wmGizmoGroupType *gzgt) gzgt->poll = ED_widgetgroup_gizmo2d_poll; gzgt->setup = ED_widgetgroup_gizmo2d_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = ED_widgetgroup_gizmo2d_refresh; gzgt->draw_prepare = ED_widgetgroup_gizmo2d_draw_prepare; } diff --git a/source/blender/editors/space_node/node_gizmo.c b/source/blender/editors/space_node/node_gizmo.c index 4a929a660d9..76e8b5ca7df 100644 --- a/source/blender/editors/space_node/node_gizmo.c +++ b/source/blender/editors/space_node/node_gizmo.c @@ -190,7 +190,7 @@ void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_node_transform_poll; gzgt->setup = WIDGETGROUP_node_transform_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_node_transform_refresh; } @@ -411,7 +411,7 @@ void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_node_crop_poll; gzgt->setup = WIDGETGROUP_node_crop_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->draw_prepare = WIDGETGROUP_node_crop_draw_prepare; gzgt->refresh = WIDGETGROUP_node_crop_refresh; } @@ -516,7 +516,7 @@ void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_node_sbeam_poll; gzgt->setup = WIDGETGROUP_node_sbeam_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->draw_prepare = WIDGETGROUP_node_sbeam_draw_prepare; gzgt->refresh = WIDGETGROUP_node_sbeam_refresh; } @@ -637,7 +637,7 @@ void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_node_corner_pin_poll; gzgt->setup = WIDGETGROUP_node_corner_pin_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->draw_prepare = WIDGETGROUP_node_corner_pin_draw_prepare; gzgt->refresh = WIDGETGROUP_node_corner_pin_refresh; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c index b24b678cb7a..615589347da 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c @@ -220,7 +220,7 @@ void VIEW3D_GGT_armature_spline(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_armature_spline_poll; gzgt->setup = WIDGETGROUP_armature_spline_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_armature_spline_refresh; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c index 11a8988f83b..002a7e12515 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c @@ -315,7 +315,7 @@ void VIEW3D_GGT_camera(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_camera_poll; gzgt->setup = WIDGETGROUP_camera_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_camera_refresh; gzgt->message_subscribe = WIDGETGROUP_camera_message_subscribe; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c index a54d59b961f..b37f1e41294 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c @@ -200,7 +200,7 @@ void VIEW3D_GGT_empty_image(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_empty_image_poll; gzgt->setup = WIDGETGROUP_empty_image_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_empty_image_refresh; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c index 1c7c0284fe3..44ad1d14dba 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c @@ -117,7 +117,7 @@ void VIEW3D_GGT_force_field(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_forcefield_poll; gzgt->setup = WIDGETGROUP_forcefield_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_forcefield_refresh; } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c index 0338fe5bead..35677b2e4c2 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_light.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c @@ -114,7 +114,7 @@ void VIEW3D_GGT_light_spot(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_light_spot_poll; gzgt->setup = WIDGETGROUP_light_spot_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_light_spot_refresh; } @@ -231,7 +231,7 @@ void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_light_area_poll; gzgt->setup = WIDGETGROUP_light_area_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_light_area_refresh; } @@ -319,7 +319,7 @@ void VIEW3D_GGT_light_target(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_light_target_poll; gzgt->setup = WIDGETGROUP_light_target_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->draw_prepare = WIDGETGROUP_light_target_draw_prepare; } diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index eef57824d7a..f886a953490 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -1993,7 +1993,7 @@ void VIEW3D_GGT_xform_gizmo(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_gizmo_poll_tool; gzgt->setup = WIDGETGROUP_gizmo_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_gizmo_refresh; gzgt->message_subscribe = WIDGETGROUP_gizmo_message_subscribe; gzgt->draw_prepare = WIDGETGROUP_gizmo_draw_prepare; @@ -2024,7 +2024,7 @@ void VIEW3D_GGT_xform_gizmo_context(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_gizmo_poll_context; gzgt->setup = WIDGETGROUP_gizmo_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_gizmo_refresh; gzgt->message_subscribe = WIDGETGROUP_gizmo_message_subscribe; gzgt->draw_prepare = WIDGETGROUP_gizmo_draw_prepare; @@ -2228,7 +2228,7 @@ void VIEW3D_GGT_xform_cage(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_xform_cage_poll; gzgt->setup = WIDGETGROUP_xform_cage_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_xform_cage_refresh; gzgt->message_subscribe = WIDGETGROUP_xform_cage_message_subscribe; gzgt->draw_prepare = WIDGETGROUP_xform_cage_draw_prepare; @@ -2412,7 +2412,7 @@ void VIEW3D_GGT_xform_shear(wmGizmoGroupType *gzgt) gzgt->poll = WIDGETGROUP_xform_shear_poll; gzgt->setup = WIDGETGROUP_xform_shear_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = WIDGETGROUP_xform_shear_refresh; gzgt->message_subscribe = WIDGETGROUP_xform_shear_message_subscribe; gzgt->draw_prepare = WIDGETGROUP_xform_shear_draw_prepare; diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index 9e8258bffb1..6ec4112acbb 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -463,7 +463,7 @@ void VIEW3D_GGT_xform_extrude(struct wmGizmoGroupType *gzgt) gzgt->poll = ED_gizmo_poll_or_unlink_delayed_from_tool; gzgt->setup = gizmo_mesh_extrude_setup; - gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_drag; + gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag; gzgt->refresh = gizmo_mesh_extrude_refresh; gzgt->draw_prepare = gizmo_mesh_extrude_draw_prepare; gzgt->invoke_prepare = gizmo_mesh_extrude_invoke_prepare; diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index d2634d8d8d6..9b0936b47d1 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -242,6 +242,8 @@ struct wmKeyMap *WM_gizmogroup_setup_keymap_generic_select(const struct wmGizmoG struct wmKeyConfig *kc); struct wmKeyMap *WM_gizmogroup_setup_keymap_generic_drag(const struct wmGizmoGroupType *gzgt, struct wmKeyConfig *kc); +struct wmKeyMap *WM_gizmogroup_setup_keymap_generic_maybe_drag(const struct wmGizmoGroupType *gzgt, + struct wmKeyConfig *kc); /* Utility functions (not callbacks). */ struct wmKeyMap *WM_gizmo_keymap_generic_with_keyconfig(struct wmKeyConfig *kc); @@ -256,6 +258,9 @@ struct wmKeyMap *WM_gizmo_keymap_generic_drag(struct wmWindowManager *wm); struct wmKeyMap *WM_gizmo_keymap_generic_click_drag_with_keyconfig(struct wmKeyConfig *kc); struct wmKeyMap *WM_gizmo_keymap_generic_click_drag(struct wmWindowManager *wm); +struct wmKeyMap *WM_gizmo_keymap_generic_maybe_drag_with_keyconfig(struct wmKeyConfig *kc); +struct wmKeyMap *WM_gizmo_keymap_generic_maybe_drag(struct wmWindowManager *wm); + void WM_gizmogroup_ensure_init(const struct bContext *C, struct wmGizmoGroup *gzgroup); /* Sort utilities for use with 'BLI_listbase_sort'. */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index bea951e7708..709b7b03376 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -662,6 +662,12 @@ wmKeyMap *WM_gizmogroup_setup_keymap_generic_drag(const wmGizmoGroupType *UNUSED return WM_gizmo_keymap_generic_drag_with_keyconfig(kc); } +wmKeyMap *WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *UNUSED(gzgt), + wmKeyConfig *kc) +{ + return WM_gizmo_keymap_generic_maybe_drag_with_keyconfig(kc); +} + /** * Variation of #WM_gizmogroup_keymap_common but with keymap items for selection * @@ -767,6 +773,17 @@ struct wmKeyMap *WM_gizmo_keymap_generic_click_drag(wmWindowManager *wm) return WM_gizmo_keymap_generic_click_drag_with_keyconfig(wm->defaultconf); } +/** Drag or press depending on preference. */ +struct wmKeyMap *WM_gizmo_keymap_generic_maybe_drag_with_keyconfig(wmKeyConfig *kc) +{ + const char *idname = "Generic Gizmo Maybe Drag"; + return WM_keymap_ensure(kc, idname, SPACE_EMPTY, RGN_TYPE_WINDOW); +} +struct wmKeyMap *WM_gizmo_keymap_generic_maybe_drag(wmWindowManager *wm) +{ + return WM_gizmo_keymap_generic_drag_with_keyconfig(wm->defaultconf); +} + /** \} */ /* -------------------------------------------------------------------- */ |