diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 10:36:54 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 10:36:54 +0400 |
commit | 771906bc09317e3dc77be2319b44bc59081eff93 (patch) | |
tree | 2b6386aa5cdadfd52bc3b036feee3b00b6c87793 /release/scripts/startup/bl_ui | |
parent | f75711db7fd3565925880f8a2ea89088334c35bf (diff) |
Fix for #36387, User Preferences "Addons" panel bogs down the whole interface.
The addons panel draw function calls addon_utils.modules() which in turn retrieves a list of fake modules from the script paths every time. This can become costly when network paths are included for
addons. Solution is to put the scanning process into a dedicated "refresh" function and disable it in frequently called draw and filter functions, i.e. in these cases the cached addons_fake_modules list
will be used instead.
Note that this may lead to invalid addon lists if script paths are changed (which is not working 100% without restart anyway according to Campbell). For this there is now a "Refresh" operator button in
the addons preferences. If necessary and feasible such forced refreshes can be added later too.
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/__init__.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index b9f2e8406c6..df6247f65f5 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -105,7 +105,7 @@ def register(): items_unique = set() - for mod in addon_utils.modules(addon_utils.addons_fake_modules): + for mod in addon_utils.modules(refresh=False): info = addon_utils.module_bl_info(mod) items_unique.add(info["category"]) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index c2825d0641e..0418434c92b 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1142,11 +1142,12 @@ class USERPREF_PT_addons(Panel): scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons") # collect the categories that can be filtered on - addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(addon_utils.addons_fake_modules)] + addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(refresh=False)] split = layout.split(percentage=0.2) col = split.column() col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') + col.operator("wm.addon_refresh", icon='FILE_REFRESH') col.label(text="Supported Level") col.prop(context.window_manager, "addon_support", expand=True) @@ -1156,7 +1157,7 @@ class USERPREF_PT_addons(Panel): col = split.column() - # set in addon_utils.modules(...) + # set in addon_utils.modules_refresh() if addon_utils.error_duplicates: self.draw_error(col, "Multiple addons using the same name found!\n" |