Commit: cf92d83c0a33873155571f8fe6ca5de28c834a75
Author: Bastien Montagne
Date: Wed Feb 13 16:32:58 2019 +0100
Branches: master
https://developer.blender.org/rBcf92d83c0a33873155571f8fe6ca5de28c834a75
Fix T61446: (second part) Some items in editor and mode selectors are not
translatable.
That one is utterly ugly fix really, but unfortunately a proper one
would require some changes to our RNA (or more precisely, pyrna) code,
so that when we subscript a dynamically generated RNA collection, the
item is somehow duplicated (and probably 'assigned' to its py object?),
before the temp RNA array memory is freed...
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py
b/release/scripts/startup/bl_ui/space_view3d.py
index a644be0abf0..bb4a63d042c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -52,13 +52,22 @@ class VIEW3D_HT_header(Header):
object_mode = 'OBJECT' if obj is None else obj.mode
+ # Note: This is actually deadly in case enum_items have to be
dynamically generated
+ # (because internal RNA array iterator will free everything
immediately...).
+ # XXX This is an RNA internal issue, not sure how to fix it.
+ # Note: Tried to add an accessor to get translated UI strings instead
of manual call
+ # to pgettext_iface below, but this fails because translated
enumitems
+ # are always dynamically allocated.
act_mode_item =
bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode]
+ act_mode_i18n_context =
bpy.types.Object.bl_rna.properties["mode"].translation_context
row.separator()
sub = row.row()
sub.ui_units_x = 5.5
- sub.operator_menu_enum("object.mode_set", "mode",
text=act_mode_item.name, icon=act_mode_item.icon)
+ sub.operator_menu_enum("object.mode_set", "mode",
+
text=bpy.app.translations.pgettext_iface(act_mode_item.name,
act_mode_i18n_context),
+ icon=act_mode_item.icon)
del act_mode_item
layout.template_header_3D_mode()
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs