diff options
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 658196a1bd4..57755231240 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -513,20 +513,34 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS return 0; } - static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { - if (ED_view3d_give_base_under_cursor(C, event->mval) ) { - return 0; + if (event->ctrl) + return false; + + if (!ED_view3d_give_base_under_cursor(C, event->mval)) { + return view3d_ima_drop_poll(C, drag, event); } - return view3d_ima_drop_poll(C, drag, event); + return 0; } -static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { - if (ED_view3d_give_base_under_cursor(C, event->mval) ) { + Base *base = ED_view3d_give_base_under_cursor(C, event->mval); + + /* either holding and ctrl and no object, or dropping to empty */ + if ((event->ctrl && !base) || (base && base->object->type == OB_EMPTY)) + return view3d_ima_drop_poll(C, drag, event); + + return 0; +} + +static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +{ + Base *base = ED_view3d_give_base_under_cursor(C, event->mval); + + if (base && base->object->type == OB_MESH) return view3d_ima_drop_poll(C, drag, event); - } return 0; } @@ -570,7 +584,8 @@ static void view3d_dropboxes(void) WM_dropbox_add(lb, "OBJECT_OT_add_named", view3d_ob_drop_poll, view3d_ob_drop_copy); WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy); - WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_ob_drop_poll, view3d_id_path_drop_copy); + WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_mesh_drop_poll, view3d_id_path_drop_copy); + WM_dropbox_add(lb, "OBJECT_OT_drop_named_image", view3d_ima_empty_drop_poll, view3d_id_path_drop_copy); WM_dropbox_add(lb, "VIEW3D_OT_background_image_add", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy); WM_dropbox_add(lb, "OBJECT_OT_group_instance_add", view3d_group_drop_poll, view3d_group_drop_copy); } |