Skip to content

Commit

Permalink
Little fixes to "instances to cursor" operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Nakoryakov committed Aug 20, 2015
1 parent 3edf2e2 commit e2781cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Bargool_1D_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "",
"author": "Aleksey Nakoryakov, Paul Kotelevets aka 1D_Inc (concept design)",
"category": "Object",
"version": (1, 3, 1),
"version": (1, 3, 2),
"location": "View3D > Toolbar",
"wiki_url": "https://github.com/bargool/Bargool_1D_tools",
"tracker_url": "https://github.com/bargool/Bargool_1D_tools/issues",
Expand Down
8 changes: 6 additions & 2 deletions Bargool_1D_tools/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,24 @@ def execute(self, context):
class InstancesToCursourOperator(bpy.types.Operator):
bl_idname = 'object.instances_to_cursor'
bl_label = 'Instances to cursor'
bl_description = 'Creates instances of each selected mesh into cursor position'
bl_description = 'Creates instances of each selected multiuser into cursor position'
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
scene = context.scene
cursor_location = scene.cursor_location
selected_multiuser = [o for o in context.selected_objects if is_multiuser(o)]
for o in context.selected_objects:
o.select = False
objects = {}
# We need only one object of each seleceted mesh
for o in context.selected_objects:
for o in selected_multiuser:
if o.data.name not in objects:
objects[o.data.name] = o

for v in objects.values():
duplicated = create_instance(v, scene)
duplicated.location = cursor_location
duplicated.select = True

return {'FINISHED'}

0 comments on commit e2781cd

Please sign in to comment.