# DizziCamera v1.0 # Rotate/Translate the current camera # X/Y-rotate the currently selected camera when pressing Control/Command and moving the mouse # X/Y-translate the currently selected camera when pressing Control/Command + Shift and moving the mouse # Z-translate the currently selected camera when pressing Control/Command + Alt and moving the mouse # - Python coding by Dizzi import poser import wx.aui class DizziCamera: def __init__(self): self.DoBind(poser.WxAuiManager().GetManagedWindow(),"") def EvtKeyDown(self, event): # if you want to disable the return key... uncomment the next line (remove the #) #if (event.KeyCode == wx.WXK_RETURN or event.KeyCode == wx.WXK_NUMPAD_ENTER): return # for keycodes see: http://wxpython.org/docs/api/wx.KeyEvent-class.html # you can also check for Modifier Keys: # event.CommandDown() - Control on PC, Command on MAC # event.ShiftDown() # event.AltDown() # event.MetaDown() - MAC # # uncomment the following line (remove #) to find out a keycode for anything else you want to stop... #print event.KeyCode event.Skip() lastPosition=None def EvtMotion(self, event): obj=event.GetEventObject() position=obj.ClientToScreen(event.GetPosition()) if event.CmdDown(): if self.lastPosition: x=position.x-self.lastPosition.x y=position.y-self.lastPosition.y if event.ShiftDown(): type1=poser.kParmCodeXTRAN type2=poser.kParmCodeYTRAN multi=0.01 elif event.AltDown(): type1=None type2=poser.kParmCodeZTRAN multi=0.01 else: type1=poser.kParmCodeYROT type2=poser.kParmCodeXROT multi=0.2 try: cam=poser.Scene().CurrentCamera() if type1: param=cam.ParameterByCode(type1) param.SetValue(param.Value()-x*multi) if type2: param=cam.ParameterByCode(type2) param.SetValue(param.Value()-y*multi) except: pass self.lastPosition=position event.Skip() def DoBind(self, win, level): win.Bind(wx.EVT_KEY_DOWN, self.EvtKeyDown) win.Bind(wx.EVT_MOTION, self.EvtMotion) #print level+win.Name for child in win.Children: self.DoBind(child, level+">") def RemoveEvents(self): self.DoUnbind(poser.WxAuiManager().GetManagedWindow()) def DoUnbind(self, win): self.Unbind(wx.EVT_KEY_DOWN) self.Unbind(wx.EVT_MOTION) for child in win.Children: self.DoUnbind(child, level+">") try: dizziCamera.RemoveEvents() except: pass dizziCamera=DizziCamera()