转载

Spine批量导出Command line Export

1.准备工作及介绍

时间有点紧张,写的不是很详细,请见谅。

当前版本是2.2以上,购买版的。试用版的无法试用 Command line

Both Spine and the Spine launcher must be 2.1.00 or higher to perform command line export. To update the Spine launcher, download and reinstall Spine.

将Spine的安装目录设置到系统环境变量中(我的电脑,右键,属性,高级系统属性,环境变量,系统变量的path 中添加)/

配置成功之后,可以在cmd命令行中输入Spine -h 会出现导出帮助。如下面:

Editor: -h, --help  Print this help message and exit. -v, --version    Print version information and exit. -l, --logout     Logout, removing activation code. -k, --keys  Enable hotkey popups by default. -n, --notimeout  Disable timeout when checking for and downloading updates. -x, --proxy Proxy server to use when checking for and downloading updates. -s, --scale Experimental: UI scale, default is 1.0. project.spine    Path to Spine project file to open. Export: -i, --input   Path to Spine project file, overrides export settings JSON. -o, --output  Path to write export file(s), overrides export settings JSON. -e, --export  Path to export settings JSON file. Pack: -i, --input   Path to folder of images to be packed. -o, --output  Path to write texture atlas files. -p, --pack    Texture atlas name or path to pack settings JSON file. Examples: Spine --export /path/to/export.json Spine --export "/path/with spaces/to/export.json" Spine --input /path/to/project.spine --output /path/to/output/  --export /path/to/export.json Spine -i /path/to/project.spine -o /path/to/output/ -e /path/to/export.json Spine -e /path/to/export1.json -e /path/to/export2.json Spine -i /path/to/images/ -o /path/to/output/ --pack /path/to/pack.json Spine -i /path/to/images/ -o /path/to/output/ -p /path/to/pack.json Spine -i /path/to/project1.spine -o /path/to/output/ -e /path/to/export1.json  -i /path/to/project2.spine -e /path/to/export2.json -i /path/to/images/  -o /path/to/output/ -p /path/to/pack.json 

-i 需要导出的 XX.spine路径

-o 导出路径

-e 设置json 注:我们可以在spine 软件中, spine ->export中进行设置,然后点击save,保存一个json文件,就是导出时需要的文件。我这里起名字为spinesetting.json

-i spine路径 -o 导出路径 -e setting.json路径
在工具里面,根据我们的需求设置完成后,然后点击save,保存一个json文件,就是咱们需要的json文件

Spine批量导出Command line Export

另一种是 -i -o -p

-p Texture atlas name or path to pack settings JSON file.

2.使用bat,批量操作

下面是我写的一个bat命令。复制出来,然后新建个test.bat,复制就可以,然后修改一下。bat命令我不太熟悉,请见谅。。。

@echo off set DIR=%~dp0  echo - cleanup if exist "%DIR%SpineExport" rmdir /s /q "%DIR%SpineExport" mkdir "%DIR%SpineExport"  echo -spineExport for /f "delims=" %%i in ('dir /b/a-d/s %DIR%SpineSource/*.spine') do Spine -i %%i -o "%DIR%SpineExport" -e "%DIR%spinesetting.json" echo -exportEnd pause
set DIR=%~dp0 :设置DIR变量为当前绝对路径
for /f "delims=" %%i in ('dir /b/a-d/s %DIR%SpineSource/*.spine') :遍历文件夹下和子文件夹下的.spine类型文件 ,并执行导出命令。


官网文档 http://zh.esotericsoftware.com/spine-export
正文到此结束
Loading...