forked from bartvdbraak/blender
made MMB pan instead of mouselook requested by plumiferos director.
This commit is contained in:
parent
b4bd6cc9db
commit
275a5a94b9
@ -2111,7 +2111,8 @@ void fly(void)
|
|||||||
double time_current, time_lastdraw;
|
double time_current, time_lastdraw;
|
||||||
|
|
||||||
short val, /* used for toets to see if a buttons pressed */
|
short val, /* used for toets to see if a buttons pressed */
|
||||||
cent[2], /* view center */
|
cent_orig[2], /* view center */
|
||||||
|
cent[2], /* view center modified */
|
||||||
mval[2], /* mouse location */
|
mval[2], /* mouse location */
|
||||||
action=0, /* while zero stay in fly mode and wait for action, also used to see if we accepted or canceled 1:ok 2:Cancel */
|
action=0, /* while zero stay in fly mode and wait for action, also used to see if we accepted or canceled 1:ok 2:Cancel */
|
||||||
xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
|
xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
|
||||||
@ -2120,8 +2121,8 @@ void fly(void)
|
|||||||
unsigned char
|
unsigned char
|
||||||
apply_rotation= 1, /* if the user presses shift they can look about without movinf the direction there looking*/
|
apply_rotation= 1, /* if the user presses shift they can look about without movinf the direction there looking*/
|
||||||
axis= 2, /* Axis index to move allong by default Z to move allong the view */
|
axis= 2, /* Axis index to move allong by default Z to move allong the view */
|
||||||
persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
|
persp_backup, /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
|
||||||
|
pan_view=0; /* if true, pan the view instead of rotating */
|
||||||
|
|
||||||
/* relative view axis locking - xlock, zlock
|
/* relative view axis locking - xlock, zlock
|
||||||
0; disabled
|
0; disabled
|
||||||
@ -2193,10 +2194,10 @@ void fly(void)
|
|||||||
xmargin= (short)((float)(curarea->winx)/20.0);
|
xmargin= (short)((float)(curarea->winx)/20.0);
|
||||||
ymargin= (short)((float)(curarea->winy)/20.0);
|
ymargin= (short)((float)(curarea->winy)/20.0);
|
||||||
|
|
||||||
cent[0]= curarea->winrct.xmin+(curarea->winx)/2;
|
cent_orig[0]= curarea->winrct.xmin+(curarea->winx)/2;
|
||||||
cent[1]= curarea->winrct.ymin+(curarea->winy)/2;
|
cent_orig[1]= curarea->winrct.ymin+(curarea->winy)/2;
|
||||||
|
|
||||||
warp_pointer(cent[0], cent[1]);
|
warp_pointer(cent_orig[0], cent_orig[1]);
|
||||||
|
|
||||||
/* we have to rely on events to give proper mousecoords after a warp_pointer */
|
/* we have to rely on events to give proper mousecoords after a warp_pointer */
|
||||||
mval[0]= cent[0]= (curarea->winx)/2;
|
mval[0]= cent[0]= (curarea->winx)/2;
|
||||||
@ -2234,7 +2235,9 @@ void fly(void)
|
|||||||
} else if (toets==MIDDLEMOUSE) {
|
} else if (toets==MIDDLEMOUSE) {
|
||||||
/* make it so the camera direction dosent follow the view
|
/* make it so the camera direction dosent follow the view
|
||||||
good for flying backwards! - Only when MMB is held */
|
good for flying backwards! - Only when MMB is held */
|
||||||
apply_rotation=0;
|
|
||||||
|
/*apply_rotation=0;*/
|
||||||
|
pan_view= 1;
|
||||||
|
|
||||||
/* impliment WASD keys */
|
/* impliment WASD keys */
|
||||||
} else if(toets==WKEY) {
|
} else if(toets==WKEY) {
|
||||||
@ -2276,8 +2279,10 @@ void fly(void)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* mouse buttons lifted */
|
/* mouse buttons lifted */
|
||||||
if (toets==MIDDLEMOUSE) {
|
if (toets==MIDDLEMOUSE && pan_view) {
|
||||||
apply_rotation=1;
|
/*apply_rotation=1;*/
|
||||||
|
warp_pointer(cent_orig[0], cent_orig[1]);
|
||||||
|
pan_view= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2307,7 +2312,7 @@ void fly(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Should we redraw? */
|
/* Should we redraw? */
|
||||||
if(speed!=0.0 || moffset[0] || moffset[1] || zlock || xlock ) {
|
if(speed!=0.0 || moffset[0] || moffset[1] || zlock || xlock || dvec[0] || dvec[1] || dvec[2] ) {
|
||||||
|
|
||||||
time_current= PIL_check_seconds_timer();
|
time_current= PIL_check_seconds_timer();
|
||||||
time_redraw= (float)(time_current-time_lastdraw);
|
time_redraw= (float)(time_current-time_lastdraw);
|
||||||
@ -2322,6 +2327,17 @@ void fly(void)
|
|||||||
|
|
||||||
Mat3CpyMat4(mat, G.vd->viewinv);
|
Mat3CpyMat4(mat, G.vd->viewinv);
|
||||||
|
|
||||||
|
if (pan_view) {
|
||||||
|
/* pan only */
|
||||||
|
dvec_tmp[0]= -moffset[0];
|
||||||
|
dvec_tmp[1]= -moffset[1];
|
||||||
|
dvec_tmp[2]= 0;
|
||||||
|
/* z axis can stay teh same, just keep costing */
|
||||||
|
|
||||||
|
Mat3MulVecfl(mat, dvec_tmp);
|
||||||
|
VecMulf(dvec_tmp, time_redraw*200.0 * G.vd->grid);
|
||||||
|
|
||||||
|
} else {
|
||||||
/* rotate about the X axis- look up/down */
|
/* rotate about the X axis- look up/down */
|
||||||
if (moffset[1]) {
|
if (moffset[1]) {
|
||||||
upvec[0]=1;
|
upvec[0]=1;
|
||||||
@ -2418,6 +2434,7 @@ void fly(void)
|
|||||||
|
|
||||||
VecMulf(dvec_tmp, speed*time_redraw*0.5);
|
VecMulf(dvec_tmp, speed*time_redraw*0.5);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* impose a directional lag */
|
/* impose a directional lag */
|
||||||
dvec_lag = 1.0/(1+(time_redraw*5));
|
dvec_lag = 1.0/(1+(time_redraw*5));
|
||||||
@ -2426,7 +2443,7 @@ void fly(void)
|
|||||||
dvec[2] = dvec_tmp[2]*(1-dvec_lag) + dvec_old[2]*dvec_lag;
|
dvec[2] = dvec_tmp[2]*(1-dvec_lag) + dvec_old[2]*dvec_lag;
|
||||||
|
|
||||||
VecAddf(G.vd->ofs, G.vd->ofs, dvec);
|
VecAddf(G.vd->ofs, G.vd->ofs, dvec);
|
||||||
headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X/Z, Slow:Shift, Direction:WASDRF, Ok:LMB, MouseLook:MMB, Cancel:RMB");
|
headerprint("FlyKeys Speed:(+/- | Wheel), Upright Axis:X/Z, Slow:Shift, Direction:WASDRF, Ok:LMB, Pan:MMB, Cancel:RMB");
|
||||||
|
|
||||||
do_screenhandlers(G.curscreen); /* advance the next frame */
|
do_screenhandlers(G.curscreen); /* advance the next frame */
|
||||||
|
|
||||||
@ -2508,7 +2525,6 @@ void fly(void)
|
|||||||
BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
|
BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void view3d_edit_clipping(View3D *v3d)
|
void view3d_edit_clipping(View3D *v3d)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user