diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-13 12:16:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-13 12:16:31 +0400 |
commit | 88fac851231ef837a0cc3efcc6050d909f6852ec (patch) | |
tree | 8362d75a1ca994c19cd60d07b2f369bc594fecc9 /release/scripts | |
parent | cd1dc29e65a7fb8c1c823be840fedaad795608d6 (diff) |
avoid re-creating and assigning addon UI properties for every redraw
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/ui/space_userpref.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index c885e94211d..0b4c33c4438 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -805,6 +805,7 @@ class USERPREF_PT_addons(bpy.types.Panel): bl_region_type = 'WINDOW' bl_options = {'HIDE_HEADER'} + _addons_cats = None _addons_fake_modules = {} @classmethod @@ -910,12 +911,10 @@ class USERPREF_PT_addons(bpy.types.Panel): cats = {info["category"] for mod, info in addons} cats.discard("") - cats = ["All", "Enabled", "Disabled"] + sorted(cats) - - # use window manager ID since it wont be saved with the file - # defining every draw is stupid *FIXME* - bpy.types.WindowManager.addon_filter = bpy.props.EnumProperty(items=[(cat, cat, cat + " addons") for cat in cats], name="Category", description="Filter add-ons by category") - bpy.types.WindowManager.addon_search = bpy.props.StringProperty(name="Search", description="Search within the selected filter") + if USERPREF_PT_addons._addons_cats != cats: + bpy.types.WindowManager.addon_filter = bpy.props.EnumProperty(items=[(cat, cat, "") for cat in ["All", "Enabled", "Disabled"] + sorted(cats)], name="Category", description="Filter add-ons by category") + bpy.types.WindowManager.addon_search = bpy.props.StringProperty(name="Search", description="Search within the selected filter") + USERPREF_PT_addons._addons_cats = cats split = layout.split(percentage=0.2) col = split.column() |