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:
authorMatt Ebb <matt@mke3.net>2010-09-01 17:41:53 +0400
committerMatt Ebb <matt@mke3.net>2010-09-01 17:41:53 +0400
commitb49bd51bc827e39e5d02606ccaedbc037dd4896f (patch)
tree4d47c92e4f5bc3d46b02b11233887fac12ceae80 /source/blender/editors/space_view3d/space_view3d.c
parenta89c526a92a9f3568d4c0dad139d608518edecbb (diff)
Quicky - allow dragging an image on a 3d view background
to set it as the background image. Dragging on an object still sets it to face-mapped texture.
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 1e035797bea..a85881dd76b 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -409,16 +409,31 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
+ if(drag->type==WM_DRAG_ID) {
+ ID *id= (ID *)drag->poin;
+ if( GS(id->name)==ID_IM )
+ return 1;
+ }
+ else if(drag->type==WM_DRAG_PATH){
+ if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
+ return 1;
+ }
+ 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) ) {
- if(drag->type==WM_DRAG_ID) {
- ID *id= (ID *)drag->poin;
- if( GS(id->name)==ID_IM )
- return 1;
- }
- else if(drag->type==WM_DRAG_PATH){
- if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
- return 1;
- }
+ return 0;
+ }
+ return view3d_ima_drop_poll(C, drag, event);
+}
+
+static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ return view3d_ima_drop_poll(C, drag, event);
}
return 0;
}
@@ -461,7 +476,8 @@ static void view3d_dropboxes(void)
WM_dropbox_add(lb, "OBJECT_OT_add_named_cursor", 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_drop_poll, view3d_id_path_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_add_background_image", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy);
}