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:
authorCampbell Barton <ideasman42@gmail.com>2013-02-25 03:18:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-02-25 03:18:21 +0400
commit4e1ea1f9fd84fa37513165689fdc3edbb11f0856 (patch)
tree497f78daa1c549273ec4715e40640ef9740e4c04 /source/blender/editors/space_view3d/space_view3d.c
parent83e53afb18b0bae4cfc21dcabc14a5720494af0e (diff)
patch [#34411] Patch for image drag and drop to create Empty rather than BG image
from Kevin Mackay (yakca)
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 658196a1bd4..2ed1ec694d8 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -514,22 +514,24 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS
}
-static int view3d_ima_bg_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) ) {
- return 0;
- }
- return view3d_ima_drop_poll(C, drag, event);
-}
+ Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
-static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
-{
- if (ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ if (!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;
+}
+
static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id = (ID *)drag->poin;
@@ -570,8 +572,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, "VIEW3D_OT_background_image_add", view3d_ima_bg_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, "OBJECT_OT_group_instance_add", view3d_group_drop_poll, view3d_group_drop_copy);
}