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.
This commit is contained in:
parent
3fb11061ba
commit
8f0dc3cef6
Notes:
blender-bot
2023-02-14 19:43:13 +01:00
Referenced by issue #50491, Cycles UI breaks when pushing F8 Referenced by issue blender/blender-addons#50052, bpy.utils.unregister_module doesn't unregister classes of submodules
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue