diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 94815fadcc7..dd79b165aac 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -964,6 +964,68 @@ def dump_template_messages(msgs, reports, settings): ) +def dump_ocio_config(msgs, reports, settings): + # This assumes the default Blender config is used when we extract messages. + import PyOpenColorIO as OCIO + config = OCIO.GetCurrentConfig() + + for display in config.getDisplays(): + msgsrc = "Display name from OCIO config" + process_msg( + msgs, settings.DEFAULT_CONTEXT, display, msgsrc, + reports, None, settings, + ) + + for view in config.getViews(display): + msgsrc = "View name from OCIO display " + display + process_msg( + msgs, settings.DEFAULT_CONTEXT, view, msgsrc, + reports, None, settings, + ) + + description = config.getDisplayViewDescription(display, view) + msgsrc = "View description from OCIO display " + display + process_msg( + msgs, settings.DEFAULT_CONTEXT, description, msgsrc, + reports, None, settings, + ) + + for look in config.getLookNames(): + # Some looks include their view's name to have unique names, + # we need to keep only the look. + if " - " in look: + view, name = look.split(" - ") + source = "OCIO view " + view + else: + name = look + source = "OCIO config" + msgsrc = "Look name from " + source + process_msg( + msgs, settings.DEFAULT_CONTEXT, name, msgsrc, + reports, None, settings, + ) + msgsrc = "Look description from " + source + description = config.getLook(look).getDescription() + process_msg( + msgs, settings.DEFAULT_CONTEXT, description, msgsrc, + reports, None, settings, + ) + + for colorspace in config.getColorSpaces(): + name = colorspace.getName() + msgsrc = "Colorspace name from OCIO config" + process_msg( + msgs, settings.DEFAULT_CONTEXT, name, msgsrc, + reports, None, settings, + ) + description = colorspace.getDescription() + msgsrc = "Colorspace description from OCIO config" + process_msg( + msgs, settings.DEFAULT_CONTEXT, description, msgsrc, + reports, None, settings, + ) + + def dump_asset_messages(msgs, reports, settings): # Where to search for assets, relative to the local user resources. assets_dir = os.path.join(bpy.utils.resource_path('LOCAL'), "datafiles", "assets") @@ -1158,6 +1220,9 @@ def dump_messages(do_messages, do_checks, settings): reports, None, settings, ) + # Get strings from OCIO config. + dump_ocio_config(msgs, reports, settings) + # Get strings from asset catalogs and blend files. # This loads each asset blend file in turn. dump_asset_messages(msgs, reports, settings)