Fix for error in recent smooth-view commit
authorCampbell Barton <ideasman42@gmail.com>
Wed, 26 Aug 2015 10:41:28 +0000 (20:41 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 26 Aug 2015 10:42:26 +0000 (20:42 +1000)
Was assuming there was a camera

source/blender/editors/space_view3d/view3d_edit.c

index 3fc415ed21becc02af159fa78318b9d0b67f2c9c..811eb7e731e1de6a921dd361b756ee4d1ebb49ef 100644 (file)
@@ -3768,6 +3768,8 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
 {
        RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
        float quat[4];
+       const short orig_persp = rv3d->persp;
+
 
        normalize_qt_qt(quat, quat_);
 
@@ -3810,11 +3812,13 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
        }
 
        if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
+               /* to camera */
                ED_view3d_smooth_view(C, v3d, ar, v3d->camera, NULL,
                                      rv3d->ofs, quat, NULL, NULL,
                                      smooth_viewtx);
        }
-       else {
+       else if (orig_persp == RV3D_CAMOB && v3d->camera) {
+               /* from camera */
                float ofs[3], dist;
 
                copy_v3_v3(ofs, rv3d->ofs);
@@ -3827,7 +3831,12 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
                                      ofs, quat, &dist, NULL,
                                      smooth_viewtx);
        }
-
+       else {
+               /* no camera involved */
+               ED_view3d_smooth_view(C, v3d, ar, NULL, NULL,
+                                     NULL, quat, NULL, NULL,
+                                     smooth_viewtx);
+       }
 }
 
 static int viewnumpad_exec(bContext *C, wmOperator *op)