1 Star 0 Fork 1

LuckyStrike-zhou / TextureTailor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

TextureTailor

游戏图片纹理裁剪碎图工具,根据Plist配置文件拆分成子图。

  • 由Python实现,开源可修改
  • 支持主流plist和png纹理文件裁剪,支持format2和3(可查看plist文件中metadata字典中的format关键词)
  • 支持目录内批量处理,导出为当前工作区的同名文件夹

遇到操作问题或bug请issue作者,欢迎给个小⭐️⭐️

预览

WX20210125-212234@2x

WX20210125-215307@2x

WX20210125-215411@2x

使用说明

  • Mac App:下载TextureTailor.dmg运行
  • 命令行:配置Python环境,使用pip install -r requirements.txt安装依赖库,执行python3 TextureTailor.py

Tips: Mac App启动时有延迟,等待几秒后才能打开

ipa拆包游戏资源png无法裁剪问题:

原因是因为苹果打包成ipa时,会使用Python的pngcrush库对png图片进行压缩优化,故图片文件头无法解析

需要执行撤销优化的指令,具体操作请移步作者简书:TextureTailor自制Plist碎图工具

实现逻辑

  • 选择目录中包含同名的plist和png文件加入执行队列(暂不支持多级目录)
  • 导出目录不存在自动生成
  • 依赖metadata中format关键词判断plist格式

格式解释

裁剪必要参数

  1. 父图的切割区域
  2. 子图原始尺寸(帧动画包含位移,故原始尺寸要比渲染尺寸大)
  3. 偏移量(渲染尺寸偏移)
  4. 旋转

Format 2

- frames

​ name.png

​ frame

​ sourceSize

​ sourceColorRect

​ offset

​ rotated

- metadata

​ format : 2

Format 3

- frames

​ name.png

​ textureRect : 父图切割区域

​ spriteSourceSize : 子图原始尺寸

​ spriteColorRect : 子图渲染原点和尺寸

​ spriteTrimmed : 子图渲染原点是否偏移

​ spriteOffset : 渲染原点偏移量

​ textureRotated : 图片是否旋转

​ spriteSize

​ aliases[]

- metadata

​ format : 3

后续功能

  • Window App
  • 容错判断
  • 多级目录检索
  • 执行日志
  • json / fnt位图字体 / spine的atlas 拆分

参考

Python初应用,开发过程中多有借鉴,鸣谢大佬:

[PlistDumper](https://github.com/qcdong2016/PlistDumper)

[tp-png-split](https://github.com/ShawnZhang2015/tp-png-split)

MIT License Copyright (c) 2021 与安君 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

游戏图片纹理裁剪碎图工具,根据Plist配置文件拆分成子图。 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/LuckyStrike-zhou/TextureTailor.git
git@gitee.com:LuckyStrike-zhou/TextureTailor.git
LuckyStrike-zhou
TextureTailor
TextureTailor
main

搜索帮助