djmisterjon

hi pixi-spine released a branch for ...3.8.13b break change.
https://github.com/pixijs/pixi-spine/tree/v4.x-3.8beta

now suppose i have 43> spines files in my projet !
i know i can open manually each projet with the software , and export manually (rebuild) .json and .atlas to update each skeleton from 3.8.11 to 3.8.13

But did you have a tools to proceed with node automatically ?
do you java tool allow this for save time?
var exec = require('child_process').exec;
var compile = 'java -cp skeletonViewer-beta.jar com.esotericsoftware.spine.JsonRollback test1.json 3.8.13 test1.json';
exec(compile , function(error, stdout, stderr) {
console.log('exec: ', exec);
});
or any tips are welcome

i can see many format change , this will maybe hard !


and value seem change between version.. dhoo!




also in Window, we are able to extract each files projet.
i don't know if this can be useful to proceed with a tool or options in you software to batch automations ?
djmisterjon
  • Сообщения: 67

Nate

You can use the CLI to do many exports:
Export - Spine User Guide: Command line
Here's an example:
spine-runtimes/export.sh at 3.7
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

djmisterjon

hum this kind of files is for linux environment (ubuntu) right ?
You don't have a .bat to share for window?

---

Nate писал(а):You can use the CLI to do many exports:
Export - Spine User Guide: Command line
Here's an example:
spine-runtimes/export.sh at 3.7
hum..
what is this error ?


I confess am not really understand the difference with -o and -e ??
I'm sorry, it's not my specialty this type of language.

I progress in writing the program automate in .bat and node, now am testing the execution of your software, but I think I have some difficulty here, it will be nice to have some advice and tips.

this error append here when i exec Spine command.
function test() {
console.log(test::: "${SPINE_EXE}" -u ${VERSION}\n);
let dir = 'C:\\Users\\InformatiqueLepage\\Documents\\Dev\\anft_1.6.1';
exec("${SPINE_EXE}" -u ${VERSION} -i ${dir}\\data2\\Characteres\\a1\\SOURCE\\a1.spine -e ${dir}\\testExport.json,
(err, stdout, stderr) => {
if (err) { return console.log('err: ', err) && console.log('stderr: ', stderr) };
console.log(stdout1: ${stdout});
});
}
what will be the fully command for example:
Import
a1.spine
and export
testDir/a1.atlas
testDir/a1.json
testDir/a1.png



if i only execute
exec("${SPINE_EXE}" -u ${VERSION} -i ${dir}\\data2\\Characteres\\a1\\SOURCE\\a1.spine,
without -e , it seem work fine! so it the -e seem provide me this error.


thanks in advance for all help you are able to provide.
djmisterjon
  • Сообщения: 67

Nate

djmisterjon писал(а):hum this kind of files is for linux environment (ubuntu) right ?
You don't have a .bat to share for window?
Scripting in Windows batch files is extremely poor. It can be done, but it's very ugly and difficult to do even simple tasks. Cygwin can be used to run a script like what I linked on Windows.

djmisterjon писал(а):I confess am not really understand the difference with -o and -e ??
-o specifies the output path. -e specifies an export settings JSON file. See the usage:
Export: Spine [-i <path>[.spine|.json|.skel]] [-m] [-o <path>] -e <path>

Export JSON, binary, images, or video:
-i, --input Path to a folder, project, or data file. Overrides export JSON.
-m, --clean Animation clean up is performed before export.
-o, --output Path to write export file(s). Overrides export JSON.
-e, --export Path to export settings JSON file.
djmisterjon писал(а):what will be the fully command for example:
Import
a1.spine
and export
testDir/a1.atlas
testDir/a1.json
testDir/a1.png
Like this:
Spine --input a1.spine --output testDir --export settings.json
Where settings.json is the settings to do the export you want.
Export - Spine User Guide: Project export
The export settings JSON file is created using Spine by clicking on the Save button at the bottom of the Export dialog.
djmisterjon писал(а):if i only execute
exec("${SPINE_EXE}" -u ${VERSION} -i ${dir}\\data2\\Characteres\\a1\\SOURCE\\a1.spine,
without -e , it seem work fine! so it the -e seem provide me this error.

If an action (-e/--export, -p/--pack, etc) is not specified then Spine just shows some information about the input file. Likely you aren't specifying an export settings file when you use -e/--export.
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

djmisterjon

Scripting in Windows batch files is extremely poor. It can be done, but it's very ugly and difficult to do even simple tasks. Cygwin can be used to run a script like what I linked on Windows.
yes true, i just want made a easy one click app.
But most of the program is write in js execute with node.
@echo off
title Spine Node Convertor (batch convert)
where node.exe >nul 2>&1 && echo Node detected || echo ERROR Node not detected , plz install it && pause && exit
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo This setup needs admin permissions. Plz run this file as admin && pause && exit.
)
echo Admin permissions detected.
PING localhost -n 2 >NUL
echo.
cd %~dp0
node spineConvertor.js %~dp0
cmd /k
And node js part:
const path = require('path');
const fs = require('fs' );
const { exec } = require('child_process');
const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})

