make fly mode border draw into a area drawing callback rather then using a flag (no functional change).

This commit is contained in:
Campbell Barton 2010-10-02 19:31:23 +00:00
parent 5faa29b01d
commit a6e7823942
5 changed files with 58 additions and 54 deletions

@ -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) {

@ -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;

@ -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) */

@ -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)

@ -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