Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hammond <doughammond@hamsterfight.co.uk>2011-02-12 21:31:47 +0300
committerDoug Hammond <doughammond@hamsterfight.co.uk>2011-02-12 21:31:47 +0300
commit1cc5dcfcb33fef4067904c4b93ee9446f3167f6b (patch)
tree7bf2e7af15b9cdc9ffa87c0c5db9618bd044f849 /modules
parent9298c1a81eb76def3040f9018169fbbd11aabfdf (diff)
extensions_framework: Add optional bl_info parameter to Addon class contstructor, useful for making bl_idname and bl_label strings for versioned addons
Diffstat (limited to 'modules')
-rw-r--r--modules/extensions_framework/__init__.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/extensions_framework/__init__.py b/modules/extensions_framework/__init__.py
index f8ce0d35..bf79d5c4 100644
--- a/modules/extensions_framework/__init__.py
+++ b/modules/extensions_framework/__init__.py
@@ -273,10 +273,26 @@ class declarative_property_group(bpy.types.IDPropertyGroup):
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