From fca2058924177b25be05ea7829d07b3953302eda Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 8 Apr 2013 04:48:34 +0000 Subject: [PATCH] fix [#34903] Lock Camera to View allows Numpad orbit, but not Numpad pan --- source/blender/editors/space_view3d/view3d_edit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 3767f3011ff..ad68eefe340 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3466,8 +3466,10 @@ static EnumPropertyItem prop_view_pan_items[] = { static int viewpan_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); + View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); float vec[3]; + float ofs[3]; const float co_zero[3] = {0.0f}; float mval_f[2] = {0.0f, 0.0f}; float zfac; @@ -3475,18 +3477,17 @@ static int viewpan_exec(bContext *C, wmOperator *op) pandir = RNA_enum_get(op->ptr, "type"); + ED_view3d_camera_lock_init(v3d, rv3d); + zfac = ED_view3d_calc_zfac(rv3d, co_zero, NULL); if (pandir == V3D_VIEW_PANRIGHT) { mval_f[0] = -32.0f; } else if (pandir == V3D_VIEW_PANLEFT) { mval_f[0] = 32.0f; } else if (pandir == V3D_VIEW_PANUP) { mval_f[1] = -25.0f; } else if (pandir == V3D_VIEW_PANDOWN) { mval_f[1] = 25.0f; } ED_view3d_win_to_delta(ar, mval_f, vec, zfac); - add_v3_v3(rv3d->ofs, vec); + add_v3_v3v3(ofs, rv3d->ofs, vec); - if (rv3d->viewlock & RV3D_BOXVIEW) - view3d_boxview_sync(CTX_wm_area(C), ar); - - ED_region_tag_redraw(ar); + view3d_smooth_view(C, v3d, ar, NULL, NULL, ofs, NULL, NULL, NULL); return OPERATOR_FINISHED; }