# SPACEHANDLER.VIEW3D.EVENT # -------------------------------------------------------------------------- # ***** PURPOSE ***** # -------------------------------------------------------------------------- # Numpad 9 includes a Front View of XNA rotated models # -------------------------------------------------------------------------- # ***** USAGE ***** # -------------------------------------------------------------------------- # Copy in to a text window in Blender # Turn on and off in each 3D View wiondows # from the View Menu -> Space Handler Scripts # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See the GNU General Public License on the GNU web site for full # details: http://www.gnu.org/licenses/gpl.html # # ***** END GPL LICENCE BLOCK ***** # -------------------------------------------------------------------------- # Useful links: # http://www.blender.org/documentation/248PythonDoc/index.html # -------------------------------------------------------------------------- # ***** HISTORY ***** # -------------------------------------------------------------------------- # JCBDigger http://games.DiscoverThat.co.uk # Created March 2009 # Note: at the moment Blender can only use Space Handler scripts in # 3D View windows. # -------------------------------------------------------------------------- # BUGS (Undesired Features) # Pressing Numpad 9 cycles through several views including the Front View # -------------------------------------------------------------------------- import Blender from Blender import Draw, Window from Blender.Window import GetAreaID, QAdd, Redraw, QHandle evt = Blender.event val = Blender.eventValue return_it = False # stop blender processing the same key press id = Window.GetAreaID() if evt == Draw.PAD9: # Use Numpad 9 to show Front view of XNA models # The following is ugly but works quickly QAdd(id, Draw.PAD3, 1) QAdd(id, Draw.PAD3, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD2, 1) QAdd(id, Draw.PAD2, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QAdd(id, Draw.PAD6, 1) QAdd(id, Draw.PAD6, 0) QHandle(id) Redraw() else: # Let Blender process the event return_it = True # stop Blender processing the same event if not return_it: Blender.event = None