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>2017-03-26 03:14:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-03-26 03:28:10 +0300
commitf8e02c75bad7cd57f3ecda3270cd3775d7c1c7ea (patch)
tree23a5f3a3450b55db4b20fb0ca5c17918bc9b226c /release
parent393efccb19e4340c414af5d6da74060b6534ca25 (diff)
PyAPI: debug-python check for missing class register
Moving to manual class registration means its easier to accidentally miss registering classes. Now detect missing class registration and warn when running with `--debug-python`
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy/utils/__init__.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 65a2f278465..14510c844aa 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -144,6 +144,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
:type refresh_scripts: bool
"""
use_time = _bpy.app.debug_python
+ use_class_register_check = use_time
if use_time:
import time
@@ -276,6 +277,16 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
if use_time:
print("Python Script Load Time %.4f" % (time.time() - t_main))
+ if use_class_register_check:
+ for cls in _bpy.types.bpy_struct.__subclasses__():
+ if getattr(cls, "is_registered", False):
+ for subcls in cls.__subclasses__():
+ if not subcls.is_registered:
+ print(
+ "Warning, unregistered class: %s(%s)" %
+ (subcls.__name__, cls.__name__)
+ )
+
# base scripts
_scripts = _os.path.join(_os.path.dirname(__file__),