#!BPY """ Name: 'Drawtypes' Blender: 247 Group: 'Misc' Tip: 'Set Object Display options (Hotkey o)' """ __author__ = 'Ivo Grigull' __version__ = '2.47' __url__ = ["http://www.ivogrigull.com"] __email__=[""] __bpydoc__ = """ Set Object Display options (Hotkey o) ----------------------------------------- Menu: Script Window->Misc->Drawtypes I wrote this for convenience to be able to quickly toggle draw wireframe over solid and x-ray etc. Usage: Execute the scipt and enable the spacehandler (View->Space Handler Scripts). Now you can call the menu by pressing the O-key. Feel free to adjust this script to another hotkey if you like. You can now save your Blender- default settings (Ctrl+U) to make it persistent. # -------------------------------------------------------------------------- # ***** 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 for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** # """ import Blender scr = """# SPACEHANDLER.VIEW3D.EVENT import Blender from Blender import Draw, Window evt = Blender.event return_it = False ############################# def toggleDrawType( number ): ############################# # 2 - axis # 4 - texspace # 8 - drawname # 16 - drawimage # 32 - drawwire # 64 - xray selected = Blender.Object.GetSelected() value = 0 bits = selected[len(selected)-1].getDrawMode() if bits & number: value = 0 else: value = 1 for s in selected: if value: s.setDrawMode( s.getDrawMode() | number) else: s.setDrawMode( s.getDrawMode() & (255 ^ number)) ############################ def setDrawTypeOnSelected(): ############################ menulist = [] menulist.append( ('Shaded', 0)) menulist.append( ('Solid', 1)) menulist.append( ('Wire', 2)) menulist.append( ('Bounds', 3)) menulist.append( ('Textured', 4)) menulist.append( ('DrawWire', 5)) menulist.append( ('X-Ray', 6)) selected = Blender.Object.GetSelected() if len(selected) <= 0: return result = Draw.PupTreeMenu( menulist ) if result == 0: for s in selected: s.setDrawType(4) #shaded if result == 1: for s in selected: s.setDrawType(3) #solid if result == 2: for s in selected: s.setDrawType(2) #wireframe if result == 3: for s in selected: s.setDrawType(1) #bounding box if result == 4: for s in selected: s.setDrawType(5) #textured if result == 5: # toggle wireframe on shaded toggleDrawType(32) if result == 6: toggleDrawType(64) # toggle x-ray Blender.Redraw() if( not Window.EditMode() ): if evt == Draw.OKEY: setDrawTypeOnSelected() Blender.event = None else: return_it = True """ scripting=Blender.Text.New('drawTypes') scripting.write( scr ) Blender.Run( 'drawTypes' )