Merge branch 'blender2.8' into soc-2018-bevel

This commit is contained in:
2018-07-21 19:29:15 +05:30
1444 changed files with 59674 additions and 41167 deletions

View File

@@ -177,8 +177,8 @@ def addon_keymap_register(wm, keymaps_description):
for km_info, km_items in keymaps_description:
km_name, km_sptype, km_regtype, km_ismodal = km_info
kmap = [k for k in kconf.keymaps
if k.name == km_name and k.region_type == km_regtype and
k.space_type == km_sptype and k.is_modal == km_ismodal]
if k.name == km_name and k.region_type == km_regtype and
k.space_type == km_sptype and k.is_modal == km_ismodal]
if kmap:
kmap = kmap[0]
else:
@@ -202,8 +202,8 @@ def addon_keymap_unregister(wm, keymaps_description):
for km_info, km_items in keymaps_description:
km_name, km_sptype, km_regtype, km_ismodal = km_info
kmaps = (k for k in kconf.keymaps
if k.name == km_name and k.region_type == km_regtype and
k.space_type == km_sptype and k.is_modal == km_ismodal)
if k.name == km_name and k.region_type == km_regtype and
k.space_type == km_sptype and k.is_modal == km_ismodal)
for kmap in kmaps:
for kmi_kwargs, props in km_items:
idname = kmi_kwargs["idname"]
@@ -240,9 +240,9 @@ def _export_properties(prefix, properties, kmi_id, lines=None):
lines = []
def string_value(value):
if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int):
if isinstance(value, (str, bool, float, int)):
return repr(value)
elif getattr(value, '__len__', False):
elif hasattr(value, "__len__"):
return repr(list(value))
print("Export key configuration: can't write ", value)
@@ -296,8 +296,10 @@ def _kmistr(kmi, is_modal):
return "".join(s)
def keyconfig_export(wm, kc, filepath):
def keyconfig_export(
wm, kc, filepath, *,
all_keymaps=False,
):
f = open(filepath, "w")
f.write("import bpy\n")
@@ -327,7 +329,7 @@ def keyconfig_export(wm, kc, filepath):
keymaps = []
edited_kc = FakeKeyConfig()
for km in wm.keyconfigs.user.keymaps:
if km.is_user_modified:
if all_keymaps or km.is_user_modified:
edited_kc.keymaps.append(km)
# merge edited keymaps with non-default keyconfig, if it exists
if kc != wm.keyconfigs.default:
@@ -406,3 +408,11 @@ def keyconfig_test(kc):
if testEntry(kc, entry):
result = True
return result
# Note, we may eventually replace existing logic with this
# so key configs are always data.
from .keyconfig_utils_experimental import (
keyconfig_export_as_data,
keyconfig_import_from_data,
)