Docs: rename var and comment how it's used
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Aug 2017 16:05:11 +0000 (02:05 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Aug 2017 16:11:31 +0000 (02:11 +1000)
switch_from_camera wasn't right since it was used for auto-perspective.

source/blender/editors/space_view3d/view3d_edit.c

index f560754a7a951cf89a1bd4f0947f315e4cca0739..97fcca1196278a8fb20df3870772f283e7be3003 100644 (file)
@@ -726,10 +726,15 @@ static enum eViewOpsOrbit viewops_orbit_mode(void)
 
 /**
  * Calculate the values for #ViewOpsData
+ *
+ * \param use_ensure_persp: When enabled run #view3d_ensure_persp this may switch out of
+ * camera view when orbiting or switch from ortho to perspective when auto-persp is enabled.
+ * Some operations don't require this (view zoom/pan or ndof where subtle rotation is common
+ * so we don't want it to trigger auto-perspective).
  */
 static void viewops_data_create_ex(
         bContext *C, wmOperator *op, const wmEvent *event,
-        bool switch_from_camera, enum eViewOpsOrbit orbit_mode)
+        bool use_ensure_persp, enum eViewOpsOrbit orbit_mode)
 {
        ViewOpsData *vod = op->customdata;
        RegionView3D *rv3d = vod->rv3d;
@@ -750,8 +755,7 @@ static void viewops_data_create_ex(
                vod->use_dyn_ofs = false;
        }
 
-       if (switch_from_camera) {
-               /* switch from camera view when: */
+       if (use_ensure_persp) {
                if (view3d_ensure_persp(vod->v3d, vod->ar)) {
                        /* If we're switching from camera view to the perspective one,
                         * need to tag viewport update, so camera vuew and borders
@@ -853,10 +857,10 @@ static void viewops_data_create_ex(
        rv3d->rflag |= RV3D_NAVIGATING;
 }
 
-static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *event, bool switch_from_camera)
+static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *event, bool use_ensure_persp)
 {
        enum eViewOpsOrbit orbit_mode = viewops_orbit_mode();
-       viewops_data_create_ex(C, op, event, switch_from_camera, orbit_mode);
+       viewops_data_create_ex(C, op, event, use_ensure_persp, orbit_mode);
 }
 
 static void viewops_data_free(bContext *C, wmOperator *op)