diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 21:52:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 21:52:35 +0400 |
commit | e6fe5214b9c464b190c5c662bbb3a485cc7754c4 (patch) | |
tree | de635f51100e23812d23388559bc10ae999cde82 /source/blender/src/header_view3d.c | |
parent | deffce3c19ced621f3432a145b5b21b323ef9d6a (diff) |
drawmesh.c - change from mal_CanDo that makes lighting work the same as in blender 2.44.
header_view3d.c - smoothview wasnt working with the camera menu
Diffstat (limited to 'source/blender/src/header_view3d.c')
-rw-r--r-- | source/blender/src/header_view3d.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 26c37543d9a..0178ae25e89 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -59,6 +59,7 @@ #include "DNA_view3d_types.h" #include "DNA_text_types.h" /* for space handlers */ #include "DNA_texture_types.h" +#include "DNA_userdef_types.h" /* U.smooth_viewtx */ #include "BKE_action.h" #include "BKE_curve.h" @@ -70,6 +71,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_mesh.h" +#include "BKE_utildefines.h" /* for VECCOPY */ #ifdef WITH_VERSE #include "BKE_verse.h" @@ -213,11 +215,35 @@ static void do_view3d_view_camerasmenu(void *arg, int event) i++; if (event==i) { - G.vd->camera= base->object; - handle_view3d_lock(); - G.vd->persp= 2; - G.vd->view= 0; + if (G.vd->camera == base->object && G.vd->persp==2) + return; + + if (U.smooth_viewtx) { + /* move 3d view to camera view */ + float orig_ofs[3], orig_lens = G.vd->lens; + VECCOPY(orig_ofs, G.vd->ofs); + + if (G.vd->camera && G.vd->persp==2) + 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->view= 0; + + smooth_view_to_camera(G.vd); + + /* restore values */ + VECCOPY(G.vd->ofs, orig_ofs); + G.vd->lens = orig_lens; + } else { + G.vd->camera= base->object; + handle_view3d_lock(); + G.vd->persp= 2; + G.vd->view= 0; + } + break; } } } |