Move "From Cursor" operator which sets dupli group offset to own operator

Previously it used to use cursor location from time when panel was drawn,
which in some cases lead to using previous cursor location instead of current.
This commit is contained in:
2012-04-13 12:14:20 +00:00
parent 44258c3c9a
commit 54e648d114
2 changed files with 28 additions and 4 deletions

View File

@@ -162,7 +162,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
# XXX, this is bad practice, yes, I wrote it :( - campbell
index = 0
value = str(tuple(context.scene.cursor_location))
for group in bpy.data.groups:
if ob.name in group.objects:
col = layout.column(align=True)
@@ -181,9 +180,8 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
col = split.column()
col.prop(group, "dupli_offset", text="")
props = col.operator("wm.context_set_value", text="From Cursor")
props.data_path = "object.users_group[%d].dupli_offset" % index
props.value = value
props = col.operator("object.dupli_offset_from_cursor", text="From Cursor")
props.index = index
index += 1