diff options
author | Doug Hammond <doughammond@hamsterfight.co.uk> | 2011-02-11 12:29:54 +0300 |
---|---|---|
committer | Doug Hammond <doughammond@hamsterfight.co.uk> | 2011-02-11 12:29:54 +0300 |
commit | f1622cc32d508022a2252cfa11b55354366f5069 (patch) | |
tree | fee2824f7a55471071fdc1d775551337015f5835 /modules | |
parent | 0dad04903bdb39ff845a7452415a248d99f60ffa (diff) |
extensions_framework: changed ef_initialise_properties function to not register the class with RNA, added another function ef_register_initialise_properties that does both.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/extensions_framework/__init__.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/extensions_framework/__init__.py b/modules/extensions_framework/__init__.py index 0aabc15d..8e7ee390 100644 --- a/modules/extensions_framework/__init__.py +++ b/modules/extensions_framework/__init__.py @@ -116,16 +116,13 @@ def init_properties(obj, props, cache=True): continue def ef_initialise_properties(cls): - """This is mostly copied from plugin.plugin.install - This is a class decorator that should be used on + """This is a class decorator that should be used on sub-classes of declarative_property_group in order to ensure that they are initialised when the addon is loaded. """ - bpy.utils.register_class(cls) - for property_group_parent in cls.ef_attach_to: if property_group_parent is not None: prototype = getattr(bpy.types, property_group_parent) @@ -142,6 +139,17 @@ def ef_initialise_properties(cls): return cls +def ef_register_initialise_properties(cls): + """As ef_initialise_properties, but also registers the + class with RNA. Note that this isn't a great idea + because it's non-trivial to unregister the class, unless + you keep track of it yourself. + """ + + bpy.utils.register_class(cls) + ef_initialise_properties(cls) + return cls + class declarative_property_group(bpy.types.IDPropertyGroup): """A declarative_property_group describes a set of logically related properties, using a declarative style to list each |