Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r--source/blender/python/intern/bpy_rna.c17
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..85a6db00703 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1623,8 +1623,10 @@ 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;
+#endif /* WITH_INTERNATIONAL */
#ifdef USE_STRING_COERCE
PyObject *value_coerce = NULL;
@@ -1634,17 +1636,18 @@ 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 */
+#ifdef WITH_INTERNATIONAL
+ if (do_translate) {
+ param = IFACE_(param);
+ }
+#endif
+
if (param == NULL) {
if (PyUnicode_Check(value)) {
/* there was an error assigning a string type,