[Bf-blender-cvs] [8f0dc3c] master: Fix T50052: bpy.utils.unregister_module doesn't unregister classes of submodules in reload scenario.

Bastien Montagne noreply at git.blender.org
Fri Nov 18 15:53:30 CET 2016


Commit: 8f0dc3cef6c3f3e02a0a4322cd241cf379e52552
Author: Bastien Montagne
Date:   Fri Nov 18 15:14:22 2016 +0100
Branches: master
https://developer.blender.org/rB8f0dc3cef6c3f3e02a0a4322cd241cf379e52552

Fix T50052: bpy.utils.unregister_module doesn't unregister classes of submodules in reload scenario.

reload case would clear TypeMap before unregistering addons, which made
all calls to unregister_module() to do absolutely nothing.

===================================================================

M	release/scripts/modules/bpy/utils/__init__.py

===================================================================

diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 66974de..31dd836 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -154,8 +154,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
         original_modules = _sys.modules.values()
 
     if reload_scripts:
-        _bpy_types.TypeMap.clear()
-
         # just unload, don't change user defaults, this means we can sync
         # to reload. note that they will only actually reload of the
         # modification time changes. This `won't` work for packages so...
@@ -163,6 +161,9 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
         for module_name in [ext.module for ext in _user_preferences.addons]:
             _addon_utils.disable(module_name)
 
+        # *AFTER* unregistering all add-ons, otherwise all calls to unregister_module() will silently fail (do nothing).
+        _bpy_types.TypeMap.clear()
+
     def register_module_call(mod):
         register = getattr(mod, "register", None)
         if register:




More information about the Bf-blender-cvs mailing list