diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-06 10:10:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-06 10:10:07 +0300 |
commit | 27e0d6cbd03db5d6eeead80953842968b1343e25 (patch) | |
tree | af74f35fbd74131b11b5a4c1978bcf3275136077 /source/blender/editors/space_view3d/space_view3d.c | |
parent | 3314d0bcb65d8c74cd0caccc4e10fb425da2154b (diff) |
Fix image drag and drop
- Dropping now creates empty images w/o holding Ctrl.
- Dropping background images works when cursor over camera.
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 77beadccd5d..15d241a88cc 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -596,10 +596,23 @@ static bool view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEven return 0; } +static bool view3d_ima_bg_is_camera_view(bContext *C) +{ + RegionView3D *rv3d = CTX_wm_region_view3d(C); + if ((rv3d && (rv3d->persp == RV3D_CAMOB))) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d && v3d->camera && v3d->camera->type == OB_CAMERA) { + return true; + } + } + return false; +} + static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { - if (event->ctrl) - return false; + if (view3d_ima_bg_is_camera_view(C)) { + return true; + } if (!ED_view3d_give_base_under_cursor(C, event->mval)) { return view3d_ima_drop_poll(C, drag, event); @@ -609,10 +622,14 @@ static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *ev static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { + if (!view3d_ima_bg_is_camera_view(C)) { + return true; + } + Base *base = ED_view3d_give_base_under_cursor(C, event->mval); /* either holding and ctrl and no object, or dropping to empty */ - if (((base == NULL) && event->ctrl) || + if ((base == NULL) || ((base != NULL) && base->object->type == OB_EMPTY)) { return view3d_ima_drop_poll(C, drag, event); |