diff options
-rw-r--r-- | release/scripts/modules/bpy/utils/__init__.py | 58 | ||||
-rw-r--r-- | release/scripts/modules/bpy_types.py | 20 |
2 files changed, 1 insertions, 77 deletions
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index b3257c30a97..80e48697b2f 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -34,7 +34,6 @@ __all__ = ( "refresh_script_paths", "app_template_paths", "register_class", - "register_module", "register_manual_map", "unregister_manual_map", "register_classes_factory", @@ -50,7 +49,6 @@ __all__ = ( "smpte_from_seconds", "units", "unregister_class", - "unregister_module", "user_resource", ) @@ -166,10 +164,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): for module_name in [ext.module for ext in _user_preferences.addons]: _addon_utils.disable(module_name) - # *AFTER* unregistering all add-ons, otherwise all calls to - # unregister_module() will silently fail (do nothing). - _bpy_types.TypeMap.clear() - def register_module_call(mod): register = getattr(mod, "register", None) if register: @@ -655,58 +649,6 @@ def user_resource(resource_type, path="", create=False): return target_path -def _bpy_module_classes(module, is_registered=False): - typemap_list = _bpy_types.TypeMap.get(module, ()) - i = 0 - while i < len(typemap_list): - cls_weakref = typemap_list[i] - cls = cls_weakref() - - if cls is None: - del typemap_list[i] - else: - if is_registered == cls.is_registered: - yield cls - i += 1 - - -def register_module(module, verbose=False): - if verbose: - print("bpy.utils.register_module(%r): ..." % module) - cls = None - for cls in _bpy_module_classes(module, is_registered=False): - if verbose: - print(" %r" % cls) - try: - register_class(cls) - except: - print("bpy.utils.register_module(): " - "failed to registering class %r" % cls) - import traceback - traceback.print_exc() - if verbose: - print("done.\n") - if cls is None: - raise Exception("register_module(%r): defines no classes" % module) - - -def unregister_module(module, verbose=False): - if verbose: - print("bpy.utils.unregister_module(%r): ..." % module) - for cls in _bpy_module_classes(module, is_registered=True): - if verbose: - print(" %r" % cls) - try: - unregister_class(cls) - except: - print("bpy.utils.unregister_module(): " - "failed to unregistering class %r" % cls) - import traceback - traceback.print_exc() - if verbose: - print("done.\n") - - def register_classes_factory(classes): """ Utility function to create register and unregister functions diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index b317ae18955..3bdf92f8e63 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -533,10 +533,6 @@ class Text(bpy_types.ID): self.write(string) -# values are module: [(cls, path, line), ...] -TypeMap = {} - - class Sound(bpy_types.ID): __slots__ = () @@ -548,21 +544,7 @@ class Sound(bpy_types.ID): class RNAMeta(type): - - def __new__(cls, name, bases, classdict, **args): - result = type.__new__(cls, name, bases, classdict) - if bases and bases[0] is not StructRNA: - from _weakref import ref as ref - module = result.__module__ - - # first part of packages only - if "." in module: - module = module[:module.index(".")] - - TypeMap.setdefault(module, []).append(ref(result)) - - return result - + # TODO(campbell): move to C-API @property def is_registered(cls): return "bl_rna" in cls.__dict__ |