diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-19 23:37:22 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-19 23:37:22 +0400 |
commit | d39c6fdf2d7efbb3560038184f43f6bf882c5049 (patch) | |
tree | 2850fde8813f530a89094b675976ca94415b4166 /source/blender/makesrna/intern/rna_rna.c | |
parent | 5c48eb3bb9c42ba06f40d7b6d1c83b76d90d6a67 (diff) |
Various cleanup around default i18n context.
Issue is that the real default context is NULL, however, in python and RNA, this value can't be used easily. So we use a specific string instead ("*"), defined as BLF_I18NCONTEXT_DEFAULT_BPYRNA.
From now on, all bpy/rna code should only use the BLF_I18NCONTEXT_DEFAULT_BPYRNA value, while all "usual" C code should use the BLF_I18NCONTEXT_DEFAULT value (BLF_pgettext is still able to "understand" both, anyway).
Also added BLF_is_default_context helper func, so that we can keep that check in a single place!
Finally, we should no need anymore to understand the void string "" as default context too - two values for a same thing are more than enough!
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 17b01de1eeb..67fc3056485 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -141,12 +141,12 @@ static int rna_Struct_name_length(PointerRNA *ptr) static void rna_Struct_translation_context_get(PointerRNA *ptr, char *value) { - strcpy(value, ((StructRNA *)ptr->data)->translation_context ? ((StructRNA *)ptr->data)->translation_context : ""); + strcpy(value, ((StructRNA *)ptr->data)->translation_context); } static int rna_Struct_translation_context_length(PointerRNA *ptr) { - return ((StructRNA *)ptr->data)->translation_context ? strlen(((StructRNA *)ptr->data)->translation_context) : 0; + return strlen(((StructRNA *)ptr->data)->translation_context); } static PointerRNA rna_Struct_base_get(PointerRNA *ptr) @@ -491,14 +491,14 @@ static void rna_Property_translation_context_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; rna_idproperty_check(&prop, ptr); - strcpy(value, prop->translation_context ? prop->translation_context : ""); + strcpy(value, prop->translation_context); } static int rna_Property_translation_context_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; rna_idproperty_check(&prop, ptr); - return prop->translation_context ? strlen(prop->translation_context) : 0; + return strlen(prop->translation_context); } static int rna_Property_type_get(PointerRNA *ptr) |