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/toets.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/toets.c')
-rw-r--r--source/blender/src/toets.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index c8f8b158c3b..906e24b4e9c 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -134,21 +134,21 @@ static void axis_set_view(float q1, float q2, float q3, float q4, short view, in
new_quat[2]= q3; new_quat[3]= q4;
G.vd->view=0;
- if (G.vd->persp==2 && G.vd->camera) {
+ if (G.vd->persp==V3D_CAMOB && G.vd->camera) {
/* Is this switching from a camera view ? */
float orig_ofs[3];
float orig_lens= G.vd->lens;
VECCOPY(orig_ofs, G.vd->ofs);
view_settings_from_ob(G.vd->camera, G.vd->ofs, G.vd->viewquat, &G.vd->dist, &G.vd->lens);
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
- else if(G.vd->persp>=2) G.vd->persp= perspo;
+ if (U.uiflag & USER_AUTOPERSP) G.vd->persp= V3D_ORTHO;
+ else if(G.vd->persp==V3D_CAMOB) G.vd->persp= perspo;
smooth_view(G.vd, orig_ofs, new_quat, NULL, &orig_lens);
} else {
- if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
- else if(G.vd->persp>=2) G.vd->persp= perspo;
+ if (U.uiflag & USER_AUTOPERSP) G.vd->persp= V3D_ORTHO;
+ else if(G.vd->persp==V3D_CAMOB) G.vd->persp= perspo;
smooth_view(G.vd, NULL, new_quat, NULL, NULL);
}
@@ -159,7 +159,7 @@ void persptoetsen(unsigned short event)
{
static Object *oldcamera=0;
float phi, si, q1[4], vec[3];
- static int perspo=1;
+ static int perspo=V3D_PERSP;
int preview3d_event= 1;
short mouseloc[2];
@@ -167,14 +167,14 @@ void persptoetsen(unsigned short event)
/* Use this to test if we started out with a camera */
Object *act_cam_orig=NULL;
- if (G.vd->persp == 2)
+ if (G.vd->persp == V3D_CAMOB)
act_cam_orig = G.vd->camera;
if(event==PADENTER) {
if (G.qual == LR_SHIFTKEY) {
view3d_set_1_to_1_viewborder(G.vd);
} else {
- if (G.vd->persp==2) {
+ if (G.vd->persp==V3D_CAMOB) {
G.vd->camzoom= 0;
} else {
new_dist = 10.0;
@@ -203,14 +203,14 @@ void persptoetsen(unsigned short event)
}
else if(event==PADMINUS) {
/* this min and max is also in viewmove() */
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
G.vd->camzoom-= 10;
if(G.vd->camzoom<-30) G.vd->camzoom= -30;
}
else if(G.vd->dist<10.0*G.vd->far) G.vd->dist*=1.2f;
}
else if(event==PADPLUSKEY) {
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
G.vd->camzoom+= 10;
if(G.vd->camzoom>300) G.vd->camzoom= 300;
}
@@ -247,35 +247,35 @@ void persptoetsen(unsigned short event)
}
else if(event==PADMINUS) {
/* this min and max is also in viewmove() */
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
G.vd->camzoom= MAX2(-30, G.vd->camzoom-5);
}
else if(G.vd->dist<10.0*G.vd->far) {
getmouseco_areawin(mouseloc);
view_zoom_mouseloc(VIEW_ZOOM_OUT_FACTOR, mouseloc);
}
- if(G.vd->persp!=1) preview3d_event= 0;
+ if(G.vd->persp!=V3D_PERSP) preview3d_event= 0;
}
else if(event==PADPLUSKEY) {
- if(G.vd->persp==2) {
+ if(G.vd->persp==V3D_CAMOB) {
G.vd->camzoom= MIN2(300, G.vd->camzoom+5);
}
else if(G.vd->dist> 0.001*G.vd->grid) {
getmouseco_areawin(mouseloc);
view_zoom_mouseloc(VIEW_ZOOM_IN_FACTOR, mouseloc);
}
- if(G.vd->persp!=1) preview3d_event= 0;
+ if(G.vd->persp!=V3D_PERSP) preview3d_event= 0;
}
else if(event==PAD5) {
if (U.smooth_viewtx) {
- if(G.vd->persp==1) { G.vd->persp=0;
+ if(G.vd->persp==V3D_PERSP) { G.vd->persp=V3D_ORTHO;
} else if (act_cam_orig) {
/* were from a camera view */
float orig_dist= G.vd->dist;
float orig_lens= G.vd->lens;
VECCOPY(orig_ofs, G.vd->ofs);
- G.vd->persp=1;
+ G.vd->persp=V3D_PERSP;
G.vd->dist= 0.0;
view_settings_from_ob(act_cam_orig, G.vd->ofs, NULL, NULL, &G.vd->lens);
@@ -283,11 +283,11 @@ void persptoetsen(unsigned short event)
smooth_view(G.vd, orig_ofs, NULL, &orig_dist, &orig_lens);
} else {
- G.vd->persp=1;
+ G.vd->persp=V3D_PERSP;
}
} else {
- if(G.vd->persp==1) G.vd->persp=0;
- else G.vd->persp=1;
+ if(G.vd->persp==V3D_PERSP) G.vd->persp=V3D_ORTHO;
+ else G.vd->persp=V3D_PERSP;
}
}
else if(event==PAD0) {
@@ -319,7 +319,7 @@ void persptoetsen(unsigned short event)
}
if(G.vd->camera && (G.vd->camera != act_cam_orig)) {
- G.vd->persp= 2;
+ G.vd->persp= V3D_CAMOB;
G.vd->view= 0;
if(((G.qual & LR_CTRLKEY) && (G.qual & LR_ALTKEY)) || (G.qual & LR_SHIFTKEY)) {
@@ -351,7 +351,7 @@ void persptoetsen(unsigned short event)
reset_slowparents(); /* editobject.c */
}
- else if(G.vd->persp<2) {
+ else if(G.vd->persp != V3D_CAMOB) {
if(event==PAD4 || event==PAD6) {
/* z-axis */
phi= (float)(M_PI/360.0)*U.pad_rot_angle;
@@ -380,7 +380,7 @@ void persptoetsen(unsigned short event)
}
}
- if(G.vd->persp<2) perspo= G.vd->persp;
+ if(G.vd->persp != V3D_CAMOB) perspo= G.vd->persp;
}
if(G.vd->depths) G.vd->depths->damaged= 1;