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.
This commit is contained in:
@@ -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:
|
||||
|
@@ -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'}:
|
||||
|
Reference in New Issue
Block a user