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:
authorJacques Lucke <mail@jlucke.com>2018-10-16 12:17:32 +0300
committerJacques Lucke <mail@jlucke.com>2018-10-16 12:18:16 +0300
commit09cd651bb7e59044cbcd0664e8b1064cb37734ed (patch)
tree7a4b97c1bf7ab0463681ccbe0fe981608e9f8b52 /source/blender/editors/space_view3d/space_view3d.c
parentf807371c3e2d344375f10c3d3e330128598f5314 (diff)
View 3D: fix image dropping in 3d view
Reviewers: brecht Differential Revision: https://developer.blender.org/D3798
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index f1394933c26..9c6a876714a 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -597,32 +597,34 @@ static bool view3d_ima_bg_is_camera_view(bContext *C)
static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **tooltip)
{
- if (view3d_ima_bg_is_camera_view(C)) {
- return true;
+ if (!view3d_ima_drop_poll(C, drag, event, tooltip)) {
+ return false;
}
- if (!ED_view3d_give_base_under_cursor(C, event->mval)) {
- return view3d_ima_drop_poll(C, drag, event, tooltip);
+ if (ED_view3d_there_is_an_object_under_cursor(C, event->mval)) {
+ return false;
}
- return 0;
+
+ return view3d_ima_bg_is_camera_view(C);
}
static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event, const char **tooltip)
{
- if (!view3d_ima_bg_is_camera_view(C)) {
- return true;
+ if (!view3d_ima_drop_poll(C, drag, event, tooltip)) {
+ return false;
}
- Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
+ Object *ob = ED_view3d_give_object_under_cursor(C, event->mval);
- /* either holding and ctrl and no object, or dropping to empty */
- if ((base == NULL) ||
- ((base != NULL) && base->object->type == OB_EMPTY))
- {
- return view3d_ima_drop_poll(C, drag, event, tooltip);
+ if (ob == NULL) {
+ return true;
}
- return 0;
+ if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
+ return true;
+ }
+
+ return false;
}
static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)
@@ -688,8 +690,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, "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_drop_named_image", view3d_ima_empty_drop_poll, view3d_id_path_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_collection_instance_add", view3d_collection_drop_poll, view3d_collection_drop_copy);
}