diff --git a/doc/python_api/examples/bpy.types.UIList.1.py b/doc/python_api/examples/bpy.types.UIList.1.py index 88f6b0999cd..92b115b2af4 100644 --- a/doc/python_api/examples/bpy.types.UIList.1.py +++ b/doc/python_api/examples/bpy.types.UIList.1.py @@ -32,11 +32,14 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList): ma = slot.material # draw_item must handle the three layout types... Usually 'DEFAULT' and 'COMPACT' can share the same code. if self.layout_type in {'DEFAULT', 'COMPACT'}: - # You should always start your row layout by a label (icon + text), this will also make the row easily - # selectable in the list! + # You should always start your row layout by a label (icon + text), or a non-embossed text field, + # this will also make the row easily selectable in the list! The later also enables ctrl-click rename. # We use icon_value of label, as our given icon is an integer value, not an enum ID. # Note "data" names should never be translated! - layout.label(text=ma.name if ma else "", translate=False, icon_value=icon) + if ma: + layout.prop(ma, "name", text="", emboss=False, icon_value=icon) + else: + layout.label(text="", translate=False, icon_value=icon) # And now we can add other UI stuff... # Here, we add nodes info if this material uses (old!) shading nodes. if ma and not context.scene.render.use_shading_nodes: diff --git a/doc/python_api/examples/bpy.types.UIList.2.py b/doc/python_api/examples/bpy.types.UIList.2.py index 4e30e6895d6..feed263b2e7 100644 --- a/doc/python_api/examples/bpy.types.UIList.2.py +++ b/doc/python_api/examples/bpy.types.UIList.2.py @@ -49,9 +49,9 @@ class MESH_UL_vgroups_slow(bpy.types.UIList): col = layout.column() col.enabled = False col.alignment = 'LEFT' - col.label(text=vgroup.name, translate=False, icon_value=icon) + col.prop(vgroup, "name", text="", emboss=False, icon_value=icon) else: - layout.label(text=vgroup.name, translate=False, icon_value=icon) + layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon) icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED' layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False) elif self.layout_type in {'GRID'}: diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 0ec22323092..87f745dc4a1 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -80,7 +80,7 @@ class MESH_UL_shape_keys(UIList): key_block = item if self.layout_type in {'DEFAULT', 'COMPACT'}: split = layout.split(0.66, False) - split.label(text=item.name, translate=False, icon_value=icon) + split.prop(key_block, "name", text="", emboss=False, icon_value=icon) row = split.row(align=True) if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')): row.active = False @@ -98,7 +98,7 @@ class MESH_UL_uvmaps_vcols(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer)) if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=item.name, translate=False, icon_value=icon) + layout.prop(item, "name", text="", emboss=False, icon_value=icon) icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON' layout.prop(item, "active_render", text="", icon=icon, emboss=False) elif self.layout_type in {'GRID'}: diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index a57567ae79e..607e4cc521e 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -97,7 +97,7 @@ class RENDERLAYER_UL_linesets(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): lineset = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(lineset.name, icon_value=icon) + layout.prop(lineset, "name", text="", emboss=False, icon_value=icon) layout.prop(lineset, "show_render", text="", index=index) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index 203e5078ee4..b6f3cf93531 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -31,7 +31,7 @@ class MASK_UL_layers(UIList): # assert(isinstance(item, bpy.types.MaskLayer) mask = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=mask.name, translate=False, icon_value=icon) + layout.prop(mask, "name", text="", emboss=False, icon_value=icon) row = layout.row(align=True) row.prop(mask, "hide", text="", emboss=False) row.prop(mask, "hide_select", text="", emboss=False) diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 344074c5893..d48c4957e6e 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -77,7 +77,10 @@ class MATERIAL_UL_matslots(UIList): slot = item ma = slot.material if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=ma.name if ma else "", translate=False, icon_value=icon) + if ma: + layout.prop(ma, "name", text="", emboss=False, icon_value=icon) + else: + layout.label(text="", icon_value=icon) if ma and not context.scene.render.use_shading_nodes: manode = ma.active_node_material if manode: diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index f0c7a532414..898e385ce3d 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -33,7 +33,7 @@ class PHYSICS_UL_dynapaint_surfaces(UIList): if self.layout_type in {'DEFAULT', 'COMPACT'}: row = layout.row(align=True) row.label(text="", icon_value=icon) - row.label(text=surf.name, translate=False, icon_value=sticon) + row.prop(surf, "name", text="", emboss=False, icon_value=sticon) row = layout.row(align=True) if surf.use_color_preview: row.prop(surf, "show_preview", text="", emboss=False, diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py b/release/scripts/startup/bl_ui/properties_render_layer.py index dcc4508f086..6a44feeaac6 100644 --- a/release/scripts/startup/bl_ui/properties_render_layer.py +++ b/release/scripts/startup/bl_ui/properties_render_layer.py @@ -38,7 +38,7 @@ class RENDERLAYER_UL_renderlayers(UIList): # assert(isinstance(item, bpy.types.SceneRenderLayer) layer = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(layer.name, icon_value=icon, translate=False) + layout.prop(layer, "name", text="", icon_value=icon, emboss=False) layout.prop(layer, "use", text="", index=index) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 91a5abd0ad0..34143c77998 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -33,6 +33,7 @@ class SCENE_UL_keying_set_paths(UIList): kspath = item icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type) if self.layout_type in {'DEFAULT', 'COMPACT'}: + # Do not make this one editable in uiList for now... layout.label(text=kspath.data_path, translate=False, icon_value=icon) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 023b3a13848..c03ea1c5422 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -63,7 +63,10 @@ class TEXTURE_UL_texslots(UIList): slot = item tex = slot.texture if slot else None if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=tex.name if tex else "", translate=False, icon_value=icon) + if tex: + layout.prop(tex, "name", text="", emboss=False, icon_value=icon) + else: + layout.label(text="", icon_value=icon) if tex and isinstance(item, bpy.types.MaterialTextureSlot): layout.prop(ma, "use_textures", text="", index=index) elif self.layout_type in {'GRID'}: diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 3db8697a457..19f1563c4fb 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -29,9 +29,9 @@ class CLIP_UL_tracking_objects(UIList): # assert(isinstance(item, bpy.types.MovieTrackingObject) tobj = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.label(text=tobj.name, translate=False, - icon='CAMERA_DATA' if tobj.is_camera - else 'OBJECT_DATA') + layout.prop(tobj, "name", text="", emboss=False, + icon='CAMERA_DATA' if tobj.is_camera + else 'OBJECT_DATA') elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 46234b638eb..9750d7bac0d 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -410,7 +410,7 @@ class NODE_UL_interface_sockets(bpy.types.UIList): if not socket.is_output: row.template_node_socket(color) - row.label(text=socket.name, icon_value=icon) + row.prop(socket, "name", text="", emboss=False, icon_value=icon) # outputs get icon on the right if socket.is_output: diff --git a/release/scripts/templates_py/ui_list_simple.py b/release/scripts/templates_py/ui_list_simple.py index 815d62ad734..e911a0dd236 100644 --- a/release/scripts/templates_py/ui_list_simple.py +++ b/release/scripts/templates_py/ui_list_simple.py @@ -20,11 +20,14 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList): ma = slot.material # draw_item must handle the three layout types... Usually 'DEFAULT' and 'COMPACT' can share the same code. if self.layout_type in {'DEFAULT', 'COMPACT'}: - # You should always start your row layout by a label (icon + text), this will also make the row easily - # selectable in the list! + # You should always start your row layout by a label (icon + text), or a non-embossed text field, + # this will also make the row easily selectable in the list! The later also enables ctrl-click rename. # We use icon_value of label, as our given icon is an integer value, not an enum ID. # Note "data" names should never be translated! - layout.label(text=ma.name if ma else "", translate=False, icon_value=icon) + if ma: + layout.prop(ma, "name", text="", emboss=False, icon_value=icon) + else: + layout.label(text="", translate=False, icon_value=icon) # And now we can add other UI stuff... # Here, we add nodes info if this material uses (old!) shading nodes. if ma and not context.scene.render.use_shading_nodes: