diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 12 | ||||
-rw-r--r-- | source/blender/src/drawscene.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 22 | ||||
-rw-r--r-- | source/blender/src/edit.c | 4 | ||||
-rw-r--r-- | source/blender/src/editparticle.c | 2 | ||||
-rw-r--r-- | source/blender/src/editview.c | 22 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 29 | ||||
-rw-r--r-- | source/blender/src/renderwin.c | 2 | ||||
-rw-r--r-- | source/blender/src/space.c | 16 | ||||
-rw-r--r-- | source/blender/src/toets.c | 44 | ||||
-rw-r--r-- | source/blender/src/transform.c | 2 | ||||
-rw-r--r-- | source/blender/src/transform_constraints.c | 2 | ||||
-rw-r--r-- | source/blender/src/transform_conversions.c | 2 | ||||
-rw-r--r-- | source/blender/src/transform_generics.c | 4 | ||||
-rw-r--r-- | source/blender/src/view.c | 68 |
16 files changed, 116 insertions, 121 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ff5dcb763f4..a2780de9702 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -539,11 +539,11 @@ void unlink_object(Object *ob) if(v3d->camera==ob) { v3d->camera= NULL; - if(v3d->persp>1) v3d->persp= 1; + if(v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP; } if(v3d->localvd && v3d->localvd->camera==ob ) { v3d->localvd->camera= NULL; - if(v3d->localvd->persp>1) v3d->localvd->persp= 1; + if(v3d->localvd->persp==V3D_CAMOB) v3d->localvd->persp= V3D_PERSP; } } else if(sl->spacetype==SPACE_IPO) { diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index df9ea872caa..e3fb30d5755 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -84,11 +84,6 @@ typedef struct View3D { float viewquat[4], dist, zfac, pad0; /* zfac is initgrabz() result */ - /** - * 0 - ortho - * 1 - do 3d perspective - * 2 - use the camera - */ short persp; short view; @@ -165,7 +160,6 @@ typedef struct View3D { #define V3D_CLIPPING 16384 #define V3D_DRAW_CENTERS 32768 - /* View3d->flag2 (short) */ #define V3D_OPP_DIRECTION_NAME 1 #define V3D_FLYMODE 2 @@ -181,9 +175,9 @@ typedef struct View3D { /* View3d->persp */ -#define V3D_PERSP_ORTHO 0 -#define V3D_PERSP_DO_3D_PERSP 1 -#define V3D_PERSP_USE_THE_CAMERA 2 +#define V3D_ORTHO 0 +#define V3D_PERSP 1 +#define V3D_CAMOB 2 /* View3d->gridflag */ #define V3D_SHOW_FLOOR 1 diff --git a/source/blender/src/drawscene.c b/source/blender/src/drawscene.c index 557083d2b97..38e3dd17f9c 100644 --- a/source/blender/src/drawscene.c +++ b/source/blender/src/drawscene.c @@ -111,7 +111,7 @@ void set_scene(Scene *sce) /* also see scene.c: set_scene_bg() */ if (!v3d->camera || !object_in_scene(v3d->camera, sce)) { v3d->camera= scene_find_camera(sc->scene); if (sc==G.curscreen) handle_view3d_lock(); - if (!v3d->camera && v3d->persp>1) v3d->persp= 1; + if (!v3d->camera && v3d->persp==V3D_CAMOB) v3d->persp= V3D_PERSP; } } sl= sl->next; diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index faab326ee6b..e70859993be 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1508,25 +1508,25 @@ static void draw_viewport_name(ScrArea *sa) switch(G.vd->view) { case 1: - if (G.vd->persp & V3D_PERSP_DO_3D_PERSP) - name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp"; - else + if (G.vd->persp == V3D_ORTHO) name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Ortho" : "Front Ortho"; + else + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back Persp" : "Front Persp"; break; case 3: - if (G.vd->persp & V3D_PERSP_DO_3D_PERSP) - name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp"; - else + if (G.vd->persp == V3D_ORTHO) name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Ortho" : "Right Ortho"; + else + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left Persp" : "Right Persp"; break; case 7: - if (G.vd->persp & V3D_PERSP_DO_3D_PERSP) - name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp"; - else + if (G.vd->persp == V3D_ORTHO) name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Ortho" : "Top Ortho"; + else + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom Persp" : "Top Persp"; break; default: - if (G.vd->persp==V3D_PERSP_USE_THE_CAMERA) { + if (G.vd->persp==V3D_CAMOB) { if ((G.vd->camera) && (G.vd->camera->type == OB_CAMERA)) { Camera *cam; cam = G.vd->camera->data; @@ -1535,7 +1535,7 @@ static void draw_viewport_name(ScrArea *sa) name = "Object as Camera"; } } else { - name = (G.vd->persp & V3D_PERSP_DO_3D_PERSP) ? "User Persp" : "User Ortho"; + name = (G.vd->persp == V3D_ORTHO) ? "User Ortho" : "User Persp"; } } diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c index 504c2ab107f..1d076a3b6c4 100644 --- a/source/blender/src/edit.c +++ b/source/blender/src/edit.c @@ -251,7 +251,7 @@ int get_border(rcti *rect, short flag) BIF_ThemeColor(TH_BACK); glRecti(10, 25, 250, 40); - if(G.vd->persp==0) { + if(G.vd->persp==V3D_ORTHO) { window_to_3d(dvec, mvalo[0]-x1, mvalo[1]-y1); sprintf(str, "X %.4f Y %.4f Z %.4f Dia %.4f", dvec[0], dvec[1], dvec[2], sqrt(dvec[0]*dvec[0]+dvec[1]*dvec[1]+dvec[2]*dvec[2])); @@ -262,7 +262,7 @@ int get_border(rcti *rect, short flag) glRasterPos2i(16, 28); BMF_DrawString(G.fonts, str); } - else if(G.vd->persp==2) { + else if(G.vd->persp==V3D_CAMOB) { rctf vb; calc_viewborder(G.vd, &vb); diff --git a/source/blender/src/editparticle.c b/source/blender/src/editparticle.c index af323c9df9c..cb4d0d846ee 100644 --- a/source/blender/src/editparticle.c +++ b/source/blender/src/editparticle.c @@ -2307,7 +2307,7 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe /* create intersection coordinates in view Z direction at mouse coordinates */ /* Thanks to who ever wrote the "Mouse Location 3D Space" tutorial in "Blender 3D: Blending Into Python/Cookbook". */ - if(G.vd->persp){ + if(G.vd->persp != V3D_ORTHO){ vec[0]= (2.0f*(mx+dmx)/curarea->winx); vec[1]= (2.0f*(my+dmy)/curarea->winy); vec[2]= -1.0f; diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 47604b8133d..4b6a0d33fe7 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -2287,7 +2287,7 @@ void view3d_border_zoom(void) cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2; cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2; - if (v3d->persp==1) { /* perspective */ + if (v3d->persp==V3D_PERSP) { double p_corner[3]; /* no depths to use, we cant do anything! */ @@ -2404,7 +2404,7 @@ void fly(void) if(curarea->spacetype!=SPACE_VIEW3D) return; - if(G.vd->persp==2 && G.vd->camera->id.lib) { + if(G.vd->persp==V3D_CAMOB && G.vd->camera->id.lib) { error("Cannot fly a camera from an external library"); return; } @@ -2425,7 +2425,7 @@ void fly(void) persp_backup= G.vd->persp; dist_backup= G.vd->dist; - if (G.vd->persp==2) { /* Camera */ + if (G.vd->persp==V3D_CAMOB) { if(G.vd->camera->constraints.first) { error("Cannot fly an object with constraints"); return; @@ -2448,8 +2448,8 @@ void fly(void) } else { /* perspective or ortho */ - if (G.vd->persp==0) - G.vd->persp= 1; /*if ortho projection, make perspective */ + if (G.vd->persp==V3D_ORTHO) + G.vd->persp= V3D_PERSP; /*if ortho projection, make perspective */ QUATCOPY(rot_backup, G.vd->viewquat); VECCOPY(ofs_backup, G.vd->ofs); G.vd->dist= 0.0; @@ -2746,7 +2746,7 @@ void fly(void) dvec[2] = dvec_tmp[2]*(1-dvec_lag) + dvec_old[2]*dvec_lag; - if (G.vd->persp==2) { + if (G.vd->persp==V3D_CAMOB) { if (G.vd->camera->protectflag & OB_LOCK_LOCX) dvec[0] = 0.0; if (G.vd->camera->protectflag & OB_LOCK_LOCY) @@ -2768,11 +2768,11 @@ void fly(void) do_screenhandlers(G.curscreen); /* advance the next frame */ /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to teh view */ - if (G.vd->persp==2) { - G.vd->persp= 1; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */ + if (G.vd->persp==V3D_CAMOB) { + G.vd->persp= V3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */ setviewmatrixview3d(); setcameratoview3d(); - G.vd->persp= 2; + G.vd->persp= V3D_CAMOB; /* record the motion */ if (IS_AUTOKEY_MODE(NORMAL) && (!playing_anim || cfra != G.scene->r.cfra)) { @@ -2803,7 +2803,7 @@ void fly(void) /* Revert to original view? */ if (action == 2) { /* action == 2 means the user pressed Esc of RMB, and not to apply view to camera */ - if (persp_backup==2) { /* a camera view */ + if (persp_backup==V3D_CAMOB) { /* a camera view */ G.vd->viewbut=1; VECCOPY(G.vd->camera->loc, ofs_backup); VECCOPY(G.vd->camera->rot, rot_backup); @@ -2815,7 +2815,7 @@ void fly(void) G.vd->persp= persp_backup; } } - else if (persp_backup==2) { /* camera */ + else if (persp_backup==V3D_CAMOB) { /* camera */ float mat3[3][3]; Mat3CpyMat4(mat3, G.vd->camera->obmat); Mat3ToCompatibleEul(mat3, G.vd->camera->rot, rot_backup); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index c59f953da90..f71a55c55e6 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -220,7 +220,7 @@ static void do_view3d_view_camerasmenu(void *arg, int event) if (event==i) { - if (G.vd->camera == base->object && G.vd->persp==2) + if (G.vd->camera == base->object && G.vd->persp==V3D_CAMOB) return; if (U.smooth_viewtx) { @@ -228,12 +228,12 @@ static void do_view3d_view_camerasmenu(void *arg, int event) float orig_ofs[3], orig_lens = G.vd->lens; VECCOPY(orig_ofs, G.vd->ofs); - if (G.vd->camera && G.vd->persp==2) + if (G.vd->camera && G.vd->persp==V3D_CAMOB) view_settings_from_ob(G.vd->camera, G.vd->ofs, G.vd->viewquat, &G.vd->dist, &G.vd->lens); G.vd->camera = base->object; handle_view3d_lock(); - G.vd->persp= 2; + G.vd->persp= V3D_CAMOB; G.vd->view= 0; smooth_view_to_camera(G.vd); @@ -244,7 +244,7 @@ static void do_view3d_view_camerasmenu(void *arg, int event) } else { G.vd->camera= base->object; handle_view3d_lock(); - G.vd->persp= 2; + G.vd->persp= V3D_CAMOB; G.vd->view= 0; } break; @@ -550,7 +550,7 @@ static void do_view3d_viewmenu(void *arg, int event) switch(event) { case 0: /* User */ G.vd->viewbut = 0; - G.vd->persp = 1; + G.vd->persp = V3D_PERSP; break; case 1: /* Camera */ persptoetsen(PAD0); @@ -565,10 +565,10 @@ static void do_view3d_viewmenu(void *arg, int event) persptoetsen(PAD3); break; case 5: /* Perspective */ - G.vd->persp=1; + G.vd->persp=V3D_PERSP; break; case 6: /* Orthographic */ - G.vd->persp=0; + G.vd->persp=V3D_ORTHO; break; case 7: /* Local View */ G.vd->localview= 1; @@ -625,9 +625,9 @@ static uiBlock *view3d_viewmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if ((G.vd->viewbut == 0) && !(G.vd->persp == 2)) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + if ((G.vd->viewbut == 0) && !(G.vd->persp == V3D_CAMOB)) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "User", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); - if (G.vd->persp == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + if (G.vd->persp == V3D_CAMOB) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Camera|NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); if (G.vd->viewbut == 1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Top|NumPad 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); @@ -640,9 +640,9 @@ static uiBlock *view3d_viewmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if(G.vd->persp==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + if(G.vd->persp==V3D_PERSP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Perspective|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); - if(G.vd->persp==0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + if(G.vd->persp==V3D_ORTHO) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Orthographic|NumPad 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -663,7 +663,7 @@ static uiBlock *view3d_viewmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Clipping Border|Alt B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 17, ""); - if (v3d->persp==0) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Within Border...|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, ""); + if (v3d->persp==V3D_ORTHO) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Within Border...|Shift B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 19, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, ""); if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 99, ""); @@ -5144,9 +5144,10 @@ void do_view3d_buttons(short event) case B_PERSP: - if(G.vd->persp==2) persptoetsen(PAD0); + if(G.vd->persp==V3D_CAMOB) persptoetsen(PAD0); else { - G.vd->persp= 1-G.vd->persp; + if (G.vd->persp==V3D_ORTHO) G.vd->persp = V3D_PERSP; + else if (G.vd->persp==V3D_PERSP) G.vd->persp = V3D_ORTHO; persptoetsen(PAD5); } diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 52404989897..793bb4f310f 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -1304,7 +1304,7 @@ void do_ogl_view3d_render(Render *re, View3D *v3d, int winx, int winy) update_for_newframe_muted(); /* here, since camera can be animated */ - if(v3d->persp==2 && v3d->camera) { + if(v3d->persp==V3D_CAMOB && v3d->camera) { /* in camera view, use actual render winmat */ RE_GetCameraWindow(re, v3d->camera, CFRA, winmat); drawview3d_render(v3d, winx, winy, winmat); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 4abdc04dbd4..4a71d82fc4f 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -295,7 +295,7 @@ void copy_view3d_lock(short val) vd->lay= G.scene->lay; vd->camera= G.scene->camera; - if(vd->camera==0 && vd->persp>1) vd->persp= 1; + if(vd->camera==0 && vd->persp==V3D_CAMOB) vd->persp= V3D_PERSP; if( (vd->lay & vd->layact) == 0) { bit= 0; @@ -1411,7 +1411,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) allqueue(REDRAWVIEW3D, 0); } else if(G.qual==0) { - if (G.vd->persp==2) + if (G.vd->persp==V3D_CAMOB) /* center the camera offset */ G.vd->camdx= G.vd->camdy= 0.0; else { @@ -1438,7 +1438,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(G.qual==LR_ALTKEY) view3d_edit_clipping(v3d); else if(G.qual==LR_SHIFTKEY) { - if(G.vd->persp==2) + if(G.vd->persp==V3D_CAMOB) set_render_border(); else view3d_border_zoom(); @@ -1836,7 +1836,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) view3d_edit_clipping(v3d); else if(G.qual==LR_SHIFTKEY) { - if(G.vd->persp==2) + if(G.vd->persp==V3D_CAMOB) set_render_border(); else view3d_border_zoom(); @@ -1900,7 +1900,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) allqueue(REDRAWVIEW3D, 0); } else if((G.qual==0)){ - if (G.vd->persp==2) + if (G.vd->persp==V3D_CAMOB) /* center the camera offset */ G.vd->camdx= G.vd->camdy= 0.0; else { @@ -2750,7 +2750,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) else obmat_to_viewmat(ob, 1); - if(G.vd->persp==2) G.vd->persp= 1; + if(G.vd->persp==V3D_CAMOB) G.vd->persp= V3D_PERSP; scrarea_queue_winredraw(curarea); } } @@ -2852,7 +2852,7 @@ static void initview3d(ScrArea *sa) vd->blockscale= 0.7f; vd->viewquat[0]= 1.0f; vd->viewquat[1]= vd->viewquat[2]= vd->viewquat[3]= 0.0f; - vd->persp= 1; + vd->persp= V3D_PERSP; vd->drawtype= OB_WIRE; vd->view= 7; vd->dist= 10.0; @@ -6433,7 +6433,7 @@ void allqueue(unsigned short event, short val) case REDRAWVIEWCAM: if(sa->spacetype==SPACE_VIEW3D) { v3d= sa->spacedata.first; - if(v3d->persp>1) scrarea_queue_winredraw(sa); + if(v3d->persp==V3D_CAMOB) scrarea_queue_winredraw(sa); } break; case REDRAWINFO: 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; diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 15773b239a6..13d6c8260e3 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -262,7 +262,7 @@ void setTransformViewMatrices(TransInfo *t) Mat4One(t->viewinv); Mat4One(t->persmat); Mat4One(t->persinv); - t->persp = 0; // ortho + t->persp = V3D_ORTHO; } calculateCenter2D(t); diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c index b1720295774..7f6be83400b 100644 --- a/source/blender/src/transform_constraints.c +++ b/source/blender/src/transform_constraints.c @@ -668,7 +668,7 @@ void BIF_drawConstraint(void) return; /* nasty exception for Z constraint in camera view */ - if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp>1) + if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB) return; if (tc->drawExtra) { diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 24ead9a52c7..94faa4fc681 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -3853,7 +3853,7 @@ void createTransData(TransInfo *t) t->flag |= T_OBJECT; } - if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp>1) { + if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB) { t->flag |= T_CAMERA; } diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index dfbed45b3bc..a884e740bbd 100644 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -120,7 +120,7 @@ void getViewVector(float coord[3], float vec[3]) { TransInfo *t = BIF_GetTransInfo(); - if (t->persp) + if (t->persp != V3D_ORTHO) { float p1[4], p2[4]; @@ -962,7 +962,7 @@ void calculateCenter(TransInfo *t) /* voor panning from cameraview */ if(t->flag & T_OBJECT) { - if( G.vd->camera==OBACT && G.vd->persp>1) { + if( G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB) { float axis[3]; /* persinv is nasty, use viewinv instead, always right */ VECCOPY(axis, t->viewinv[2]); 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; } } |