diff options
author | Martin Poirier <theeth@yahoo.com> | 2005-08-23 22:13:30 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2005-08-23 22:13:30 +0400 |
commit | e12e2469c8e2e0f0229af5bbc611ea76238d6d34 (patch) | |
tree | 9e59a65aa7d77db81d49a2cc66b88ca331b4c9af /source/blender/src/drawimage.c | |
parent | 207cbbd535743e2505ce5f66d91f3d771800e0c5 (diff) |
Bretch's patch for 2D transform. Thanks
Using new transform code to handle UV window.
With the ground work done, Transform could more easily be extended to handle IPO window now.
Tracker item: http://projects.blender.org/tracker/?func=detail&atid=127&aid=2946&group_id=9
Diffstat (limited to 'source/blender/src/drawimage.c')
-rw-r--r-- | source/blender/src/drawimage.c | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 3fac54390b4..7897f95a197 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -80,6 +80,7 @@ #include "BIF_glutil.h" #include "BIF_space.h" #include "BIF_screen.h" +#include "BIF_transform.h" #include "BSE_trans_types.h" #include "BSE_view.h" @@ -89,8 +90,6 @@ #include "blendef.h" #include "butspace.h" // event codes -float prop_cent[3]= {0.0, 0.0, 0.0}, prop_size= 0.1; - /** * Sets up the fields of the View2D member of the SpaceImage struct * This routine can be called in two modes: @@ -239,7 +238,7 @@ void uvco_to_areaco(float *vec, short *mval) } } -void uvco_to_areaco_noclip(float *vec, short *mval) +void uvco_to_areaco_noclip(float *vec, int *mval) { float x, y; @@ -509,28 +508,12 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, return rectmain; } -/* now only in use by drawimage.c */ -static void draw_prop_circle() -{ - if (G.scene->proportional) { - float tmat[4][4], imat[4][4]; - - if(G.moving) { - BIF_ThemeColor(TH_GRID); - - mygetmatrix(tmat); - Mat4Invert(imat, tmat); - - drawcircball(GL_LINE_LOOP, prop_cent, prop_size, imat); - } - } -} - -static void draw_image_prop_circle(ImBuf *ibuf) +static void draw_image_transform(ImBuf *ibuf) { - float aspx, aspy; + if(G.moving) { + float aspx, aspy, center[3]; - if(G.moving && G.scene->proportional) { + BIF_drawConstraint(); if(ibuf==0 || ibuf->rect==0 || ibuf->x==0 || ibuf->y==0) { aspx= aspy= 1.0; @@ -540,12 +523,16 @@ static void draw_image_prop_circle(ImBuf *ibuf) aspy= 256.0/ibuf->y; } + BIF_getPropCenter(center); + /* scale and translate the circle into place and draw it */ glPushMatrix(); glScalef(aspx, aspy, 1.0); - glTranslatef((1/aspx)*prop_cent[0] - prop_cent[0], - (1/aspy)*prop_cent[1] - prop_cent[1], 0.0); - draw_prop_circle(); + glTranslatef((1/aspx)*center[0] - center[0], + (1/aspy)*center[1] - center[1], 0.0); + + BIF_drawPropCircle(); + glPopMatrix(); } } @@ -937,7 +924,7 @@ void drawimagespace(ScrArea *sa, void *spacedata) calc_image_view(G.sima, 'f'); /* float */ } - draw_image_prop_circle(ibuf); + draw_image_transform(ibuf); myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375); draw_image_view_icon(); @@ -1111,7 +1098,7 @@ void image_viewcentre(void) if(size<=0.01) size= 0.01; - G.sima->zoom= 1.0/size; + G.sima->zoom= 0.7/size; calc_image_view(G.sima, 'p'); |