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文件
另一種是 -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