Add a convert command; JSON libraries come before layers
`anm2ed convert <file> [--format json|xml] [--out PATH]` saves a document as the editor does: XML (the default) is the game's copy with the editor's embedded, animation layers flattened through their libraries; JSON is the editor's own. Without --out the file is rewritten in place. JSON problems go to stderr; a file that can't load or write exits 1, a bad --format 2. A document loads without an OpenGL context now: its custom shaders just aren't compiled. The file and --out are made absolute, so a bare file name has a folder (render and frame crashed on one too). JSON writes and reads "libraries" before "layers", so a layer's library index is checked against the libraries rather than reported missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
201a7c7cfc
commit
c9d68781d0
5 files changed
+53
-8
No files matched your search
+3
-3
@@ -32,6 +32,9 @@ A regular save is different: it writes the game's `.anm2` XML, with the editor's
|
||||
"shaders": [
|
||||
{"name": "glow", "vertex": "glow.vs", "fragment": "glow.fs", "uniforms": [{"name": "strength", "value": "0.5"}]}
|
||||
],
|
||||
"libraries": [
|
||||
"shared/shadows.anm2"
|
||||
],
|
||||
"layers": [
|
||||
{"name": "torso", "sheet": 1},
|
||||
{"name": "hx", "animation": "Head"},
|
||||
@@ -46,9 +49,6 @@ A regular save is different: it writes the game's `.anm2` XML, with the editor's
|
||||
],
|
||||
"sounds": [
|
||||
"sounds/step.ogg"
|
||||
],
|
||||
"libraries": [
|
||||
"shared/shadows.anm2"
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user