#for循环查找 当前目录下的所有 .png文件
for file in ` ls ./ |grep .png`
do
#打印文件名
echo $file
#根据文件名 裁切不带后缀的文件名
name=$(ls $file | cut -d. -f1)
#打印截取后的
echo $name
#调用本地TexturePacker.app程序 对文件进行处理(注意TexturePacker.app的本地路径)
/Applications/TexturePacker.app/Contents/MacOS/TexturePacker "$file" --sheet "$name.pvr.ccz" --data "$name.pvr.plist" --texture-format pvr2ccz --opt RGBA4444 --allow-free-size --shape-padding 0 --border-padding 0 --algorithm Basic --no-trim --dither-fs-alpha --premultiply-alpha
#删除文件
rm "$name.pvr.plist"
rm "$name.png"
echo "$file is set png change pvr.ccz SUCCESS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
done
#以下是修改 .plist中对应的图集后缀
for file in ` ls ./ |grep .plist`
do
echo "file ==== $file"
name=$(ls $file | cut -d. -f1)
/usr/libexec/PlistBuddy -c "Set :metadata:textureFileName $name.pvr.ccz" ./$file
/usr/libexec/PlistBuddy -c "Set :metadata:realTextureFileName $name.pvr.ccz" ./$file
echo "$file is set png to pvr.ccz SUCCESS#############################################"
done