svn merge ^/trunk/blender -r46300:46330
[blender.git] / source / blender / editors / space_view3d / view3d_edit.c
index 3e8ac58df8e9f667ac068fa93ef0868aa3ab50f9..62f382818715804571b6eb28abdec98893931a91 100644 (file)
@@ -76,7 +76,6 @@
 #include "ED_transform.h"
 #include "ED_mesh.h"
 #include "ED_view3d.h"
-#include "ED_sculpt.h"
 
 
 #include "PIL_time.h" /* smoothview */
@@ -699,7 +698,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
                        if (dot_v3v3(xaxis, m_inv[0]) < 0) {
                                negate_v3(xaxis);
                        }
-                       fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / (float)M_PI;
+                       fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / M_PI;
                        fac = fabsf(fac - 0.5f) * 2;
                        fac = fac * fac;
                        interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
@@ -2203,10 +2202,6 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
        else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
                ok = PE_minmax(scene, min, max);
        }
-       else if (ob && (ob->mode & OB_MODE_SCULPT)) {
-               ok = ED_sculpt_minmax(C, min, max);
-               ok_dist = 0; /* don't zoom */
-       }
        else {
                Base *base;
                for (base = FIRSTBASE; base; base = base->next) {
@@ -2230,24 +2225,18 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
        sub_v3_v3v3(afm, max, min);
        size = MAX3(afm[0], afm[1], afm[2]);
 
-       if (ok_dist) {
-               /* fix up zoom distance if needed */
-
-               if (rv3d->is_persp) {
-                       if (size <= v3d->near * 1.5f) {
-                               /* do not zoom closer than the near clipping plane */
-                               size = v3d->near * 1.5f;
-                       }
+       if (!rv3d->is_persp) {
+               if (size < 0.0001f) { /* if its a sinble point. don't even re-scale */
+                       ok_dist = 0;
                }
-               else /* ortho */ {
-                       if (size < 0.0001f) {
-                               /* bounding box was a single point so do not zoom */
-                               ok_dist = 0;
-                       }
-                       else {
-                               /* adjust zoom so it looks nicer */
-                               size *= 0.7f;
-                       }
+               else {
+                       /* perspective should be a bit farther away to look nice */
+                       size *= 0.7f;
+               }
+       }
+       else {
+               if (size <= v3d->near * 1.5f) {
+                       size = v3d->near * 1.5f;
                }
        }
 
@@ -2265,7 +2254,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 
        if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
                rv3d->persp = RV3D_PERSP;
-               smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+               smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
        }
        else {
                smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);