""" Released under the Blender Artistic Licence (BAL)
Name: '_Load/Save VertCols'
Blender: 248
Group: 'Image'
Tooltip: 'Save a mesh's vertex colors in a tga file for archiving.'
"""
__author__="pat"
__version__="1.4b - 10/17/05 -"
__email__=('Author, pat:psycho3d*de')
__url__=("Author's website, www.psycho3d.de")
__bpydoc__="""\
This script can save or load a mesh's vertex color to/from a raw .tga file.
There are some scripts that use vertcols for different things, fiber is
probably the most famous one. This script gives you the possibility to
exchange a mesh's vertcols, backup them or eg. view only the red part by
painting the mesh black and importing red only.
Buttons:<br>
Per Vertex: When inactive the mesh's vertcols will be saved per face, resulting in bigger files. You only need to deactivate this if your vertcols are not shared between faces.<br>
Remember Path: The script generates an ini file inside your .blend, saving all your options and, if chosen, the path (not filename) you last used to save or load. When inactive, the script will default to Blender's 'datadir'.<br>
Select Object: Used to change the script's active object, no need to restart the script.<br>
Import XXX: Select to import this color. The inactive colors will not be affected on import. This does not affect exporting.
Hotkeys:<br>
Q: [Q]uit
"""
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C): pat:psycho3d
#
# 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.
Button("Select Object",5,190,10,100,20,"Change the object the script works on")
Button("Load",3,10,150,80,20,"Load vertex colors from the tga and apply it to the mesh")
Button("Save",4,210,150,80,20,"Save the meshs vertex colors to the tga")
useRed=Toggle("Import Red",2,10,120,93,20,useRed.val,"Toggle import of red vertex color")
useGreen=Toggle("Import Green",2,103,120,94,20,useGreen.val,"Toggle import of green vertex color")
useBlue=Toggle("Import Blue",2,197,120,93,20,useBlue.val,"Toggle import of blue vertex color")
colPerVert=Toggle("Per Vertex",2,110,150,80,20,colPerVert.val,"Load and save vertex colors per vertex or per face (per face will create bigger files)")
Button("Exit",1,10,10,100,20,"This one should explain itself :)")
Button("Fileselector",6,10,90,100,20,"Show fileselector to select filename")
savePath=Toggle("Remember Path",2,190,90,100,20,savePath.val,"Remember path or use Blender's datadir")
btnPath=String("Path: ",2,10,60,280,20,btnPath.val,255,"Path of the file to load and save")
glRasterPos2i(132,15)
Text("by pat")
glRasterPos2i(10,40)
Text(message)
defevent(evt,val):
if(evt==QKEYandnotval):
saveini()
Exit()
deff(filename):
globalbtnPath
btnPath.val=filename
Redraw()
defbevent(evt):
globalbtnPath
if(evt==1):
saveini()
Exit()
elif(evt==3):read_tgafile(btnPath.val.strip())
elif(evt==4):write_tgafile(btnPath.val.strip())
elif(evt==5):getObject()
elif(evt==6):FileSelector(f,"Select file or path",btnPath.val)