UI: move button to set dupli-offset into group menu

This commit is contained in:
Campbell Barton 2014-08-07 04:36:56 +10:00
parent f37c3dd6a6
commit 1923a5c134
2 changed files with 4 additions and 15 deletions

@ -775,22 +775,15 @@ class DupliOffsetFromCursor(Operator):
bl_label = "Set Offset From Cursor"
bl_options = {'REGISTER', 'UNDO'}
group = IntProperty(
name="Group",
description="Group index to set offset for",
default=0,
)
@classmethod
def poll(cls, context):
return (context.active_object is not None)
def execute(self, context):
scene = context.scene
ob = context.active_object
group = self.group
group = context.group
ob.users_group[group].dupli_offset = scene.cursor_location
group.dupli_offset = scene.cursor_location
return {'FINISHED'}

@ -159,6 +159,8 @@ class GROUP_MT_specials(Menu):
layout.operator("object.group_unlink", icon='X')
layout.operator("object.grouped_select")
layout.operator("object.dupli_offset_from_cursor")
class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
bl_label = "Groups"
@ -175,8 +177,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
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
index = 0
obj_name = obj.name
for group in bpy.data.groups:
# XXX this is slow and stupid!, we need 2 checks, one thats fast
@ -201,10 +201,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
col = split.column()
col.prop(group, "dupli_offset", text="")
props = col.operator("object.dupli_offset_from_cursor", text="From Cursor")
props.group = index
index += 1
class OBJECT_PT_display(ObjectButtonsPanel, Panel):
bl_label = "Display"