[#7289] Orbit around selected in edit mode goes crazy with no verts selected

[#8784] orbiting around selection bug + a few kind of a must features (partial fix)

As suggested by Ton, keep last center and use that when nothing selected.

I don't really like it though as it wouldn't work ok when changing scene  or when using a different 3D view and is somewhat non trivial to explain (it's not the last selection, it's the last used orbiting center).
This commit is contained in:
Martin Poirier 2008-03-30 01:47:06 +00:00
parent 68f1f2b08d
commit 2f1420301d

@ -722,6 +722,7 @@ void viewmoveNDOFfly(int mode)
void viewmove(int mode) void viewmove(int mode)
{ {
static float lastofs[3] = {0,0,0};
Object *ob = OBACT; Object *ob = OBACT;
float firstvec[3], newvec[3], dvec[3]; float firstvec[3], newvec[3], dvec[3];
float reverse, oldquat[4], q1[4], si, phi, dist0; float reverse, oldquat[4], q1[4], si, phi, dist0;
@ -783,13 +784,15 @@ void viewmove(int mode)
obofs[1]= -obofs[1]; obofs[1]= -obofs[1];
obofs[2]= -obofs[2]; obofs[2]= -obofs[2];
} }
else if (ob && (U.uiflag & USER_ORBIT_SELECTION)) { else if (U.uiflag & USER_ORBIT_SELECTION) {
use_sel = 1; use_sel = 1;
VECCOPY(ofs, G.vd->ofs); VECCOPY(ofs, G.vd->ofs);
/* If there's no selection, obofs is unmodified, so <0,0,0> */ /* If there's no selection, lastofs is unmodified and last value since static */
calculateTransformCenter(V3D_CENTROID, obofs); calculateTransformCenter(V3D_CENTROID, lastofs);
VECCOPY(obofs, lastofs);
VecMulf(obofs, -1.0f); VecMulf(obofs, -1.0f);
} }
else else