Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-04-16 12:48:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-04-16 12:48:49 +0400
commit83c540189691afce0557b1588121564f615e4275 (patch)
tree28e8a215a0425dcb7f946cc60f811cbcc598bdec /source/blender/src/view.c
parent6b2a65a3b6d75e5d599717ef8b48eff6275dbbdb (diff)
replace magic numbers with constants for (G.vd->persp), view naming was also using persp as a flag which worked but isnt correct.
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r--source/blender/src/view.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index c8833b1cff3..4500e8b62e7 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -643,7 +643,7 @@ void viewmoveNDOFfly(int mode)
// until the first draw and doesn't update the menu
// to reflect persp mode.
- G.vd->persp = 1;
+ G.vd->persp = V3D_PERSP;
// Correct the distance jump if G.vd->dist != 0
@@ -819,15 +819,15 @@ void viewmove(int mode)
if(G.vd->view!=0) scrarea_queue_headredraw(curarea); /*for button */
G.vd->view= 0;
}
- if(G.vd->persp==2 && mode!=1 && G.vd->camera) {
- G.vd->persp= 1;
+ if(G.vd->persp==V3D_CAMOB && mode!=1 && G.vd->camera) {
+ G.vd->persp= V3D_PERSP;
scrarea_do_windraw(curarea);
scrarea_queue_headredraw(curarea);
}
}
if(mode==0) { /* view rotate */
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 1;
+ if (U.uiflag & USER_AUTOPERSP) G.vd->persp= V3D_PERSP;
if (U.flag & USER_TRACKBALL) mvalball[0]= mval[0];
mvalball[1]= mval[1];
@@ -927,7 +927,7 @@ void viewmove(int mode)
}
}
else if(mode==1) { /* translate */
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
float max= (float)MAX2(curarea->winx, curarea->winy);
G.vd->camdx += (mvalo[0]-mval[0])/(max);
@@ -947,7 +947,7 @@ void viewmove(int mode)
/* use initial value (do not use mvalo (that is used to detect mouse moviments)) */
mvalo[0] = mvali[0];
mvalo[1] = mvali[1];
-
+
if(U.viewzoom==USER_ZOOM_CONT) {
// oldstyle zoom
zfac = 1.0+(float)(mvalo[0]-mval[0]+mvalo[1]-mval[1])/1000.0;
@@ -977,9 +977,9 @@ void viewmove(int mode)
/* these limits are in toets.c too */
if(G.vd->dist<0.001*G.vd->grid) G.vd->dist= 0.001*G.vd->grid;
if(G.vd->dist>10.0*G.vd->far) G.vd->dist=10.0*G.vd->far;
-
- if(G.vd->persp==0 || G.vd->persp==2) preview3d_event= 0;
}
+ if(G.vd->persp==V3D_ORTHO || G.vd->persp==V3D_CAMOB) preview3d_event= 0;
+
mvalo[0]= mval[0];
mvalo[1]= mval[1];
@@ -1138,7 +1138,7 @@ void viewmoveNDOF(int mode)
fval[6] = fval[6] / 1000000.0f;
// scale more if not in perspective mode
- if (G.vd->persp == 0) {
+ if (G.vd->persp == V3D_ORTHO) {
fval[0] = fval[0] * 0.05f;
fval[1] = fval[1] * 0.05f;
fval[2] = fval[2] * 0.05f;
@@ -1185,8 +1185,8 @@ void viewmoveNDOF(int mode)
*/
len = zsens * sbadjust * fval[2];
- if (G.vd->persp==2) {
- if(G.vd->persp==2) {
+ if (G.vd->persp==V3D_CAMOB) {
+ if(G.vd->persp==V3D_CAMOB) { /* This is stupid, please fix - TODO */
G.vd->camzoom+= 10.0f * -len;
}
if (G.vd->camzoom < minZoom) G.vd->camzoom = minZoom;
@@ -1300,10 +1300,10 @@ int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta,
/*
* Cant use this since we need the fac and x1 values set
- * if(G.vd->persp==2)
+ * if(G.vd->persp==V3D_CAMOB)
object_view_settings(G.vd->camera, &lens, &(*clipsta), &(*clipend));*/
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
if(G.vd->camera) {
if(G.vd->camera->type==OB_LAMP ) {
Lamp *la;
@@ -1326,7 +1326,7 @@ int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta,
}
}
- if(G.vd->persp==0) {
+ if(G.vd->persp==V3D_ORTHO) {
if(winx>winy) x1= -G.vd->dist;
else x1= -winx*G.vd->dist/winy;
x2= -x1;
@@ -1341,7 +1341,7 @@ int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta,
}
else {
/* fac for zoom, also used for camdx */
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
fac= (1.41421+( (float)G.vd->camzoom )/50.0);
fac*= fac;
}
@@ -1457,7 +1457,7 @@ void obmat_to_viewmat(Object *ob, short smooth)
Mat3CpyMat4(tmat, G.vd->viewmat);
if (smooth) {
float new_quat[4];
- if (G.vd->persp==2 && G.vd->camera) {
+ if (G.vd->persp==V3D_CAMOB && G.vd->camera) {
/* were from a camera view */
float orig_ofs[3];
@@ -1468,13 +1468,13 @@ void obmat_to_viewmat(Object *ob, short smooth)
/* Switch from camera view */
Mat3ToQuat(tmat, new_quat);
- G.vd->persp=1;
+ G.vd->persp=V3D_PERSP;
G.vd->dist= 0.0;
view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
smooth_view(G.vd, orig_ofs, new_quat, &orig_dist, &orig_lens);
- G.vd->persp=2; /* just to be polite, not needed */
+ G.vd->persp=V3D_CAMOB; /* just to be polite, not needed */
} else {
Mat3ToQuat(tmat, new_quat);
@@ -1488,7 +1488,7 @@ void obmat_to_viewmat(Object *ob, short smooth)
/* dont set windows active in in here, is used by renderwin too */
void setviewmatrixview3d()
{
- if(G.vd->persp>=2) { /* obs/camera */
+ if(G.vd->persp==V3D_CAMOB) { /* obs/camera */
if(G.vd->camera) {
where_is_object(G.vd->camera);
obmat_to_viewmat(G.vd->camera, 0);
@@ -1501,7 +1501,7 @@ void setviewmatrixview3d()
else {
QuatToMat4(G.vd->viewquat, G.vd->viewmat);
- if(G.vd->persp==1) G.vd->viewmat[3][2]-= G.vd->dist;
+ if(G.vd->persp==V3D_PERSP) G.vd->viewmat[3][2]-= G.vd->dist;
if(G.vd->ob_centre) {
Object *ob= G.vd->ob_centre;
float vec[3];
@@ -1760,7 +1760,7 @@ void initlocalview()
G.vd->dist*= size;
}
- if (G.vd->persp>1) G.vd->persp= 1;
+ if (G.vd->persp==V3D_CAMOB) G.vd->persp= V3D_PERSP;
if (G.vd->near> 0.1) G.vd->near= 0.1;
G.vd->cursor[0]= -G.vd->ofs[0];
@@ -1889,16 +1889,16 @@ void centerview() /* like a localview without local! */
G.vd->cursor[1]= -new_ofs[1];
G.vd->cursor[2]= -new_ofs[2];
- if (G.vd->persp==2 && G.vd->camera) {
+ if (G.vd->persp==V3D_CAMOB && G.vd->camera) {
float orig_lens= G.vd->lens;
- G.vd->persp=1;
+ G.vd->persp=V3D_PERSP;
G.vd->dist= 0.0;
view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
smooth_view(G.vd, new_ofs, NULL, &new_dist, &orig_lens);
} else {
- if(G.vd->persp>=2)
- G.vd->persp= 1;
+ if(G.vd->persp==V3D_CAMOB)
+ G.vd->persp= V3D_PERSP;
smooth_view(G.vd, new_ofs, NULL, &new_dist, NULL);
}
@@ -2013,17 +2013,17 @@ void view3d_home(int center)
new_dist*= size;
}
- if (G.vd->persp==2 && G.vd->camera) {
+ if (G.vd->persp==V3D_CAMOB && G.vd->camera) {
/* switch out of camera view */
float orig_lens= G.vd->lens;
- G.vd->persp=1;
+ G.vd->persp= V3D_PERSP;
G.vd->dist= 0.0;
view_settings_from_ob(G.vd->camera, G.vd->ofs, NULL, NULL, &G.vd->lens);
smooth_view(G.vd, new_ofs, NULL, &new_dist, &orig_lens);
} else {
- if(G.vd->persp>=2) G.vd->persp= 1;
+ if(G.vd->persp==V3D_CAMOB) G.vd->persp= V3D_PERSP;
smooth_view(G.vd, new_ofs, NULL, &new_dist, NULL);
}
scrarea_queue_winredraw(curarea);
@@ -2050,19 +2050,19 @@ void view3d_align_axis_to_vector(View3D *v3d, int axisidx, float vec[3])
v3d->view= 0;
- if (v3d->persp==2 && v3d->camera) {
+ if (v3d->persp==V3D_CAMOB && v3d->camera) {
/* switch out of camera view */
float orig_ofs[3];
float orig_dist= v3d->dist;
float orig_lens= v3d->lens;
VECCOPY(orig_ofs, v3d->ofs);
- G.vd->persp=1;
+ G.vd->persp= V3D_PERSP;
G.vd->dist= 0.0;
view_settings_from_ob(v3d->camera, v3d->ofs, NULL, NULL, &v3d->lens);
smooth_view(G.vd, orig_ofs, new_quat, &orig_dist, &orig_lens);
} else {
- if (v3d->persp>=2) v3d->persp= 1; /* switch out of camera mode */
+ if (v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP; /* switch out of camera mode */
smooth_view(v3d, NULL, new_quat, NULL, NULL);
}
}
@@ -2237,7 +2237,7 @@ void view_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, flo
* */
void smooth_view_to_camera(View3D *v3d)
{
- if (!U.smooth_viewtx || !v3d->camera || G.vd->persp != 2) {
+ if (!U.smooth_viewtx || !v3d->camera || G.vd->persp != V3D_CAMOB) {
return;
} else {
Object *ob = v3d->camera;
@@ -2254,13 +2254,13 @@ void smooth_view_to_camera(View3D *v3d)
view_settings_from_ob(ob, new_ofs, new_quat, NULL, &new_lens);
- G.vd->persp=1;
+ G.vd->persp= V3D_PERSP;
smooth_view(v3d, new_ofs, new_quat, &new_dist, &new_lens);
VECCOPY(v3d->ofs, orig_ofs);
v3d->lens= orig_lens;
v3d->dist = orig_dist; /* restore the dist */
v3d->camera = ob;
- v3d->persp=2;
+ v3d->persp= V3D_CAMOB;
}
}