From paulcoones at comcast.net Tue Feb 9 18:30:45 2021 From: paulcoones at comcast.net (Paul Coones) Date: Tue, 9 Feb 2021 09:30:45 -0800 Subject: [Bf-python] [Bf-extensions-cvs] [47912087] master: Fix mesh_snap_utilities_line running without key-maps available In-Reply-To: <20210209102931.5122AF37E@git.blender.org> References: <161286657108.19063.5051327547600291315@git.blender.org> <20210209102931.5122AF37E@git.blender.org> Message-ID: <49ED445F-C35A-4F06-A19A-3B1FCE5D1EC2@comcast.net> > On Feb 9, 2021, at 2:29 AM, Campbell Barton 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: