From 2cf0ffc534e8ea34101603c71fa26fe58355813a Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Fri, 16 Sep 2011 13:25:15 -0400 Subject: Switch to now published spnav module rather than internal copy. --- camera.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/camera.py b/camera.py index af48735..470a1b9 100755 --- a/camera.py +++ b/camera.py @@ -588,7 +588,7 @@ class Camera(multiprocessing.Process): if spnav_event is None: return - if spnav_event.type == self.spnav_module.SPNAV_EVENT_MOTION: + if spnav_event.ev_type == self.spnav_module.SPNAV_EVENT_MOTION: if pygame.key.get_mods() & (KMOD_LSHIFT | KMOD_RSHIFT): accelerate_factor = 2.0 else: @@ -598,14 +598,15 @@ class Camera(multiprocessing.Process): v2 = self.axis2 v3 = np.cross(self.axis1,self.axis2) - v = v2*spnav_event.motion.x + v1*spnav_event.motion.y + \ - v3*spnav_event.motion.z + x, y, z = spnav_event.translation + rx, ry, rz = spnav_event.rotation + + v = v2*x + v1*y + v3*z v *= self.scale / 5000.0 * accelerate_factor self.translate(v, redraw=False) - axis = -v2*spnav_event.motion.rx - v1*spnav_event.motion.ry - \ - v3*spnav_event.motion.rz + axis = -v2*rx - v1*ry - v3*rz if (axis != 0).any(): axis = axis.astype(float) @@ -621,8 +622,8 @@ class Camera(multiprocessing.Process): self.update() pygame.event.clear(pygame.SYSWMEVENT) - elif spnav_event.type == self.spnav_module.SPNAV_EVENT_BUTTON: - if spnav_event.button.bnum == 0 and spnav_event.button.press: + elif spnav_event.ev_type == self.spnav_module.SPNAV_EVENT_BUTTON: + if spnav_event.bnum == 0 and spnav_event.press: if not hasattr(self, 'rng_states_gpu'): self.initialize_render() -- cgit