UI Tweak: "Add to Group" button creates new group if no groups exist

Previously, the "Add to Group" button would show an empty search popup when there were no existing groups. While this does mean that the button behaves differently at different times, this way is more streamlined and should be less confusing than seeing an empty search popup or a greyed out "add to group" button or a "+" button which jumps around in different situations.
This commit is contained in:
Joshua Leung 2013-03-20 01:41:33 +00:00
parent e7c15beaf6
commit 08a7b607f7

@ -162,7 +162,10 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
obj = context.object
row = layout.row(align=True)
row.operator("object.group_link", text="Add to Group")
if bpy.data.groups:
row.operator("object.group_link", text="Add to Group")
else:
row.operator("object.group_add", text="Add to Group")
row.operator("object.group_add", text="", icon='ZOOMIN')
# XXX, this is bad practice, yes, I wrote it :( - campbell