From 078d02f55743cd34c51c4dd7ca710b22441a12da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 15 Aug 2019 10:21:04 +0200 Subject: User Preferences: Added "Enabled add-ons only" preference This checkbox replaces the "Disabled" and "Enabled" entries in the filter drop-down. As a result, it now takes a single click to limit the shown entries to enabled add-ons only. This is also an actual flag in the preferences, and thus its state is saved between runs on Blender (in contrast to the filter, which is always reset to "All"). Reviewed by: brecht, billreynish --- release/scripts/startup/bl_operators/userpref.py | 2 ++ release/scripts/startup/bl_ui/__init__.py | 2 -- release/scripts/startup/bl_ui/space_userpref.py | 18 +++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_operators/userpref.py b/release/scripts/startup/bl_operators/userpref.py index 034aa9fff6c..6ec6855296c 100644 --- a/release/scripts/startup/bl_operators/userpref.py +++ b/release/scripts/startup/bl_operators/userpref.py @@ -667,6 +667,7 @@ class PREFERENCES_OT_addon_install(Operator): info = addon_utils.module_bl_info(mod) # show the newly installed addon. + context.preferences.view.show_addons_enabled_only = False context.window_manager.addon_filter = 'All' context.window_manager.addon_search = info["name"] break @@ -796,6 +797,7 @@ class PREFERENCES_OT_addon_show(Operator): info["show_expanded"] = True context.preferences.active_section = 'ADDONS' + context.preferences.view.show_addons_enabled_only = False context.window_manager.addon_filter = 'All' context.window_manager.addon_search = info["name"] bpy.ops.screen.userpref_show('INVOKE_DEFAULT') diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 690a922b0d5..5daacbb2e44 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -126,8 +126,6 @@ def register(): items = [ ('All', "All", "All Add-ons"), ('User', "User", "All Add-ons Installed by User"), - ('Enabled', "Enabled", "All Enabled Add-ons"), - ('Disabled', "Disabled", "All Disabled Add-ons"), ] items_unique = set() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 87baea9cdd8..ce4a6fb835e 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1744,6 +1744,7 @@ class USERPREF_PT_addons(Panel): row.operator("preferences.addon_refresh", icon='FILE_REFRESH', text="Refresh") row = layout.row() + row.prop(context.preferences.view, "show_addons_enabled_only") row.prop(context.window_manager, "addon_filter", text="") row.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') @@ -1770,6 +1771,7 @@ class USERPREF_PT_addons(Panel): "(see console for details)", ) + show_enabled_only = context.preferences.view.show_addons_enabled_only filter = context.window_manager.addon_filter search = context.window_manager.addon_search.lower() support = context.window_manager.addon_support @@ -1786,13 +1788,15 @@ class USERPREF_PT_addons(Panel): continue # check if addon should be visible with current filters - if ( - (filter == "All") or - (filter == info["category"]) or - (filter == "Enabled" and is_enabled) or - (filter == "Disabled" and not is_enabled) or - (filter == "User" and (mod.__file__.startswith(addon_user_dirs))) - ): + is_visible = ( + (filter == "All") or + (filter == info["category"]) or + (filter == "User" and (mod.__file__.startswith(addon_user_dirs))) + ) + if show_enabled_only: + is_visible = is_visible and is_enabled + + if is_visible: if search and search not in info["name"].lower(): if info["author"]: if search not in info["author"].lower(): -- cgit v1.2.3