• Editor
  • Command Line --Project

Hey there, I want to pack a texture and use the polygon infos pro multiple projects, there is a way to use a command line to a folder path instead of a specific project?
So all my projects are inside a folder, so instead use


project Spine/file1.spine


project Spine/file2.spine, use just Spine/

Related Discussions
...

You can't specify a folder and have Spine process all the project files it finds, but you can write a script that runs a command for each file in a folder (or builds up one big command with all the files). What OS are you using?

Windows
I created a Batch file to export it, but I had to put all the files one by one.
I am not a programmer, so I tried to use "for" but I really didn't understand the language and how to save the results into a variable to use into the command line.
The best thing I could do was that:
SET path=


project "A:\Rusty Harpy\Road Warrior 2\Background\Wasteland\Spine\
SET project=%path%Antenna.spine" %path%Speakers.spine" %path%Submarine.spine" %path%Turbine.spine" %path%WoodFence.spine" %path%AirShips.spine" %path%Rockets.spine" %path%WreckedShip.spine" %path%Ramp.spine"

Windows batch scripting is the worse thing. To avoid it you could install Cygwin so you can use a bash script, but that may not be worthwhile just for this one thing. Here's how to collect all the .spine files in the current directory into a variable:

@echo off
Setlocal EnableDelayedExpansion
for %%F in ("*.spine") do (
   set args=!args! 

---

project %%~nxF
)
echo %args%

You can replace "*.spine" with a path like "C:\path\to\dir\*.spine".

That just echos (prints) the args variable. You can use the variable when running Spine like this:

spine -i input.spine %args% -o /path/to/output/ -p /path/to/pack.json

You could also use this to export many project files with one Spine invocation, which will be faster than running Spine many times. Please let us know if you need any more assistance getting it working!

Thank you for the reply. Before you answer I found a solution close to yours:

@ECHO OFF &SETLOCAL
for /r "A:\Rusty Harpy\Road Warrior 2\Background\Wasteland\Spine" %%i in (*.spine) do call set "Myvar=%%Myvar%% 

---

project "%%i""
ECHO %Myvar:~2%

SET atlasName="WastelandAtlas"
SET pathToImages="A:\Rusty Harpy\Road Warrior 2\Background\Wasteland\DifuseImages"
SET pathToOutput="P:\Arquivos\Unity\Road Warrior 2\Assets\Backgrounds\Wasteland\DifuseAtlas"
SET pathToPack="A:\Rusty Harpy\Road Warrior 2\Background\Wasteland\export.json"

"P:\Program Files (x86)\Spine\Spine.com" 

---

input %pathToImages% -%Myvar:~2% 

---

output %pathToOutput% 

---

name %atlasName% 

---

pack %pathToPack%