Event System: remove tweak events in favor of click-drag
Supporting two kinds of dragging is redundant, remove tweak events as they only supported 3 mouse buttons and added complexity from using the 'value' to store directions. Support only click-drag events (KM_CLICK_DRAG) which can be used with any keyboard or mouse button. Details: - A "direction" member has been added to keymap items and events which can be used when the event value is set to KM_CLICK_DRAG. - Keymap items are version patched. - Loading older key-maps are also updated. - Currently the key-maps stored in ./release/scripts/presets/keyconfig/ still reference tweak events & need updating. For now they are updated on load. Note that in general this wont impact add-ons as modal operators don't receive tweak events. Reviewed By: brecht Ref D14214
This commit is contained in:
@@ -30,4 +30,22 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
|
||||
# Setting repeat true on other kinds of events is harmless.
|
||||
item_event["repeat"] = True
|
||||
|
||||
if keyconfig_version <= (3, 2, 5):
|
||||
# Only copy once.
|
||||
if not has_copy:
|
||||
keyconfig_data = copy.deepcopy(keyconfig_data)
|
||||
has_copy = True
|
||||
|
||||
for _km_name, _km_parms, km_items_data in keyconfig_data:
|
||||
for (_item_op, item_event, _item_prop) in km_items_data["items"]:
|
||||
if ty_new := {
|
||||
'EVT_TWEAK_L': 'LEFTMOUSE',
|
||||
'EVT_TWEAK_M': 'MIDDLEMOUSE',
|
||||
'EVT_TWEAK_R': 'RIGHTMOUSE',
|
||||
}.get(item_event.get("type")):
|
||||
item_event["type"] = ty_new
|
||||
if (value := item_event["value"]) != 'ANY':
|
||||
item_event["direction"] = value
|
||||
item_event["value"] = 'CLICK_DRAG'
|
||||
|
||||
return keyconfig_data
|
||||
|
||||
Reference in New Issue
Block a user