[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1588] trunk/py/scripts/addons/modules/ extensions_framework/__init__.py: extensions_framework: Add optional bl_info parameter to Addon class contstructor, useful for making bl_idname and bl_label strings for versioned addons
Doug Hammond
doughammond at hamsterfight.co.uk
Sat Feb 12 19:31:48 CET 2011
Revision: 1588
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1588
Author: dougal2
Date: 2011-02-12 18:31:47 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
extensions_framework: Add optional bl_info parameter to Addon class contstructor, useful for making bl_idname and bl_label strings for versioned addons
Modified Paths:
--------------
trunk/py/scripts/addons/modules/extensions_framework/__init__.py
Modified: trunk/py/scripts/addons/modules/extensions_framework/__init__.py
===================================================================
--- trunk/py/scripts/addons/modules/extensions_framework/__init__.py 2011-02-12 16:35:27 UTC (rev 1587)
+++ trunk/py/scripts/addons/modules/extensions_framework/__init__.py 2011-02-12 18:31:47 UTC (rev 1588)
@@ -273,11 +273,27 @@
class Addon(object):
"""A list of classes registered by this addon"""
+ static_addon_count = 0
+
+ addon_serial = 0
addon_classes = None
+ bl_info = None
- def __init__(self):
+ def __init__(self, bl_info=None):
self.addon_classes = []
+ self.bl_info = bl_info
+ self.addon_serial = Addon.static_addon_count
+
+ Addon.static_addon_count += 1
+ def bl_infos(self):
+ if self.bl_info:
+ BL_VERSION = '.'.join(['%s'%v for v in self.bl_info['version']]).lower()
+ BL_IDNAME = self.bl_info['name'].lower() + '-' + BL_VERSION
+ return BL_VERSION, BL_IDNAME
+ else:
+ return '0', 'Addon-%03d'%self.addon_serial
+
def addon_register_class(self, cls):
"""This method is designed to be used as a decorator on RNA-registerable
classes defined by the addon. By using this decorator, this class will
More information about the Bf-extensions-cvs
mailing list