e955c94ed3
Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
# SPDX-FileCopyrightText: 2019-2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
def keyconfig_data_oskey_from_ctrl(keyconfig_data_src, *, filter_fn=None):
|
|
keyconfig_data_dst = []
|
|
for km_name, km_parms, km_items_data_src in keyconfig_data_src:
|
|
km_items_data_dst = km_items_data_src.copy()
|
|
items_dst = []
|
|
km_items_data_dst["items"] = items_dst
|
|
for item_src in km_items_data_src["items"]:
|
|
item_op, item_event, item_prop = item_src
|
|
if "ctrl" in item_event:
|
|
if filter_fn is None or filter_fn(item_event):
|
|
item_event = item_event.copy()
|
|
item_event["oskey"] = item_event["ctrl"]
|
|
del item_event["ctrl"]
|
|
items_dst.append((item_op, item_event, item_prop))
|
|
items_dst.append(item_src)
|
|
keyconfig_data_dst.append((km_name, km_parms, km_items_data_dst))
|
|
return keyconfig_data_dst
|
|
|
|
|
|
def keyconfig_data_oskey_from_ctrl_for_macos(keyconfig_data_src):
|
|
"""Use for apple since Cmd is typically used in-place of Ctrl."""
|
|
def filter_fn(item_event):
|
|
if item_event.get("ctrl"):
|
|
event_type = item_event["type"]
|
|
# Ctrl-{Key}
|
|
if (event_type in {
|
|
'H',
|
|
'M',
|
|
'SPACE',
|
|
'W',
|
|
'ACCENT_GRAVE',
|
|
'PERIOD',
|
|
'TAB',
|
|
}):
|
|
if (not item_event.get("alt")) and (not item_event.get("shift")):
|
|
return False
|
|
# Ctrl-Alt-{Key}
|
|
if (event_type in {
|
|
'Q',
|
|
}):
|
|
if item_event.get("alt") and (not item_event.get("shift")):
|
|
return False
|
|
return True
|
|
|
|
return keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn=filter_fn)
|