# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
"""
This script finds all the vertex groups that chosen vertexes are in, and any vertexes that are not in any vertex group.
This is useful for cleaning up a mesh if vertex groups under animation go off to the wrong place (because they are in a vertex group that they should not be in, or not in the vertex group that they should be in).
How to use:
1. select a mesh and get into edit mode.
2. by default it will use all vertexes; alternatively, select vertexes of interest and click on 'use selected vertexes'. Note that subsequent selections and deselections of vertexes will not change the set of vertexes to be used, you need to click on these buttons again to do that.
3. click on 'select' and 'deselect' buttons for listed vertex groups, and for no vertex group, to select and deselect vertexes.
This only lists vertex groups that have used vertexes.
You may want to use the mesh select/deselect all (keyboard A) operator to start.
Once you have the right vertexes selected, you can use the standard vertex groups property editor to add them to or remove them from the desired vertex groups.
"""
importbpy
frombpy.propsimport*
bl_addon_info={
'name':'Fix Vertex Groups',
'author':'Martin Ellison',
'version':(1,0),
'blender':(2,5,4),
'api':32516,
'location':'Toolbox',
'description':'Import files in the Autocad DXF format (.dxf)',
'warning':'',# used for warning icon and text in addons panel