I18n: Disambiguate "Light"

"Light" already has multiple contexts, but some were missing:
- In general, "Light" refers to a Blender Light object. In many cases,
  this comes from an `id_type` enum, already using the ID context. Use
  it also for properties that were missing that context.
- In the context of render passes, "Light" is the actual illumination
  factor, not the light emitor. A new "Render Layer" translation
  context is introduced for this purpose as no existing ones are both
  specific and explicit enough.

Issue reported by Hoang Duy Tran.
This commit is contained in:
Damien Picard
2025-01-04 17:16:49 +01:00
committed by Bastien Montagne
parent 1ee31effca
commit 466af92f7a
7 changed files with 20 additions and 7 deletions

View File

@@ -1562,6 +1562,7 @@ class WM_OT_properties_edit(Operator):
id_type: EnumProperty(
name="ID Type",
items=rna_id_type_items,
translation_context=i18n_contexts.id_id,
default='OBJECT',
)
@@ -2764,6 +2765,7 @@ class WM_OT_batch_rename(Operator):
('SCENE', "Scenes", ""),
('BRUSH', "Brushes", ""),
),
translation_context=i18n_contexts.id_id,
description="Type of data to rename",
)

View File

@@ -103,6 +103,7 @@ class VIEWLAYER_PT_workbench_layer_passes_data(ViewLayerButtonsPanel, Panel):
class VIEWLAYER_PT_eevee_next_layer_passes_light(ViewLayerButtonsPanel, Panel):
bl_label = "Light"
bl_translation_context = i18n_contexts.render_layer
bl_parent_id = "VIEWLAYER_PT_layer_passes"
COMPAT_ENGINES = {'BLENDER_EEVEE_NEXT'}
@@ -116,15 +117,15 @@ class VIEWLAYER_PT_eevee_next_layer_passes_light(ViewLayerButtonsPanel, Panel):
view_layer_eevee = view_layer.eevee
col = layout.column(heading="Diffuse", align=True)
col.prop(view_layer, "use_pass_diffuse_direct", text="Light")
col.prop(view_layer, "use_pass_diffuse_direct", text="Light", text_ctxt=i18n_contexts.render_layer)
col.prop(view_layer, "use_pass_diffuse_color", text="Color")
col = layout.column(heading="Specular", align=True)
col.prop(view_layer, "use_pass_glossy_direct", text="Light")
col.prop(view_layer, "use_pass_glossy_direct", text="Light", text_ctxt=i18n_contexts.render_layer)
col.prop(view_layer, "use_pass_glossy_color", text="Color")
col = layout.column(heading="Volume", heading_ctxt=i18n_contexts.id_id, align=True)
col.prop(view_layer_eevee, "use_pass_volume_direct", text="Light")
col.prop(view_layer_eevee, "use_pass_volume_direct", text="Light", text_ctxt=i18n_contexts.render_layer)
col = layout.column(heading="Other", align=True)
col.prop(view_layer, "use_pass_emit", text="Emission")

View File

