diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-01 13:26:21 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-01 13:52:52 +0300 |
commit | 4b37abd61f8e4164f3f34fffa7140414dffa7a49 (patch) | |
tree | 6aa69d49f47ab53d911089e3d0f26c3a78efa308 /release/scripts/modules/bl_i18n_utils | |
parent | 5fde4494f6542739ec4184312d0a937c500e0595 (diff) |
Cleanup a bit i18n message extraction code.
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/bl_extract_messages.py | 53 | ||||
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/utils.py | 5 |
2 files changed, 2 insertions, 56 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 9ea19da2160..0efb24003e7 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -232,59 +232,6 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): # More builtin classes we don't need to parse. blacklist_rna_class |= {cls for cls in bpy.types.Property.__subclasses__()} - # None of this seems needed anymore, and it's broken anyway with current master (blender 2.79.1)... - """ - _rna = {getattr(bpy.types, cls) for cls in dir(bpy.types)} - - # Classes which are attached to collections can be skipped too, these are api access only. - # XXX This is not true, some of those show in UI, see e.g. tooltip of KeyingSets.active... - #~ for cls in _rna: - #~ for prop in cls.bl_rna.properties: - #~ if prop.type == 'COLLECTION': - #~ prop_cls = prop.srna - #~ if prop_cls is not None: - #~ blacklist_rna_class.add(prop_cls.__class__) - - # Now here is the *ugly* hack! - # Unfortunately, all classes we want to access are not available from bpy.types (OperatorProperties subclasses - # are not here, as they have the same name as matching Operator ones :( ). So we use __subclasses__() calls - # to walk through all rna hierarchy. - # But unregistered classes remain listed by relevant __subclasses__() calls (be it a Py or BPY/RNA bug), - # and obviously the matching RNA struct exists no more, so trying to access their data (even the identifier) - # quickly leads to segfault! - # To address this, we have to blacklist classes which __name__ does not match any __name__ from bpy.types - # (we can't use only RNA identifiers, as some py-defined classes has a different name that rna id, - # and we can't use class object themselves, because OperatorProperties subclasses are not in bpy.types!)... - - _rna_clss_ids = {cls.__name__ for cls in _rna} | {cls.bl_rna.identifier for cls in _rna} - - # All registrable types. - blacklist_rna_class |= {cls for cls in bpy.types.OperatorProperties.__subclasses__() + - bpy.types.Operator.__subclasses__() + - bpy.types.OperatorMacro.__subclasses__() + - bpy.types.Header.__subclasses__() + - bpy.types.Panel.__subclasses__() + - bpy.types.Menu.__subclasses__() + - bpy.types.UIList.__subclasses__() - if cls.__name__ not in _rna_clss_ids} - - # Collect internal operators - # extend with all internal operators - # note that this uses internal api introspection functions - # XXX Do not skip INTERNAL's anymore, some of those ops show up in UI now! - # all possible operator names - #op_ids = (set(cls.bl_rna.identifier for cls in bpy.types.OperatorProperties.__subclasses__()) | - # set(cls.bl_rna.identifier for cls in bpy.types.Operator.__subclasses__()) | - # set(cls.bl_rna.identifier for cls in bpy.types.OperatorMacro.__subclasses__())) - - #get_instance = __import__("_bpy").ops.get_instance - #path_resolve = type(bpy.context).__base__.path_resolve - #for idname in op_ids: - #op = get_instance(idname) - #if 'INTERNAL' in path_resolve(op, "bl_options"): - #blacklist_rna_class.add(idname) - """ - return blacklist_rna_class check_ctxt_rna = check_ctxt_rna_tip = None diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index 13758b4f45c..bbc0c5c8405 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -180,9 +180,8 @@ def enable_addons(addons=None, support=None, disable=False, check_only=False): prefs = bpy.context.preferences used_ext = {ext.module for ext in prefs.addons} - # XXX TEMP WORKAROUND - black_list = {"space_view3d_math_vis", - "object_scatter"} + # In case we need to blacklist some add-ons... + black_list = {} ret = [ mod for mod in addon_utils.modules() |