Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-11-23 23:37:23 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-11-23 23:54:32 +0400
commit4c52e737df39e538d3b41a232035a4a1e240505d (patch)
tree3381fcad45e1749524289cc10f597af5419fafc8 /doc
parent500934690791acca431782c1e59f8f4671c0e03e (diff)
Add ctrl-click rename to most lists in Blender UI and templates/examples.
Notes: * Did not touch to addons, that's up to the authors. ;) * Did not removed any "name" field below lists. We might want to do this in some cases (less UI clutter), but probably not always, so will let maintainers of the related areas decide here.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bpy.types.UIList.1.py9
-rw-r--r--doc/python_api/examples/bpy.types.UIList.2.py4
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'}: