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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-21 09:22:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-21 09:22:09 +0300
commit599bd1cbda109854c7efc7dbad36072b0eb2bdb1 (patch)
treee711f23b9127034b3e2843e3673ae0119e178e79 /release/scripts
parent6031744c3592e1ae2f3d0d0c27616ee754b72546 (diff)
patch from Martin, call classes register/unregister functions.
Modified to only do one lookup. from Martin: "Basically, what it does is allow you to add register and unregister class methods to rna types, this way you don't have to rely on module register/unregister methods to setup your types properly (and it makes them easier to move around when reorganizing code and easier to understand what a type does when reading code). This is especially nice for PropertyGroup classes that are added as properties to existing types, you can easily see in their register methods where they are added and removed in their unregister method. Obviously, those two methods are optional, so current code still works fine."
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/modules/bpy/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index ad4107a1d69..32f3a397a94 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -436,6 +436,9 @@ def register_module(module, verbose=False):
print(" %r" % cls)
try:
register_class(cls)
+ cls_func = getattr(cls, "register", None)
+ if cls_func is not None:
+ cls_func()
except:
print("bpy.utils.register_module(): failed to registering class %r" % cls)
print("\t", path, "line", line)
@@ -455,6 +458,9 @@ def unregister_module(module, verbose=False):
print(" %r" % cls)
try:
unregister_class(cls)
+ cls_func = getattr(cls, "unregister", None)
+ if cls_func is not None:
+ cls_func()
except:
print("bpy.utils.unregister_module(): failed to unregistering class %r" % cls)
print("\t", path, "line", line)