diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-11 00:41:37 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-11 00:41:37 +0300 |
commit | d594594cbe9c9eb3bc3c8a7708601e68693d324d (patch) | |
tree | f8d7156197e1d5d5e27156d0dbe11a8b94671bf0 /source/blender/src/interface.c | |
parent | a0a3597b8b0d5be7a9161046cb1f8b4a60f44a35 (diff) |
Orange: more work on float/exr buffers;
- EXR now saves and reads Zbuffers correctly
- EXR reading didn't set alpha to 1 yet when no alpha buffer was present
- ImageWindow: the "black point" only checked for the r value... now is OK
- ImageWindow: Curves panal has button "reset"
- ImageWindow: hold LMB drag shows rgba and z values. With SHIFT or CTRL it
applies black/white point whilte dragging too
- ImageWindow: saving file copied the entire buffer... removed that. Also
made the header print clear; this save only saves in own file type.
- Curves: zoom and drag now gets clamped by the Clipping value
- Imbuf: duplicate buffer only copied one quarter of to new buffer
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r-- | source/blender/src/interface.c | 192 |
1 files changed, 102 insertions, 90 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 05d7718da90..106286648b9 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -3335,6 +3335,8 @@ static int ui_do_but_CURVE(uiBut *but) CurveMap *cuma= cumap->cm+cumap->cur; CurveMapPoint *cmp= cuma->curve; float fx, fy, zoomx, zoomy, offsx, offsy; + float dist, mindist= 200.0f; // 14 pixels radius + int a, sel= -1, retval= but->retval; short mval[2], mvalo[2]; uiGetMouse(mywinget(), mval); @@ -3356,113 +3358,123 @@ static int ui_do_but_CURVE(uiBut *but) ui_draw_but(but); ui_block_flush_back(but->block); } - else { - float dist, mindist= 200.0f; // 14 pixels radius - int a, sel= -1; - - - /* check for selecting of a point */ - for(a=0; a<cuma->totpoint; a++) { - fx= but->x1 + zoomx*(cmp[a].x-offsx); - fy= but->y1 + zoomy*(cmp[a].y-offsy); - dist= (fx-mval[0])*(fx-mval[0]) + (fy-mval[1])*(fy-mval[1]); - if(dist < mindist) { - sel= a; - mindist= dist; - } + + + /* check for selecting of a point */ + cmp= cuma->curve; /* ctrl adds point, new malloc */ + for(a=0; a<cuma->totpoint; a++) { + fx= but->x1 + zoomx*(cmp[a].x-offsx); + fy= but->y1 + zoomy*(cmp[a].y-offsy); + dist= (fx-mval[0])*(fx-mval[0]) + (fy-mval[1])*(fy-mval[1]); + if(dist < mindist) { + sel= a; + mindist= dist; } - /* ok, we move a point */ - if(sel!= -1) { - int moved_point; - int moved_mouse= 0; + } + /* ok, we move a point */ + if(sel!= -1) { + int moved_point; + int moved_mouse= 0; - /* deselect all if this one is deselect. except if we hold shift */ - if((G.qual & LR_SHIFTKEY)==0 && (cmp[sel].flag & SELECT)==0) - for(a=0; a<cuma->totpoint; a++) - cmp[a].flag &= ~SELECT; - cmp[sel].flag |= SELECT; + /* deselect all if this one is deselect. except if we hold shift */ + if((G.qual & LR_SHIFTKEY)==0 && (cmp[sel].flag & SELECT)==0) + for(a=0; a<cuma->totpoint; a++) + cmp[a].flag &= ~SELECT; + cmp[sel].flag |= SELECT; + + /* draw to show select updates */ + ui_draw_but(but); + ui_block_flush_back(but->block); + + /* while move mouse, do move points around */ + while(get_mbut() & L_MOUSE) { - /* draw to show select updates */ - ui_draw_but(but); - ui_block_flush_back(but->block); + uiGetMouse(mywinget(), mvalo); - /* while move mouse, do move points around */ - while(get_mbut() & L_MOUSE) { + if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) { + moved_mouse= 1; /* for selection */ + moved_point= 0; /* for ctrl grid, can't use orig coords because of sorting */ - uiGetMouse(mywinget(), mvalo); - - if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) { - moved_mouse= 1; /* for selection */ - moved_point= 0; /* for ctrl grid, can't use orig coords because of sorting */ - - fx= (mvalo[0]-mval[0])/zoomx; - fy= (mvalo[1]-mval[1])/zoomy; - for(a=0; a<cuma->totpoint; a++) { - if(cmp[a].flag & SELECT) { - float origx= cmp[a].x, origy= cmp[a].y; - cmp[a].x+= fx; - cmp[a].y+= fy; - if( (get_qual() & LR_SHIFTKEY) ) { - cmp[a].x= 0.125f*floor(0.5f + 8.0f*cmp[a].x); - cmp[a].y= 0.125f*floor(0.5f + 8.0f*cmp[a].y); - } - if(cmp[a].x!=origx || cmp[a].y!=origy) - moved_point= 1; + fx= (mvalo[0]-mval[0])/zoomx; + fy= (mvalo[1]-mval[1])/zoomy; + for(a=0; a<cuma->totpoint; a++) { + if(cmp[a].flag & SELECT) { + float origx= cmp[a].x, origy= cmp[a].y; + cmp[a].x+= fx; + cmp[a].y+= fy; + if( (get_qual() & LR_SHIFTKEY) ) { + cmp[a].x= 0.125f*floor(0.5f + 8.0f*cmp[a].x); + cmp[a].y= 0.125f*floor(0.5f + 8.0f*cmp[a].y); } - } - curvemapping_changed(cumap, 0); /* no remove doubles */ - - ui_draw_but(but); - ui_block_flush_back(but->block); - - if(moved_point) { - mval[0]= mvalo[0]; - mval[1]= mvalo[1]; + if(cmp[a].x!=origx || cmp[a].y!=origy) + moved_point= 1; } } - BIF_wait_for_statechange(); - } - - if(moved_mouse==0) { - /* deselect all, select one */ - if((G.qual & LR_SHIFTKEY)==0) { - for(a=0; a<cuma->totpoint; a++) - cmp[a].flag &= ~SELECT; - cmp[sel].flag |= SELECT; - } - } - else - curvemapping_changed(cumap, 1); /* remove doubles */ - - ui_draw_but(but); - ui_block_flush_back(but->block); - } - else { - /* we move the view */ - while(get_mbut() & L_MOUSE) { + curvemapping_changed(cumap, 0); /* no remove doubles */ - uiGetMouse(mywinget(), mvalo); + ui_draw_but(but); + ui_block_flush_back(but->block); - if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) { - fx= (mvalo[0]-mval[0])/zoomx; - fy= (mvalo[1]-mval[1])/zoomy; - cumap->curr.xmin-=fx; - cumap->curr.ymin-=fy; - cumap->curr.xmax-=fx; - cumap->curr.ymax-=fy; - - ui_draw_but(but); - ui_block_flush_back(but->block); - + if(moved_point) { mval[0]= mvalo[0]; mval[1]= mvalo[1]; } } BIF_wait_for_statechange(); } + + if(moved_mouse==0) { + /* deselect all, select one */ + if((G.qual & LR_SHIFTKEY)==0) { + for(a=0; a<cuma->totpoint; a++) + cmp[a].flag &= ~SELECT; + cmp[sel].flag |= SELECT; + } + } + else + curvemapping_changed(cumap, 1); /* remove doubles */ + + ui_draw_but(but); + ui_block_flush_back(but->block); + } + else { + /* we move the view */ + retval= B_NOP; + + while(get_mbut() & L_MOUSE) { + + uiGetMouse(mywinget(), mvalo); + + if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) { + fx= (mvalo[0]-mval[0])/zoomx; + fy= (mvalo[1]-mval[1])/zoomy; + + /* clamp for clip */ + if(cumap->curr.xmin-fx < cumap->clipr.xmin) + fx= cumap->curr.xmin - cumap->clipr.xmin; + else if(cumap->curr.xmax-fx > cumap->clipr.xmax) + fx= cumap->curr.xmax - cumap->clipr.xmax; + if(cumap->curr.ymin-fy < cumap->clipr.ymin) + fy= cumap->curr.ymin - cumap->clipr.ymin; + else if(cumap->curr.ymax-fy > cumap->clipr.ymax) + fy= cumap->curr.ymax - cumap->clipr.ymax; + + cumap->curr.xmin-=fx; + cumap->curr.ymin-=fy; + cumap->curr.xmax-=fx; + cumap->curr.ymax-=fy; + + ui_draw_but(but); + ui_block_flush_back(but->block); + + mval[0]= mvalo[0]; + mval[1]= mvalo[1]; + } + } + BIF_wait_for_statechange(); } - return but->retval; + return retval; } /* ************************************************ */ @@ -4031,7 +4043,7 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent) else sl->blockscale-= 0.1; CLAMP(sl->blockscale, 0.6, 1.0); addqueue(block->winq, REDRAW, 1); - retval= UI_CONT; + retval= UI_RETURN_OK; } } } |