diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 23:31:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 23:31:23 +0400 |
commit | a6e78239424fa735fd71dd03a4c9501aa6635d9a (patch) | |
tree | 53fa9564ca5b4718fd3dfe5cd24c22259bc97b7b | |
parent | 5faa29b01dd6b47219d1aabb3217459ba1e2f56d (diff) |
make fly mode border draw into a area drawing callback rather then using a flag (no functional change).
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 50 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 57 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 |
5 files changed, 58 insertions, 54 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 3c34f4cda01..2aec707b4ea 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1647,8 +1647,7 @@ void perspective_m4(float mat[][4],float left, float right, float bottom, float } -/* translate a matrix created by orthographic_m4 or perspective_m4 in viewspace XY coords (used to jitter the view) - * transforms in worldspace coords. */ +/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */ void window_translate_m4(float winmat[][4], float perspmat[][4], float x, float y) { if(winmat[2][3] == -1.0f) { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a6981764afa..4414da222a6 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1886,7 +1886,6 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event) { bAnimContext ac; - Scene *scene; ARegion *ar; View2D *v2d; int mval[2], channel_index; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 871057801f8..6d61123de24 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -926,52 +926,6 @@ void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar) rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); } - -static void drawviewborder_flymode(ARegion *ar) -{ - /* draws 4 edge brackets that frame the safe area where the - mouse can move during fly mode without spinning the view */ - float x1, x2, y1, y2; - - x1= 0.45*(float)ar->winx; - y1= 0.45*(float)ar->winy; - x2= 0.55*(float)ar->winx; - y2= 0.55*(float)ar->winy; - cpack(0); - - - glBegin(GL_LINES); - /* bottom left */ - glVertex2f(x1,y1); - glVertex2f(x1,y1+5); - - glVertex2f(x1,y1); - glVertex2f(x1+5,y1); - - /* top right */ - glVertex2f(x2,y2); - glVertex2f(x2,y2-5); - - glVertex2f(x2,y2); - glVertex2f(x2-5,y2); - - /* top left */ - glVertex2f(x1,y2); - glVertex2f(x1,y2-5); - - glVertex2f(x1,y2); - glVertex2f(x1+5,y2); - - /* bottom right */ - glVertex2f(x2,y1); - glVertex2f(x2,y1+5); - - glVertex2f(x2,y1); - glVertex2f(x2-5,y1); - glEnd(); -} - - static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) { float fac, a; @@ -2456,8 +2410,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) /* Draw particle edit brush XXX (removed) */ - if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d); - if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar); + if(rv3d->persp==RV3D_CAMOB) + drawviewborder(scene, ar, v3d); if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 146e90baeb1..ebfa77a4a15 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -64,6 +64,7 @@ #include "ED_keyframing.h" #include "ED_screen.h" #include "ED_armature.h" +#include "ED_space_api.h" #include "GPU_draw.h" @@ -1973,11 +1974,59 @@ typedef struct FlyInfo { double time_lastwheel; /* used to accelerate when using the mousewheel a lot */ double time_lastdraw; /* time between draws */ + void *draw_handle_pixel; + /* use for some lag */ float dvec_prev[3]; /* old for some lag */ } FlyInfo; +static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg) +{ + FlyInfo *fly = arg; + + /* draws 4 edge brackets that frame the safe area where the + mouse can move during fly mode without spinning the view */ + float x1, x2, y1, y2; + + x1= 0.45*(float)fly->ar->winx; + y1= 0.45*(float)fly->ar->winy; + x2= 0.55*(float)fly->ar->winx; + y2= 0.55*(float)fly->ar->winy; + cpack(0); + + + glBegin(GL_LINES); + /* bottom left */ + glVertex2f(x1,y1); + glVertex2f(x1,y1+5); + + glVertex2f(x1,y1); + glVertex2f(x1+5,y1); + + /* top right */ + glVertex2f(x2,y2); + glVertex2f(x2,y2-5); + + glVertex2f(x2,y2); + glVertex2f(x2-5,y2); + + /* top left */ + glVertex2f(x1,y2); + glVertex2f(x1,y2-5); + + glVertex2f(x1,y2); + glVertex2f(x1+5,y2); + + /* bottom right */ + glVertex2f(x2,y1); + glVertex2f(x2,y1+5); + + glVertex2f(x2,y1); + glVertex2f(x2-5,y1); + glEnd(); +} + /* FlyInfo->state */ #define FLY_RUNNING 0 #define FLY_CANCEL 1 @@ -2029,7 +2078,9 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer(); - fly->rv3d->rflag |= RV3D_FLYMODE|RV3D_NAVIGATING; /* so we draw the corner margins */ + fly->draw_handle_pixel = ED_region_draw_cb_activate(fly->ar->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL); + + fly->rv3d->rflag |= RV3D_NAVIGATING; /* so we draw the corner margins */ /* detect weather to start with Z locking */ upvec[0]=1.0f; upvec[1]=0.0f; upvec[2]=0.0f; @@ -2094,6 +2145,8 @@ static int flyEnd(bContext *C, FlyInfo *fly) WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), fly->timer); + ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel); + rv3d->dist= fly->dist_backup; if (fly->state == FLY_CANCEL) { @@ -2146,7 +2199,7 @@ static int flyEnd(bContext *C, FlyInfo *fly) /*Done with correcting for the dist */ } - rv3d->rflag &= ~(RV3D_FLYMODE|RV3D_NAVIGATING); + rv3d->rflag &= ~RV3D_NAVIGATING; //XXX2.5 BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */ if(fly->obtfm) diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index f692c80f81f..272741fa341 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -228,7 +228,6 @@ typedef struct View3D { #define RV3D_CAMOB 2 /* RegionView3d->rflag */ -#define RV3D_FLYMODE 2 #define RV3D_CLIPPING 4 #define RV3D_NAVIGATING 8 #define RV3D_GPULIGHT_UPDATE 16 |