#!BPY """ Name: 'Armature Templatize' Blender: 248 Group: 'Object' Tooltip: 'Applies bone rules defined via python rules.py to a rig' """ __author__ = "Bassam Kurdali" __url__ = ["freefac.org", "tube.freefac.org"] __version__ = "0.2" __bpydoc__ = """\ Armature Templatize Helper function to add template &N.&S to bones in an armature, currently kills constraints, weighting, and small babies. """ # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # # Script copyright (C) Bassam Kurdali # # 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 ***** # -------------------------------------------------------------------------- # copyright 2009 Bassam Kurdali import Blender from Blender import Armature armobj = Blender.Scene.GetCurrent().objects.active # need to check that the active object is an armature!!! # need to get selected meshes. armdat = armobj.getData() # need to use armobj.getPose() to store constraints armdat.makeEditable() bnames = armdat.bones.keys() # bnames can be used to rename vertex groups in selected meshes also. for bname in bnames: editbone = armdat.bones[bname] editbone.name = editbone.name + "&N.&S" armdat.update() # need to rename constraint targets # need to re-apply constraints. Blender.Redraw()