let SPINE_EXE = null;
let VERSION = null;
let ROOT = process.argv[2];
console.log(process.versions);
console.log('\x1b[33m%s\x1b[0m',\nROOT PROJECT: ${ROOT}\n);
const q1 = () => {
return new Promise((res, rej) => {
console.log('\x1b[32m%s\x1b[0m',Enter Spine install directory?);
rl.question(' By default is: "C:\\Program Files (x86)\\Spine"\n if default leave empty.\n', (dir) => {
SPINE_EXE = dir && dir+"\\Spine.com" || "C:\\Program Files (x86)\\Spine\\Spine.com";
console.log('\x1b[33m%s\x1b[0m',SPINE_EXE: [ ${SPINE_EXE} ] Asigned!\n);
res();
});
})
}

const q2 = () => {
return new Promise((res, rej) => {
console.log('\x1b[32m%s\x1b[0m',Enter Spine version for exporter.);
rl.question( Example:\n 3.8.13-beta 'default'\n 3.8.11-beta\n 3.7.9\n 3.7.8\n, (ver) => {
VERSION = ver || '3.8.13-beta';
console.log('\x1b[33m%s\x1b[0m',Version: [ ${VERSION} ] Asigned!\n);
res()
})
})
};

const scan = () => {
return new Promise((res, rej) => {
console.log('\x1b[32m%s\x1b[0m',SCANNING SPINES PROJECT FILES IN SUB DIRECTORY);
let data = {};
let fromDir = (startPath,filter)=>{
if (!fs.existsSync(startPath)){ return console.log("no dir ",startPath) };
let files=fs.readdirSync(startPath);
for(let i=0;i<files.length;i++){
let filename=path.join(startPath,files[i]);
let stat = fs.lstatSync(filename);
if (stat.isDirectory()){ fromDir(filename,filter) } //recurse
else if (filename.indexOf(filter)>=0) {
let filenameFormated = filename.replace(/\\/g, "/");
let dirArray = filenameFormated.split("/"); // repertoire path formated for array [,,,]
let fileData = path.parse(filenameFormated); // split data
dirArray.pop();
fileData.dirArray = dirArray;
fileData.root = ${fileData.dir}/${fileData.base}
data[fileData.name] = fileData;
console.log('\x1b[33m%s\x1b[0m',FOUND: [ ${fileData.base} in ${fileData.dir} ]\n);
};
};
};
fromDir('data2','.spine'); //START: startPath, extention.Filter
setTimeout(() => {
console.log('SCAN RESULT: ', data,'\n\n');
console.log('\x1b[32m%s\x1b[0m',Check if files look fine?);
rl.question( Enter (y) to continue\n, (fileOk) => {
fileOk==='y' && res();
console.error('Fix your files and restart');
});
}, 500);
});
};

