[Bf-python] [Bf-extensions-cvs] [47912087] master: Fix mesh_snap_utilities_line running without key-maps available

Paul Coones paulcoones at comcast.net
Tue Feb 9 18:30:45 CET 2021



> On Feb 9, 2021, at 2:29 AM, Campbell Barton <noreply at git.blender.org> 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
> Bf-extensions-cvs at blender.org
> https://lists.blender.org/mailman/listinfo/bf-extensions-cvs

Paul Coones
3283 Webster Ln
Washougal, WA 98671
paulcoones at comcast.net




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20210209/06561234/attachment.htm>


More information about the Bf-python mailing list