diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-15 02:02:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-15 02:02:47 +0300 |
commit | f2b1645a75096076910b0c0d46c9b4d5e42c4698 (patch) | |
tree | c90dfbbd8cecb51de76690d6eb151ebb7ea41ada /release/scripts/ui/space_userpref.py | |
parent | eb53b0fb4ce56cc9356127613f7e32334b00f08f (diff) |
fix/disallow [#26502] segmentationfault on pressing button to browse existing images for UV window
creating RNA within draw functions can free existing RNA, crashing blender when this is already used in the UI.
disallowing this so it raises a python exception.
This was being used to dynamically generate addon categories so for now they are hard coded and we need proper enum-functions for python to do this.
Diffstat (limited to 'release/scripts/ui/space_userpref.py')
-rw-r--r-- | release/scripts/ui/space_userpref.py | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index a97c545e502..202d5cdbed4 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -853,8 +853,8 @@ class USERPREF_PT_addons(bpy.types.Panel): bl_region_type = 'WINDOW' bl_options = {'HIDE_HEADER'} - _addons_cats = None - _addons_sups = None + # _addons_cats = None + # _addons_sups = None _addons_fake_modules = {} @classmethod @@ -875,6 +875,8 @@ class USERPREF_PT_addons(bpy.types.Panel): # collect the categories that can be filtered on addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)] + # XXX. we need dynamic enums to properly support this. + """ cats = {info["category"] for mod, info in addons} cats.discard("") @@ -882,6 +884,8 @@ class USERPREF_PT_addons(bpy.types.Panel): bpy.types.WindowManager.addon_filter = 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 = StringProperty(name="Search", description="Search within the selected filter") USERPREF_PT_addons._addons_cats = cats + + [('All', 'All', ''), ('Enabled', 'Enabled', ''), ('Disabled', 'Disabled', ''), ('3D View', '3D View', ''), ('Add Curve', 'Add Curve', ''), ('Add Mesh', 'Add Mesh', ''), ('Animation', 'Animation', ''), ('Development', 'Development', ''), ('Game Engine', 'Game Engine', ''), ('Import-Export', 'Import-Export', ''), ('Mesh', 'Mesh', ''), ('Object', 'Object', ''), ('Render', 'Render', ''), ('Rigging', 'Rigging', ''), ('System', 'System', '')] sups_default = {'OFFICIAL', 'COMMUNITY'} sups = sups_default | {info["support"] for mod, info in addons} @@ -890,6 +894,7 @@ class USERPREF_PT_addons(bpy.types.Panel): if USERPREF_PT_addons._addons_sups != sups: bpy.types.WindowManager.addon_support = EnumProperty(items=[(sup, sup.title(), "") for sup in reversed(sorted(sups))], name="Support", description="Display support level", default=sups_default, options={'ENUM_FLAG'}) USERPREF_PT_addons._addons_sups = sups + """ split = layout.split(percentage=0.2) col = split.column() @@ -1193,6 +1198,37 @@ class WM_OT_addon_expand(bpy.types.Operator): def register(): bpy.utils.register_module(__name__) + WindowManager = bpy.types.WindowManager + + WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter") + WindowManager.addon_filter = EnumProperty( + items=[('All', "All", ""), + ('Enabled', "Enabled", ""), + ('Disabled', "Disabled", ""), + ('3D View', "3D View", ""), + ('Add Curve', "Add Curve", ""), + ('Add Mesh', "Add Mesh", ""), + ('Animation', "Animation", ""), + ('Development', "Development", ""), + ('Game Engine', "Game Engine", ""), + ('Import-Export', "Import-Export", ""), + ('Mesh', "Mesh", ""), + ('Object', "Object", ""), + ('Render', "Render", ""), + ('Rigging', "Rigging", ""), + ('System', "System", "") + ], + name="Category", + description="Filter add-ons by category", + ) + + WindowManager.addon_support = EnumProperty( + items=[('OFFICIAL', "Official", ""), + ('COMMUNITY', 'Community', ""), + ], + name="Support", + description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'}) + def unregister(): bpy.utils.unregister_module(__name__) |