diff --git a/scripts/addons_core/bl_pkg/bl_extension_ui.py b/scripts/addons_core/bl_pkg/bl_extension_ui.py index bf62218652f..0c65ac97af7 100644 --- a/scripts/addons_core/bl_pkg/bl_extension_ui.py +++ b/scripts/addons_core/bl_pkg/bl_extension_ui.py @@ -561,6 +561,30 @@ def addons_panel_draw_items( return module_names +def addons_panel_draw_error_duplicates(layout, error_duplicates): + import addon_utils + box = layout.box() + row = box.row() + row.label(text="Multiple add-ons with the same name found!") + row.label(icon='ERROR') + box.label(text="Delete one of each pair to resolve:") + for (addon_name, addon_file, addon_path) in addon_utils.error_duplicates: + box.separator() + sub_col = box.column(align=True) + sub_col.label(text=addon_name + ":") + sub_col.label(text=" " + addon_file) + sub_col.label(text=" " + addon_path) + + +def addons_panel_draw_error_generic(layout, lines): + box = layout.box() + sub = box.row() + sub.label(text=lines[0]) + sub.label(icon='ERROR') + for l in lines[1:]: + box.label(text=l) + + def addons_panel_draw_impl( self, context, # `bpy.types.Context` @@ -580,14 +604,26 @@ def addons_panel_draw_impl( from . import repo_cache_store_ensure + layout = self.layout + + # First show any errors, this should be an exceptional situation that should be resolved, + # otherwise add-ons may not behave correctly. + if addon_utils.error_duplicates: + addons_panel_draw_error_duplicates(layout, addon_utils.error_duplicates) + if addon_utils.error_encoding: + addons_panel_draw_error_generic( + layout, ( + "One or more add-ons do not have UTF-8 encoding", + "(see console for details)", + ), + ) + repo_cache_store = repo_cache_store_ensure() # This isn't elegant, but the preferences aren't available on registration. if not repo_cache_store.is_init(): repo_cache_store_refresh_from_prefs(repo_cache_store) - layout = self.layout - prefs = context.preferences # Define a top-most column to place warnings (if-any). diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index 4e98dd8018b..5ecbed74778 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -2617,7 +2617,6 @@ class USERPREF_PT_addons(AddOnPanel, Panel): if filter in {"All", "Enabled"}: # Append missing scripts # First collect scripts that are used but have no script file. - module_names = {mod.__name__ for mod in addon_modules} missing_modules = { addon_module_name for addon_module_name in used_addon_module_name_map if addon_module_name not in module_names