diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 94f262f57f5..611095bfe20 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1623,8 +1623,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } } else { - /* Unicode String */ +#ifdef WITH_INTERNATIONAL + bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE; +#else + bool do_translate = false; +#endif /* WITH_INTERNATIONAL */ #ifdef USE_STRING_COERCE PyObject *value_coerce = NULL; @@ -1634,17 +1638,16 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { param = _PyUnicode_AsString(value); -#ifdef WITH_INTERNATIONAL - if (subtype == PROP_TRANSLATE) { - param = IFACE_(param); - } -#endif /* WITH_INTERNATIONAL */ - } #else /* USE_STRING_COERCE */ param = _PyUnicode_AsString(value); #endif /* USE_STRING_COERCE */ + /* Any half-brained compiler should be able to optimize this out when WITH_INTERNATIONAL is off */ + if (do_translate) { + param = IFACE_(param); + } + if (param == NULL) { if (PyUnicode_Check(value)) { /* there was an error assigning a string type, |