[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34321] trunk/blender/release/scripts: add icons to show community vs official scripts as well as buttons to filter by support level (currently all scripts default to community)

Campbell Barton ideasman42 at gmail.com
Fri Jan 14 17:49:44 CET 2011


Revision: 34321
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34321
Author:   campbellbarton
Date:     2011-01-14 16:49:43 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
add icons to show community vs official scripts as well as buttons to filter by support level (currently all scripts default to community)
 note: we need better icons for this.

 also formatting edit for ply import.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/io_mesh_ply/import_ply.py
    trunk/blender/release/scripts/templates/addon_add_object.py
    trunk/blender/release/scripts/ui/space_userpref.py

Modified: trunk/blender/release/scripts/op/io_mesh_ply/import_ply.py
===================================================================
--- trunk/blender/release/scripts/op/io_mesh_ply/import_ply.py	2011-01-14 16:02:38 UTC (rev 34320)
+++ trunk/blender/release/scripts/op/io_mesh_ply/import_ply.py	2011-01-14 16:49:43 UTC (rev 34321)
@@ -23,7 +23,10 @@
 
 
 class element_spec(object):
-    __slots__ = 'name', 'count', 'properties'
+    __slots__ = ("name",
+                 "count",
+                 "properties",
+                 )
 
     def __init__(self, name, count):
         self.name = name
@@ -43,7 +46,10 @@
 
 
 class property_spec(object):
-    __slots__ = 'name', 'list_type', 'numeric_type'
+    __slots__ = ("name",
+                 "list_type",
+                 "numeric_type",
+                 )
 
     def __init__(self, name, list_type, numeric_type):
         self.name = name
@@ -96,7 +102,8 @@
 
 
 class object_spec(object):
-    __slots__ = 'specs'
+    __slots__ = ("specs",
+                )
     'A list of element_specs'
     def __init__(self):
         self.specs = []

Modified: trunk/blender/release/scripts/templates/addon_add_object.py
===================================================================
--- trunk/blender/release/scripts/templates/addon_add_object.py	2011-01-14 16:02:38 UTC (rev 34320)
+++ trunk/blender/release/scripts/templates/addon_add_object.py	2011-01-14 16:49:43 UTC (rev 34321)
@@ -1,4 +1,4 @@
-bl_addon_info = {
+bl_info = {
     "name": "New Object",
     "author": "YourNameHere",
     "version": (1, 0),

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2011-01-14 16:02:38 UTC (rev 34320)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2011-01-14 16:49:43 UTC (rev 34321)
@@ -92,6 +92,7 @@
             layout.operator("wm.keyconfig_import")
         elif userpref.active_section == 'ADDONS':
             layout.operator("wm.addon_install")
+            layout.menu("USERPREF_MT_addons_dev_guides", text="  Addons Developer Guides", icon='INFO')
         elif userpref.active_section == 'THEMES':
             layout.operator("ui.reset_default_theme")
 
@@ -831,6 +832,7 @@
     bl_options = {'HIDE_HEADER'}
 
     _addons_cats = None
+    _addons_sups = None
     _addons_fake_modules = {}
 
     @classmethod
@@ -960,26 +962,35 @@
             bpy.types.WindowManager.addon_search = bpy.props.StringProperty(name="Search", description="Search within the selected filter")
             USERPREF_PT_addons._addons_cats = cats
 
+        sups = {info["support"] for mod, info in addons}
+        sups.discard("")
+
+        if USERPREF_PT_addons._addons_sups != sups:
+            bpy.types.WindowManager.addon_support = bpy.props.EnumProperty(items=[(sup, sup.title(), "") for  sup in reversed(sorted(sups))], name="Support", description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'})
+            USERPREF_PT_addons._addons_sups = sups
+
         split = layout.split(percentage=0.2)
         col = split.column()
         col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
-        col.prop(context.window_manager, "addon_filter", text="Filter", expand=True)
+        col.prop(context.window_manager, "addon_filter", expand=True)
 
-        # menu to open webpages with addons development guides
-        col.separator()
-        col.label(text=" Online Documentation", icon='INFO')
-        col.menu("USERPREF_MT_addons_dev_guides", text="Addons Developer Guides")
+        col.label(text="Supported Level")
+        col.prop(context.window_manager, "addon_support", expand=True)
 
         col = split.column()
 
         filter = context.window_manager.addon_filter
         search = context.window_manager.addon_search.lower()
+        support = context.window_manager.addon_support
 
         for mod, info in addons:
             module_name = mod.__name__
 
             is_enabled = module_name in used_ext
 
+            if info["support"] not in support:
+                continue
+
             # check if add-on should be visible with current filters
             if (filter == "All") or \
                     (filter == info["category"]) or \
@@ -1006,6 +1017,14 @@
                 if info["warning"]:
                     rowsub.label(icon='ERROR')
 
+                # icon showing support level.
+                if info["support"] == 'OFFICIAL':
+                    rowsub.label(icon='FILE_BLEND')
+                elif info["support"] == 'COMMUNITY':
+                    rowsub.label(icon='POSE_DATA')
+                else:
+                    rowsub.label(icon='QUESTION')
+
                 if is_enabled:
                     row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
                 else:
@@ -1073,7 +1092,7 @@
 from bpy.props import *
 
 
-def addon_info_get(mod, info_basis={"name": "", "author": "", "version": (), "blender": (), "api": 0, "location": "", "description": "", "wiki_url": "", "tracker_url": "", "category": "", "warning": "", "show_expanded": False}):
+def addon_info_get(mod, info_basis={"name": "", "author": "", "version": (), "blender": (), "api": 0, "location": "", "description": "", "wiki_url": "", "tracker_url": "", "support": 'COMMUNITY', "category": "", "warning": "", "show_expanded": False}):
     addon_info = getattr(mod, "bl_info", {})
 
     # avoid re-initializing




More information about the Bf-blender-cvs mailing list