From 2f1420301d2b750c8bdd8d686398f90545dd22b5 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Sun, 30 Mar 2008 01:47:06 +0000 Subject: [PATCH] [#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). --- source/blender/src/view.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 7d51275dc0c..c8833b1cff3 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -722,6 +722,7 @@ void viewmoveNDOFfly(int mode) void viewmove(int mode) { + static float lastofs[3] = {0,0,0}; Object *ob = OBACT; float firstvec[3], newvec[3], dvec[3]; float reverse, oldquat[4], q1[4], si, phi, dist0; @@ -783,13 +784,15 @@ void viewmove(int mode) obofs[1]= -obofs[1]; obofs[2]= -obofs[2]; } - else if (ob && (U.uiflag & USER_ORBIT_SELECTION)) { + else if (U.uiflag & USER_ORBIT_SELECTION) { use_sel = 1; VECCOPY(ofs, G.vd->ofs); - /* If there's no selection, obofs is unmodified, so <0,0,0> */ - calculateTransformCenter(V3D_CENTROID, obofs); + /* If there's no selection, lastofs is unmodified and last value since static */ + calculateTransformCenter(V3D_CENTROID, lastofs); + + VECCOPY(obofs, lastofs); VecMulf(obofs, -1.0f); } else