diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-13 18:32:58 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-13 18:32:58 +0300 |
commit | cf92d83c0a33873155571f8fe6ca5de28c834a75 (patch) | |
tree | b77c1970a90d1afd409af058344f64a74b9fe88b /release/scripts/startup/bl_ui/space_view3d.py | |
parent | 10efc54729f054f72377c4a7a16c99d50c2cf81e (diff) |
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...
Diffstat (limited to 'release/scripts/startup/bl_ui/space_view3d.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 11 |
1 files changed, 10 insertions, 1 deletions
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() |