From f1622cc32d508022a2252cfa11b55354366f5069 Mon Sep 17 00:00:00 2001 From: Doug Hammond <doughammond@hamsterfight.co.uk> Date: Fri, 11 Feb 2011 09:29:54 +0000 Subject: [PATCH] extensions_framework: changed ef_initialise_properties function to not register the class with RNA, added another function ef_register_initialise_properties that does both. --- modules/extensions_framework/__init__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/extensions_framework/__init__.py b/modules/extensions_framework/__init__.py index 0aabc15d2..8e7ee3908 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 -- GitLab