# SPACEHANDLER.VIEW3D.EVENT # toggle between the first two armature layers of the selected armature # usage: # load this script into the blender text editor, press alt+p. Activate the Spacehandler # (View->Space Handler Scripts->ToggleArmLayers). Press the 2 key to toggle. # -------------------------------------------------------------------------- # ***** 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 from Blender import Draw, Window evt = Blender.event return_it = False def toggle(): # toggle between the first two armature layers of the selected armature import Blender from Blender import Armature scn= Blender.Scene.GetCurrent() ob= scn.objects.active if ob.type == 'Armature': b = ob.getData() # get armature if b.layerMask & 1: mask = b.layerMask & (255 << 2 ) mask |= 2 b.layerMask = mask else: if b.layerMask & 2: mask = b.layerMask & (255 << 2 ) mask |= 1 b.layerMask = mask Blender.Window.RedrawAll() if( not Window.EditMode() ): if evt == Draw.TWOKEY: toggle() Blender.event = None else: return_it = True