forked from bartvdbraak/blender
Fix uilists showing data names translated (reported on bf-translations ML by Satoshi Yamasaki aka yamyam, thanks!).
This commit is contained in:
parent
32a6a3eb63
commit
23aa0c9067
@ -31,7 +31,8 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
|
|||||||
# You should always start your row layout by a label (icon + text), this will also make the row easily
|
# You should always start your row layout by a label (icon + text), this will also make the row easily
|
||||||
# selectable in the list!
|
# selectable in the list!
|
||||||
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
|
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
|
||||||
layout.label(ma.name if ma else "", icon_value=icon)
|
# Note "data" names should never be translated!
|
||||||
|
layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
|
||||||
# And now we can add other UI stuff...
|
# And now we can add other UI stuff...
|
||||||
# Here, we add nodes info if this material uses (old!) shading nodes.
|
# Here, we add nodes info if this material uses (old!) shading nodes.
|
||||||
if ma and not context.scene.render.use_shading_nodes:
|
if ma and not context.scene.render.use_shading_nodes:
|
||||||
@ -39,15 +40,15 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
|
|||||||
if manode:
|
if manode:
|
||||||
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
|
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
|
||||||
# RNA object.
|
# RNA object.
|
||||||
layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
|
layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
|
||||||
elif ma.use_nodes:
|
elif ma.use_nodes:
|
||||||
layout.label("Node <none>")
|
layout.label(text="Node <none>", translate=False)
|
||||||
else:
|
else:
|
||||||
layout.label("")
|
layout.label(text="")
|
||||||
# 'GRID' layout type should be as compact as possible (typically a single icon!).
|
# 'GRID' layout type should be as compact as possible (typically a single icon!).
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
# And now we can use this list everywhere in Blender. Here is a small example panel.
|
# And now we can use this list everywhere in Blender. Here is a small example panel.
|
||||||
|
@ -60,12 +60,12 @@ class MESH_UL_vgroups(UIList):
|
|||||||
# assert(isinstance(item, bpy.types.VertexGroup)
|
# assert(isinstance(item, bpy.types.VertexGroup)
|
||||||
vgroup = item
|
vgroup = item
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(vgroup.name, icon_value=icon)
|
layout.label(text=vgroup.name, translate=False, icon_value=icon)
|
||||||
icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED'
|
icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED'
|
||||||
layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False)
|
layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class MESH_UL_shape_keys(UIList):
|
class MESH_UL_shape_keys(UIList):
|
||||||
@ -76,30 +76,30 @@ class MESH_UL_shape_keys(UIList):
|
|||||||
key_block = item
|
key_block = item
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
split = layout.split(0.66, False)
|
split = layout.split(0.66, False)
|
||||||
split.label(item.name, icon_value=icon)
|
split.label(text=item.name, translate=False, icon_value=icon)
|
||||||
row = split.row(True)
|
row = split.row(True)
|
||||||
if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')):
|
if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')):
|
||||||
row.active = False
|
row.active = False
|
||||||
if not item.relative_key or index > 0:
|
if not item.relative_key or index > 0:
|
||||||
row.prop(key_block, "value", text="", emboss=False)
|
row.prop(key_block, "value", text="", emboss=False)
|
||||||
else:
|
else:
|
||||||
row.label("")
|
row.label(text="")
|
||||||
row.prop(key_block, "mute", text="", emboss=False)
|
row.prop(key_block, "mute", text="", emboss=False)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class MESH_UL_uvmaps_vcols(UIList):
|
class MESH_UL_uvmaps_vcols(UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
# assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))
|
# assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(item.name, icon_value=icon)
|
layout.label(text=item.name, translate=False, icon_value=icon)
|
||||||
icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON'
|
icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON'
|
||||||
layout.prop(item, "active_render", text="", icon=icon, emboss=False)
|
layout.prop(item, "active_render", text="", icon=icon, emboss=False)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class MeshButtonsPanel():
|
class MeshButtonsPanel():
|
||||||
|
@ -32,7 +32,7 @@ class MASK_UL_layers(UIList):
|
|||||||
mask = item
|
mask = item
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
split.label(mask.name, icon_value=icon)
|
split.label(text=mask.name, translate=False, icon_value=icon)
|
||||||
row = split.row(align=True)
|
row = split.row(align=True)
|
||||||
row.prop(mask, "alpha", text="", emboss=False)
|
row.prop(mask, "alpha", text="", emboss=False)
|
||||||
row.prop(mask, "hide", text="", emboss=False)
|
row.prop(mask, "hide", text="", emboss=False)
|
||||||
@ -40,7 +40,7 @@ class MASK_UL_layers(UIList):
|
|||||||
row.prop(mask, "hide_render", text="", emboss=False)
|
row.prop(mask, "hide_render", text="", emboss=False)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class MASK_PT_mask:
|
class MASK_PT_mask:
|
||||||
|
@ -76,16 +76,18 @@ class MATERIAL_UL_matslots(UIList):
|
|||||||
slot = item
|
slot = item
|
||||||
ma = slot.material
|
ma = slot.material
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(ma.name if ma else "", icon_value=icon)
|
layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
|
||||||
if ma and not context.scene.render.use_shading_nodes:
|
if ma and not context.scene.render.use_shading_nodes:
|
||||||
manode = ma.active_node_material
|
manode = ma.active_node_material
|
||||||
if manode:
|
if manode:
|
||||||
layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
|
layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
|
||||||
elif ma.use_nodes:
|
elif ma.use_nodes:
|
||||||
layout.label("Node <none>")
|
layout.label(text="Node <none>", translate=False)
|
||||||
|
else:
|
||||||
|
layout.label(text="")
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class MaterialButtonsPanel():
|
class MaterialButtonsPanel():
|
||||||
|
@ -33,7 +33,7 @@ class PHYSICS_UL_dynapaint_surfaces(UIList):
|
|||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon_value=icon)
|
row.label(text="", icon_value=icon)
|
||||||
row.label(text=surf.name, icon_value=sticon)
|
row.label(text=surf.name, translate=False, icon_value=sticon)
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
if surf.use_color_preview:
|
if surf.use_color_preview:
|
||||||
row.prop(surf, "show_preview", text="", emboss=False,
|
row.prop(surf, "show_preview", text="", emboss=False,
|
||||||
|
@ -48,17 +48,11 @@ class RENDER_UL_renderlayers(UIList):
|
|||||||
# assert(isinstance(item, bpy.types.SceneRenderLayer)
|
# assert(isinstance(item, bpy.types.SceneRenderLayer)
|
||||||
layer = item
|
layer = item
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(layer.name, icon_value=icon)
|
layout.label(text=layer.name, translate=False, icon_value=icon)
|
||||||
layout.prop(layer, "use", text="", index=index)
|
layout.prop(layer, "use", text="", index=index)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
# else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
|
|
||||||
# uiItemL(sub, name, icon);
|
|
||||||
# uiBlockSetEmboss(block, UI_EMBOSS);
|
|
||||||
# uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL);
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
class RenderButtonsPanel():
|
class RenderButtonsPanel():
|
||||||
|
@ -32,10 +32,10 @@ class SCENE_UL_keying_set_paths(UIList):
|
|||||||
kspath = item
|
kspath = item
|
||||||
icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type)
|
icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type)
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(kspath.data_path, icon_value=icon)
|
layout.label(text=kspath.data_path, translate=False, icon_value=icon)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
class SceneButtonsPanel():
|
class SceneButtonsPanel():
|
||||||
|
@ -63,12 +63,12 @@ class TEXTURE_UL_texslots(UIList):
|
|||||||
slot = item
|
slot = item
|
||||||
tex = slot.texture if slot else None
|
tex = slot.texture if slot else None
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(tex.name if tex else "", icon_value=icon)
|
layout.label(text=tex.name if tex else "", translate=False, icon_value=icon)
|
||||||
if tex and isinstance(item, bpy.types.MaterialTextureSlot):
|
if tex and isinstance(item, bpy.types.MaterialTextureSlot):
|
||||||
layout.prop(ma, "use_textures", text="", index=index)
|
layout.prop(ma, "use_textures", text="", index=index)
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
from bl_ui.properties_material import active_node_mat
|
from bl_ui.properties_material import active_node_mat
|
||||||
|
@ -28,12 +28,10 @@ class CLIP_UL_tracking_objects(UIList):
|
|||||||
# assert(isinstance(item, bpy.types.MovieTrackingObject)
|
# assert(isinstance(item, bpy.types.MovieTrackingObject)
|
||||||
tobj = item
|
tobj = item
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
layout.label(tobj.name, icon='CAMERA_DATA'
|
layout.label(text=tobj.name, translate=False, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
|
||||||
if tobj.is_camera else 'OBJECT_DATA')
|
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon='CAMERA_DATA'
|
layout.label(text="", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
|
||||||
if tobj.is_camera else 'OBJECT_DATA')
|
|
||||||
|
|
||||||
|
|
||||||
class CLIP_HT_header(Header):
|
class CLIP_HT_header(Header):
|
||||||
|
@ -20,7 +20,8 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
|
|||||||
# You should always start your row layout by a label (icon + text), this will also make the row easily
|
# You should always start your row layout by a label (icon + text), this will also make the row easily
|
||||||
# selectable in the list!
|
# selectable in the list!
|
||||||
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
|
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
|
||||||
layout.label(ma.name if ma else "", icon_value=icon)
|
# Note "data" names should never be translated!
|
||||||
|
layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
|
||||||
# And now we can add other UI stuff...
|
# And now we can add other UI stuff...
|
||||||
# Here, we add nodes info if this material uses (old!) shading nodes.
|
# Here, we add nodes info if this material uses (old!) shading nodes.
|
||||||
if ma and not context.scene.render.use_shading_nodes:
|
if ma and not context.scene.render.use_shading_nodes:
|
||||||
@ -28,15 +29,15 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
|
|||||||
if manode:
|
if manode:
|
||||||
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
|
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
|
||||||
# RNA object.
|
# RNA object.
|
||||||
layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
|
layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
|
||||||
elif ma.use_nodes:
|
elif ma.use_nodes:
|
||||||
layout.label("Node <none>")
|
layout.label(text="Node <none>", translate=False)
|
||||||
else:
|
else:
|
||||||
layout.label("")
|
layout.label(text="")
|
||||||
# 'GRID' layout type should be as compact as possible (typically a single icon!).
|
# 'GRID' layout type should be as compact as possible (typically a single icon!).
|
||||||
elif self.layout_type in {'GRID'}:
|
elif self.layout_type in {'GRID'}:
|
||||||
layout.alignment = 'CENTER'
|
layout.alignment = 'CENTER'
|
||||||
layout.label("", icon_value=icon)
|
layout.label(text="", icon_value=icon)
|
||||||
|
|
||||||
|
|
||||||
# And now we can use this list everywhere in Blender. Here is a small example panel.
|
# And now we can use this list everywhere in Blender. Here is a small example panel.
|
||||||
|
Loading…
Reference in New Issue
Block a user