@@ -140,6 +140,7 @@ const char *BLT_translate_do_new_dataname(const char *msgctxt, const char *msgid
#define BLT_I18NCONTEXT_COLOR "Color"
#define BLT_I18NCONTEXT_CONSTRAINT "Constraint"
#define BLT_I18NCONTEXT_NAVIGATION "Navigation"
#define BLT_I18NCONTEXT_RENDER_LAYER "Render Layer"
#define BLT_I18NCONTEXT_TIME "Time"
#define BLT_I18NCONTEXT_UNIT "Unit"
@@ -213,6 +214,7 @@ struct BLT_i18n_contexts_descriptor {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_COLOR, "color"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_CONSTRAINT, "constraint"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_NAVIGATION, "navigation"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_RENDER_LAYER, "render_layer"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_TIME, "time"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_UNIT, "unit"), \
{ \

View File

@@ -13,6 +13,8 @@
#include "BKE_lib_id.hh"
#include "BLT_translation.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
@@ -2264,6 +2266,7 @@ static void rna_def_ID(BlenderRNA *brna)
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
RNA_def_property_ui_text(prop, "Type", "Type identifier of this data-block");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_enum_items(prop, rna_enum_id_type_items);
RNA_def_property_enum_funcs(prop, "rna_ID_type_get", nullptr, nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);

View File

@@ -10,6 +10,8 @@
#include "BLO_readfile.hh"
#include "BLT_translation.hh"
#include "DNA_space_types.h"
#include "BKE_blendfile_link_append.hh"
@@ -294,6 +296,7 @@ static void rna_def_blendfile_import_item(BlenderRNA *brna)
RNA_def_property_enum_items(prop, rna_enum_id_type_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "ID Type", "ID type of the item");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_enum_funcs(prop, "rna_BlendImportContextItem_id_type_get", nullptr, nullptr);
prop = RNA_def_property(srna, "source_libraries", PROP_COLLECTION, PROP_NONE);

View File

@@ -7863,6 +7863,7 @@ static void rna_def_modifier_nodes_data_block(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
RNA_def_property_enum_items(prop, rna_enum_id_type_items);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);

View File

@@ -459,7 +459,7 @@ static const EnumPropertyItem rna_enum_studio_light_items[] = {
};
static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] = {
RNA_ENUM_ITEM_HEADING(N_("General"), nullptr),
RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_RENDER_LAYER, "General"), nullptr),
{EEVEE_RENDER_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
{EEVEE_RENDER_PASS_EMIT, "EMISSION", 0, "Emission", ""},
{EEVEE_RENDER_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
@@ -467,14 +467,14 @@ static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] =
{EEVEE_RENDER_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
{EEVEE_RENDER_PASS_TRANSPARENT, "TRANSPARENT", 0, "Transparent", ""},
RNA_ENUM_ITEM_HEADING(N_("Light"), nullptr),
RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_RENDER_LAYER, "Light"), nullptr),
{EEVEE_RENDER_PASS_DIFFUSE_LIGHT, "DIFFUSE_LIGHT", 0, "Diffuse Light", ""},
{EEVEE_RENDER_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""},
{EEVEE_RENDER_PASS_SPECULAR_LIGHT, "SPECULAR_LIGHT", 0, "Specular Light", ""},
{EEVEE_RENDER_PASS_SPECULAR_COLOR, "SPECULAR_COLOR", 0, "Specular Color", ""},
{EEVEE_RENDER_PASS_VOLUME_LIGHT, "VOLUME_LIGHT", 0, "Volume Light", ""},
RNA_ENUM_ITEM_HEADING(N_("Data"), nullptr),
RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_RENDER_LAYER, "Data"), nullptr),
{EEVEE_RENDER_PASS_POSITION, "POSITION", 0, "Position", ""},
{EEVEE_RENDER_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
{EEVEE_RENDER_PASS_MIST, "MIST", 0, "Mist", ""},
@@ -482,7 +482,7 @@ static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] =
{EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET, "CryptoAsset", 0, "CryptoAsset", ""},
{EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL, "CryptoMaterial", 0, "CryptoMaterial", ""},
RNA_ENUM_ITEM_HEADING(N_("Shader AOV"), nullptr),
RNA_ENUM_ITEM_HEADING(CTX_N_(BLT_I18NCONTEXT_RENDER_LAYER, "Shader AOV"), nullptr),
{EEVEE_RENDER_PASS_AOV, "AOV", 0, "AOV", ""},
{0, nullptr, 0, nullptr, nullptr},
@@ -4481,6 +4481,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, nullptr, "render_pass");
RNA_def_property_enum_items(prop, rna_enum_view3dshading_render_pass_type_items);
RNA_def_property_ui_text(prop, "Render Pass", "Render Pass to show in the viewport");
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_RENDER_LAYER);
RNA_def_property_enum_funcs(prop,
"rna_3DViewShading_render_pass_get",
"rna_3DViewShading_render_pass_set",