I18N Messages: fix confusion with Light meanings.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 12 Feb 2019 21:13:42 +0000 (22:13 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 12 Feb 2019 21:15:27 +0000 (22:15 +0100)
Using ID_LIGHT or ID_ID for "Lamp" meaning, "Light" without context
being for 'not heavy'.

That rename of data-block was not really nice on that side of things :/

Related to T43295.

source/blender/blenkernel/intern/object.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_select.c
source/blender/editors/object/object_shader_fx.c
source/blender/makesrna/intern/rna_lamp.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_shader_fx.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c

index 3d6cc05..fe04fa6 100644 (file)
@@ -770,7 +770,7 @@ static const char *get_obdata_defname(int type)
                case OB_FONT: return DATA_("Text");
                case OB_MBALL: return DATA_("Mball");
                case OB_CAMERA: return DATA_("Camera");
-               case OB_LAMP: return DATA_("Light");
+               case OB_LAMP: return CTX_DATA_(BLT_I18NCONTEXT_ID_LIGHT, "Light");
                case OB_LATTICE: return DATA_("Lattice");
                case OB_ARMATURE: return DATA_("Armature");
                case OB_SPEAKER: return DATA_("Speaker");
index bd2405c..0262237 100644 (file)
@@ -2268,7 +2268,8 @@ void uiTemplatePreview(
                                          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
                        }
                        else if (GS(parent->name) == ID_LA) {
-                               uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"),  0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+                               uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, CTX_IFACE_(BLT_I18NCONTEXT_ID_LIGHT, "Light"),
+                                         0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
                                          pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
                        }
                        else if (GS(parent->name) == ID_WO) {
index 71575c3..2931fb8 100644 (file)
@@ -464,7 +464,8 @@ void OBJECT_OT_add(wmOperatorType *ot)
 
        /* properties */
        ED_object_add_unit_props_radius(ot);
-       RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+       PropertyRNA *prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 0, "Type", "");
+       RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 
        ED_object_add_generic_props(ot, true);
 }
index 1eccdfb..aed0749 100644 (file)
@@ -427,6 +427,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
        /* properties */
        RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first");
        ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 1, "Type", "");
+       RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);
 }
 
 /*********************** Selection by Links *********************/
index 7a70e91..a19c79d 100644 (file)
@@ -36,6 +36,8 @@
 #include "BLI_string_utf8.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_main.h"
 #include "BKE_shader_fx.h"
@@ -254,8 +256,6 @@ static const EnumPropertyItem *shaderfx_add_itemf(
 
 void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
 {
-       PropertyRNA *prop;
-
        /* identifiers */
        ot->name = "Add Effect";
        ot->description = "Add a visual effect to the active object";
@@ -270,9 +270,9 @@ void OBJECT_OT_shaderfx_add(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
-       prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
-       RNA_def_enum_funcs(prop, shaderfx_add_itemf);
-       ot->prop = prop;
+       ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_shaderfx_type_items, eShaderFxType_Blur, "Type", "");
+       RNA_def_enum_funcs(ot->prop, shaderfx_add_itemf);
+       RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ID);  /* Abused, for "Light"... */
 }
 
 /************************ generic functions for operators using names and data context *********************/
index 8ee80ce..0aa1a32 100644 (file)
@@ -120,6 +120,7 @@ static void rna_def_light(BlenderRNA *brna)
        RNA_def_struct_sdna(srna, "Lamp");
        RNA_def_struct_refine_func(srna, "rna_Light_refine");
        RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
+       RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_LIGHT);
        RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
 
        prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
index 01d4b54..97b3223 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_camera.h"
 #include "BKE_collection.h"
 #include "BKE_paint.h"
@@ -2142,6 +2144,7 @@ static void rna_def_object(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, rna_enum_object_type_items);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Type", "Type of Object");
+       RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 
        prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "mode");
index 62c1ea6..d989bf9 100644 (file)
@@ -657,6 +657,7 @@ void RNA_def_shader_fx(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "type");
        RNA_def_property_enum_items(prop, rna_enum_object_shaderfx_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
+       RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);  /* Abused, for "Light"... */
 
        /* flags */
        prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
index d36a27b..ddf6ca0 100644 (file)
@@ -2399,6 +2399,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "filter_id_type");
        RNA_def_property_enum_items(prop, rna_enum_id_type_items);
        RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
+       RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
 }
 
 static void rna_def_space_view3d_shading(BlenderRNA *brna)
index d3986dd..714f11a 100644 (file)
@@ -30,6 +30,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_math_base.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_appdir.h"
 #include "BKE_sound.h"
 #include "BKE_addon.h"
@@ -1852,6 +1854,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "lamp");
        RNA_def_property_array(prop, 4);
        RNA_def_property_ui_text(prop, "Light", "");
+       RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);