8
$\begingroup$

After duplication, objects automaticaly follow the mouse pointer, is there a way to disable this behavior?

$\endgroup$
0
9
$\begingroup$

As per the wiki when you duplicate an object in Blender..

..this will create a visually identical copy of the selected object(s). The copy is created at the same position as the original object and you are automatically placed in Grab mode..

I don't think this is possible out of the box with Blender the way you are asking. At most, you can hit Esc after you duplicate an object or right click to cancel the grab.


If you insist however, it is possible to write a small script and add this to the 3D View's header and register shortcuts etc.

Looking at the API reference, I found a function bpy.ops.object.duplicate() that says Duplicate selected objects. You can put this into a small script and register some shortcuts for ease of use. (it's not perfect code but it works)

import bpy

class Duplicate(bpy.types.Operator):
    bl_idname = "object.duplicate_no_drag"
    bl_label = "Duplicate"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        scene = context.scene
        obj = scene.objects.active
        bpy.ops.object.duplicate()
        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator(Duplicate.bl_idname)

addon_kmaps = []

def register():
    bpy.utils.register_class(Duplicate)
    bpy.types.VIEW3D_MT_object.append(menu_func)

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
    kmi = km.keymap_items.new(Duplicate.bl_idname, 'D', 'PRESS', ctrl=True, shift=True)
    addon_kmaps.append(km)

def unregister():
    bpy.utils.unregister_class(Duplicate)
    bpy.types.VIEW3D_MT_object.remove(menu_func)

    wm = bpy.context.window_manager
    for km in addon_kmaps:
        wm.keyconfigs.addon.kmaps.remove(km)
    del addon_kmaps[:]

if __name__ == "__main__":
    register()

If you run this, you should get a new menu item.

enter image description here

Additionally, you can call it with ShiftCtrl + D and you should now be able to duplicate objects and not enter grab mode.


Also, while writing this script, it's worth noting that if you use the console or the text editor and run the command that is behind the default 'duplicate objects' command..

bpy.ops.object.duplicate_move()

it duplicates the selected object and doesn't enter grab mode. This is because of the context that's given to the operator to run in. In the 3D View it is run in the context 'INVOKE_DEFAULT' if you run it from a script or from the console it gets run in the context 'EXEC_DEFAULT'. Look at the API reference for more info about this. Thanks to jasperge for the explanation.

$\endgroup$
1
  • 1
    $\begingroup$ Nice! that objects duplication feels more natural to me. $\endgroup$ – rraallvv Jun 27 '13 at 2:46
2
$\begingroup$
  1. Go into your Edit > Preferences
  2. Search for the command Duplicate,
  3. Open tab Duplicate Objects under Object Mode,
  4. Erase the _move part in the command text.
  5. Press Enter

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.