> On Feb 9, 2021, at 2:29 AM, Campbell Barton <[email protected]> wrote:
> 
> Commit: 4791208720cee54a76e92431a92bc81937d1f46a
> Author: Campbell Barton
> Date:   Tue Feb 9 21:28:09 2021 +1100
> Branches: master
> https://developer.blender.org/rBA4791208720cee54a76e92431a92bc81937d1f46a
> 
> Fix mesh_snap_utilities_line running without key-maps available
> 
> This caused script_load_addons test to fail in some cases.
> 
> ===================================================================
> 
> M     mesh_snap_utilities_line/__init__.py
> 
> ===================================================================
> 
> diff --git a/mesh_snap_utilities_line/__init__.py 
> b/mesh_snap_utilities_line/__init__.py
> index 623b0355..5e4d2f96 100644
> --- a/mesh_snap_utilities_line/__init__.py
> +++ b/mesh_snap_utilities_line/__init__.py
> @@ -118,6 +118,9 @@ def register_keymaps():
>     keyconfigs = bpy.context.window_manager.keyconfigs
>     kc_defaultconf = keyconfigs.default
>     kc_addonconf = keyconfigs.addon
> +    # In background mode.
> +    if kc_defaultconf is None or kc_addonconf is None:
> +        return
> 
>     # TODO: find the user defined tool_mouse.
>     from bl_keymap_utils.io import keyconfig_init_from_data
> @@ -128,8 +131,11 @@ def register_keymaps():
>     #snap_modalkeymap.assign("MESH_OT_snap_utilities_line")
> def unregister_keymaps():
>     keyconfigs = bpy.context.window_manager.keyconfigs
> -    defaultmap = keyconfigs.get("Blender").keymaps
> -    addonmap   = keyconfigs.get("Blender addon").keymaps
> +    defaultmap = getattr(keyconfigs.get("Blender"), "keymaps", None)
> +    addonmap = getattr(keyconfigs.get("Blender addon"), "keymaps", None)
> +    # In background mode.
> +    if defaultmap is None or addonmap is None:
> +        return
> 
>     for keyconfig_data in keys.generate_snap_utilities_global_keymaps():
>         km_name, km_args, km_content = keyconfig_data
> 
> _______________________________________________
> Bf-extensions-cvs mailing list
> [email protected]
> https://lists.blender.org/mailman/listinfo/bf-extensions-cvs

Paul Coones
3283 Webster Ln
Washougal, WA 98671
[email protected]




_______________________________________________
Bf-python mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-python

Reply via email to