const main = async () => {
await q1()
await q2()
await scan()
test()
rl.close()
}
main()


function test() {
console.log('\x1b[33m%s\x1b[0m',test::: "${SPINE_EXE}" -u ${VERSION}\n);
var dir = 'C:\\Users\\InformatiqueLepage\\Documents\\Dev\\anft_1.6.1';
exec("${SPINE_EXE}" \ -u ${VERSION} -i ${ROOT}\\data2\\Characteres\\a1\\SOURCE\\a1.spine,
(err, stdout, stderr) => {
if (err) { return console.log('err: ', err) && console.log('stderr: ', stderr) };
console.log(stdout1: ${stdout});
});
};
.
Where settings.json is the settings to do the export you want.
The export settings JSON file is created using Spine by clicking on the Save button at the bottom of the Export dialog
haaa i see, thanks i think i understand now.
I thought he was taking the default setting of the project?

i will give a try , thanks you so much for your time.

---
EDIT:



Nate писал(а):.
hum...
i get a error with with the basic json
Spine Launcher 3.7.91
Esoteric Software LLC (C) 2013-2019 | http://esotericsoftware.com
Windows 10 Enterprise x86 10.0
Spine 3.8.13-beta Professional
ERROR: Error reading export settings file:
C:/Users/InformatiqueLepage/Documents/Dev/anft_1.6.1/setupExport.json
java.lang.RuntimeException: Unknown object type: class il
at com.esotericsoftware.spine.editor.export.ExportSettings.a(SourceFile:60)
at mG.<init>(SourceFile:79)
at com.esotericsoftware.spine.editor.Editor.main(SourceFile:1515)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at tzax.B.run(SourceFile:2030)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
it put a copy past from the example in setupExport.json
{
pot: true,
paddingX: 2,
paddingY: 2,
bleed: true,
edgePadding: true,
duplicatePadding: false,
rotation: false,
minWidth: 16,
minHeight: 16,
maxWidth: 1024,
maxHeight: 1024,
square: false,
stripWhitespaceX: false,
stripWhitespaceY: false,
alphaThreshold: 0,
filterMin: Nearest,
filterMag: Nearest,
wrapX: ClampToEdge,
wrapY: ClampToEdge,
format: RGBA8888,
alias: true,
outputFormat: png,
jpegQuality: 0.9,
ignoreBlankImages: true,
fast: false,
debug: false,
combineSubdirectories: false,
flattenPaths: false,
premultiplyAlpha: false,
useIndexes: true,
grid: false,
scale: [ 1 ],
scaleSuffix: [ "" ],
limitMemory: true,
ignore: false
}
but i also try with double quote, same...
i forget something ?

the full command seem ok:
"C:\Program Files (x86)\Spine\Spine.com"
-u 3.8.13-beta
--input C:\Users\InformatiqueLepage\Documents\Dev\anft_1.6.1\data2\Characteres\a1\SOURCE\a1.spine
--output C:\Users\InformatiqueLepage\Documents\Dev\anft_1.6.1\test
--export C:\Users\InformatiqueLepage\Documents\Dev\anft_1.6.1\setupExport.json
EDIT.
OK WORKING
you need export from spine , the demo page are wrong.
like you say here, this working fine.
Export PNG preview from command line
djmisterjon
  • Сообщения: 67

Nate

The JSON you showed is texture packer settings JSON.

Glad you got it working! :)
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

djmisterjon

Nate писал(а):The JSON you showed is texture packer settings JSON.

Glad you got it working! :)
Thanks for your time and your help.
I share the programme with a tuto for curious people.
It one click automate, or almost.
https://github.com/pixijs/pixi-spine/issues/301
djmisterjon
  • Сообщения: 67


Вернуться в Runtimes