This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/release/scripts/modules/bl_keymap_utils/versioning.py
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00

34 lines
1.1 KiB
Python

# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
# Update Blender version this key-map was written in:
#
# When the version is ``(0, 0, 0)``, the key-map being loaded didn't contain any versioning information.
# This will older than ``(2, 92, 0)``.
def keyconfig_update(keyconfig_data, keyconfig_version):
from bpy.app import version_file as blender_version
if keyconfig_version >= blender_version:
return keyconfig_data
# Version the key-map.
import copy
has_copy = False
# Default repeat to false.
if keyconfig_version <= (2, 92, 0):
# 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 item_event.get("value") == 'PRESS':
# Unfortunately we don't know the 'map_type' at this point.
# Setting repeat true on other kinds of events is harmless.
item_event["repeat"] = True
return keyconfig_data