diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-04-09 16:22:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-04-09 16:22:22 +0400 |
commit | a64339d319a9e2b4de31adca0e546d3109c5f041 (patch) | |
tree | 1087fc6bf64baa426a94268955c773858f2d74e5 /source | |
parent | c40b36bf53df959c2e67d2315391b435805dea51 (diff) |
Use smoothview For * (align to object) and editmode align to selected.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BSE_view.h | 2 | ||||
-rw-r--r-- | source/blender/src/space.c | 2 | ||||
-rw-r--r-- | source/blender/src/view.c | 18 |
3 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/include/BSE_view.h b/source/blender/include/BSE_view.h index 27f452b3deb..5943e265f4f 100644 --- a/source/blender/include/BSE_view.h +++ b/source/blender/include/BSE_view.h @@ -80,7 +80,7 @@ void viewmove(int mode); int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend); void setwinmatrixview3d(int winx, int winy, struct rctf *rect); -void obmat_to_viewmat(struct Object *ob); +void obmat_to_viewmat(struct Object *ob, short smooth); void setviewmatrixview3d(void); float *give_cursor(void); unsigned int free_localbit(void); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index bd403f878c1..6bebd6126af 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2432,7 +2432,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } } else - obmat_to_viewmat(ob); + obmat_to_viewmat(ob, 1); if(G.vd->persp==2) G.vd->persp= 1; scrarea_queue_winredraw(curarea); diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 5c36d85203a..83ee44eaacd 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -942,7 +942,7 @@ void setwinmatrixview3d(int winx, int winy, rctf *rect) /* rect: for picking */ glMatrixMode(GL_MODELVIEW); } -void obmat_to_viewmat(Object *ob) +void obmat_to_viewmat(Object *ob, short smooth) { float bmat[4][4]; float tmat[3][3]; @@ -953,7 +953,13 @@ void obmat_to_viewmat(Object *ob) /* view quat calculation, needed for add object */ Mat3CpyMat4(tmat, G.vd->viewmat); - Mat3ToQuat(tmat, G.vd->viewquat); + if (smooth) { + float new_quat[4]; + Mat3ToQuat(tmat, new_quat); + smooth_view(G.vd, NULL, new_quat, NULL); + } else { + Mat3ToQuat(tmat, G.vd->viewquat); + } } /* dont set windows active in in here, is used by renderwin too */ @@ -965,7 +971,7 @@ void setviewmatrixview3d() if(G.vd->camera) { where_is_object(G.vd->camera); - obmat_to_viewmat(G.vd->camera); + obmat_to_viewmat(G.vd->camera, 0); if(G.vd->camera->type==OB_CAMERA) { cam= G.vd->camera->data; @@ -1496,7 +1502,7 @@ void view3d_home(int center) void view3d_align_axis_to_vector(View3D *v3d, int axisidx, float vec[3]) { float alignaxis[3]; - float norm[3], axis[3], angle; + float norm[3], axis[3], angle, new_quat[4]; alignaxis[0]= alignaxis[1]= alignaxis[2]= 0.0; alignaxis[axisidx]= 1.0; @@ -1506,10 +1512,12 @@ void view3d_align_axis_to_vector(View3D *v3d, int axisidx, float vec[3]) angle= acos(Inpf(alignaxis, norm)); Crossf(axis, alignaxis, norm); - VecRotToQuat(axis, -angle, v3d->viewquat); + VecRotToQuat(axis, -angle, new_quat); v3d->view= 0; if (v3d->persp>=2) v3d->persp= 0; /* switch out of camera mode */ + + smooth_view(v3d, NULL, new_quat, NULL); } |