Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
| Show First 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | def walk_properties(cls): | ||||
| return True | return True | ||||
| bl_rna = cls.bl_rna | bl_rna = cls.bl_rna | ||||
| # Get our parents' properties, to not export them multiple times. | # Get our parents' properties, to not export them multiple times. | ||||
| bl_rna_base = bl_rna.base | bl_rna_base = bl_rna.base | ||||
| bl_rna_base_props = set() | bl_rna_base_props = set() | ||||
| if bl_rna_base: | if bl_rna_base: | ||||
| bl_rna_base_props |= set(bl_rna_base.properties.values()) | bl_rna_base_props |= set(bl_rna_base.properties.values()) | ||||
| if hasattr(cls, "__bases__"): | |||||
| for cls_base in cls.__bases__: | for cls_base in cls.__bases__: | ||||
| bl_rna_base = getattr(cls_base, "bl_rna", None) | bl_rna_base = getattr(cls_base, "bl_rna", None) | ||||
| if not bl_rna_base: | if not bl_rna_base: | ||||
| continue | continue | ||||
| bl_rna_base_props |= set(bl_rna_base.properties.values()) | bl_rna_base_props |= set(bl_rna_base.properties.values()) | ||||
| props = sorted(bl_rna.properties, key=lambda p: p.identifier) | props = sorted(bl_rna.properties, key=lambda p: p.identifier) | ||||
| for prop in props: | for prop in props: | ||||
| # Only write this property if our parent hasn't got it. | # Only write this property if our parent hasn't got it. | ||||
| if prop in bl_rna_base_props: | if prop in bl_rna_base_props: | ||||
| continue | continue | ||||
| if prop.identifier in {"rna_type", "bl_icon", "icon"}: | if prop.identifier in {"rna_type", "bl_icon", "icon"}: | ||||
| continue | continue | ||||
| ▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | def dump_rna_messages(msgs, reports, settings, verbose=False): | ||||
| # Parse everything (recursively parsing from bpy_struct "class"...). | # Parse everything (recursively parsing from bpy_struct "class"...). | ||||
| process_cls_list(bpy.types.ID.__base__.__subclasses__()) | process_cls_list(bpy.types.ID.__base__.__subclasses__()) | ||||
| # Finalize generated 'operator categories' messages. | # Finalize generated 'operator categories' messages. | ||||
| for cat_str in operator_categories.values(): | for cat_str in operator_categories.values(): | ||||
| process_msg(msgs, bpy.app.translations.contexts.operator_default, cat_str, "Generated operator category", | process_msg(msgs, bpy.app.translations.contexts.operator_default, cat_str, "Generated operator category", | ||||
| reports, check_ctxt_rna, settings) | reports, check_ctxt_rna, settings) | ||||
| # Parse keymap preset preferences | |||||
| for preset_filename in sorted( | |||||
| os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))): | |||||
| preset_path = os.path.join(settings.PRESETS_DIR, "keyconfig", preset_filename) | |||||
| if not (os.path.isfile(preset_path) and preset_filename.endswith(".py")): | |||||
| continue | |||||
| preset_name, _ = os.path.splitext(preset_filename) | |||||
| bpy.utils.keyconfig_set(preset_path) | |||||
| preset = bpy.data.window_managers[0].keyconfigs[preset_name] | |||||
| if preset.preferences is not None: | |||||
| walk_properties(preset.preferences) | |||||
| # And parse keymaps! | # And parse keymaps! | ||||
| from bl_keymap_utils import keymap_hierarchy | from bl_keymap_utils import keymap_hierarchy | ||||
| walk_keymap_hierarchy(keymap_hierarchy.generate(), "KM_HIERARCHY") | walk_keymap_hierarchy(keymap_hierarchy.generate(), "KM_HIERARCHY") | ||||
| ##### Python source code ##### | ##### Python source code ##### | ||||
| def dump_py_messages_from_files(msgs, reports, files, settings): | def dump_py_messages_from_files(msgs, reports, files, settings): | ||||
| """ | """ | ||||
| ▲ Show 20 Lines • Show All 650 Lines • Show Last 20 Lines | |||||