diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/python_api/examples/bpy.types.UIList.1.py | 9 | ||||
-rw-r--r-- | doc/python_api/examples/bpy.types.UIList.2.py | 4 |
2 files changed, 8 insertions, 5 deletions
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'}: |