diff options
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 25 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 3 |
2 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index b49abaf55ad..c6594680217 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -992,15 +992,15 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* switch from camera view when: */ if (vod->rv3d->persp != RV3D_PERSP) { - - if (U.uiflag & USER_AUTOPERSP) { + if (vod->rv3d->persp == RV3D_CAMOB) { + const short lpersp = (U.uiflag & USER_AUTOPERSP) ? RV3D_PERSP : vod->rv3d->lpersp; + view3d_persp_switch_from_camera(vod->v3d, vod->rv3d, lpersp); + } + else if ((U.uiflag & USER_AUTOPERSP) && RV3D_VIEW_IS_AXIS(vod->rv3d->view)) { if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { vod->rv3d->persp = RV3D_PERSP; } } - else if (vod->rv3d->persp == RV3D_CAMOB) { - view3d_persp_switch_from_camera(vod->v3d, vod->rv3d, vod->rv3d->lpersp); - } ED_region_tag_redraw(vod->ar); } @@ -3344,20 +3344,19 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, return; } - if (rv3d->persp == RV3D_CAMOB && v3d->camera) { - - if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP; - else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo; + if (U.uiflag & USER_AUTOPERSP) { + rv3d->persp = RV3D_VIEW_IS_AXIS(view) ? RV3D_ORTHO : perspo; + } + else if (rv3d->persp == RV3D_CAMOB) { + rv3d->persp = perspo; + } + if (rv3d->persp == RV3D_CAMOB && v3d->camera) { ED_view3d_smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL, smooth_viewtx); } else { - - if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP; - else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo; - ED_view3d_smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL, smooth_viewtx); diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index c724340f5ea..a154f6fed15 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -266,6 +266,9 @@ typedef struct View3D { #define RV3D_VIEW_PERSPORTHO 7 #define RV3D_VIEW_CAMERA 8 +#define RV3D_VIEW_IS_AXIS(view) \ + ((view >= RV3D_VIEW_FRONT) && (view <= RV3D_VIEW_BOTTOM)) + /* View3d->flag2 (short) */ #define V3D_RENDER_OVERRIDE 4 #define V3D_SOLID_TEX 8 |