diff options
author | Matt Ebb <matt@mke3.net> | 2006-08-13 16:01:07 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2006-08-13 16:01:07 +0400 |
commit | 28f23d9b81ee194794b0ea088be076c24ceabbfb (patch) | |
tree | c7e810d929dd8a25bc12c146c2ace24d58786be3 /source/blender/src/editnode.c | |
parent | 4718a22cd01d10ec9712323cf7050a11d0ae3ba2 (diff) |
* Added Shift MMB in the node editor to pan the backdrop image display
Diffstat (limited to 'source/blender/src/editnode.c')
-rw-r--r-- | source/blender/src/editnode.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index 535f94ef585..55b93c47cda 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -54,6 +54,7 @@ #include "BKE_scene.h" #include "BKE_utildefines.h" +#include "BIF_cursors.h" #include "BIF_editview.h" #include "BIF_gl.h" #include "BIF_graphics.h" @@ -78,11 +79,13 @@ #include "BDR_editobject.h" #include "RE_pipeline.h" +#include "IMB_imbuf_types.h" #include "blendef.h" #include "butspace.h" #include "PIL_time.h" #include "mydevice.h" +#include "winlay.h" /* currently called from BIF_preview_changed */ @@ -697,6 +700,9 @@ void snode_home(ScrArea *sa, SpaceNode *snode) } } snode->v2d.tot= snode->v2d.cur; + + snode->xof = snode->yof = 0.0; + test_view2d(G.v2d, sa->winx, sa->winy); } @@ -727,6 +733,65 @@ void snode_zoom_in(ScrArea *sa) test_view2d(G.v2d, sa->winx, sa->winy); } +static void snode_bg_viewmove(SpaceNode *snode) +{ + ScrArea *sa; + short mval[2], mvalo[2]; + short rectx, recty, xmin, xmax, ymin, ymax, pad; + Window *win; + int oldcursor; + Image *ima; + + ima= (Image *)find_id("IM", "Viewer Node"); + + sa = snode->area; + + if(ima && ima->ibuf) { + rectx = ima->ibuf->x; + recty = ima->ibuf->y; + } else { + rectx = recty = 1; + } + + pad = 10; + xmin = -(sa->winx/2) - rectx/2 + pad; + xmax = sa->winx/2 + rectx/2 - pad; + ymin = -(sa->winy/2) - recty/2 + pad; + ymax = sa->winy/2 + recty/2 - pad; + + getmouseco_sc(mvalo); + + /* store the old cursor to temporarily change it */ + oldcursor=get_cursor(); + win=winlay_get_active_window(); + + SetBlenderCursor(BC_NSEW_SCROLLCURSOR); + + while(get_mbut()&(L_MOUSE|M_MOUSE)) { + + getmouseco_sc(mval); + + if(mvalo[0]!=mval[0] || mvalo[1]!=mval[1]) { + + snode->xof -= (mvalo[0]-mval[0]); + snode->yof -= (mvalo[1]-mval[1]); + + /* prevent dragging image outside of the window and losing it! */ + CLAMP(snode->xof, xmin, xmax); + CLAMP(snode->yof, ymin, ymax); + + mvalo[0]= mval[0]; + mvalo[1]= mval[1]; + + scrarea_do_windraw(curarea); + screen_swapbuffers(); + } + else BIF_wait_for_statechange(); + } + + window_set_cursor(win, oldcursor); +} + /* checks mouse position, and returns found node/socket */ /* type is SOCK_IN and/or SOCK_OUT */ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, int in_out) @@ -1838,6 +1903,11 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case MIDDLEMOUSE: + if (G.qual==LR_SHIFTKEY) { + snode_bg_viewmove(snode); + } else { + view2dmove(event); + } case WHEELUPMOUSE: case WHEELDOWNMOUSE: view2dmove(event); /* in drawipo.c */ |