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
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/startup/bl_operators/object.py')
-rw-r--r--release/scripts/startup/bl_operators/object.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 433c4403055..4ade55c0af6 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -691,3 +691,29 @@ class TransformsToDeltasAnim(Operator):
context.scene.frame_set(context.scene.frame_current)
return {'FINISHED'}
+
+
+class DupliOffsetFromCursor(Operator):
+ '''Set offset used for DupliGroup based on cursor position'''
+ bl_idname = "object.dupli_offset_from_cursor"
+ 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
+
+ ob.users_group[group].dupli_offset = scene.cursor_location
+
+ return {'FINISHED'}