added filter for user installed addons

This commit is contained in:
Gaia Clary
2012-10-13 10:33:09 +00:00
parent 3fa24c7d5f
commit 4941f8ac44
2 changed files with 13 additions and 5 deletions

View File

@@ -92,9 +92,10 @@ def register():
def addon_filter_items(self, context):
import addon_utils
items = [('All', "All", ""),
('Enabled', "Enabled", ""),
('Disabled', "Disabled", ""),
items = [('All', "All", "All Addons"),
('User', "User", "All Addons Installed by User"),
('Enabled', "Enabled", "All Enabled Addons"),
('Disabled', "Disabled", "All Disabled Addons"),
]
items_unique = set()
@@ -119,7 +120,7 @@ def register():
WindowManager.addon_support = EnumProperty(
items=[('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
],
name="Support",
description="Display support level",

View File

@@ -1040,6 +1040,9 @@ class USERPREF_PT_addons(Panel):
userpref = context.user_preferences
used_ext = {ext.module for ext in userpref.addons}
userpref_addons_folder = os.path.join(bpy.context.user_preferences.filepaths.script_directory,"addons")
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)]
@@ -1088,7 +1091,11 @@ class USERPREF_PT_addons(Panel):
if ((filter == "All") or
(filter == info["category"]) or
(filter == "Enabled" and is_enabled) or
(filter == "Disabled" and not is_enabled)):
(filter == "Disabled" and not is_enabled) or
(filter == "User" and
( mod.__file__.startswith(userpref_addons_folder) or
mod.__file__.startswith(scripts_addons_folder)))
):
if search and search not in info["name"].lower():
if info["author"]: