diff --git a/.gitignore b/.gitignore index 6528e159..10079db6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,16 @@ -.idea/* -.vscode/* - -node_modules/* - -package-lock.json - -.DS_Store -/index.js -/index.js.map -/dist/app -/electron/www +.idea/* +.vscode/* + +node_modules/* + +dist/* + +package-lock.json + +yarn.lock + +.DS_Store +/index.js +/index.js.map +/dist/app +/electron/www diff --git a/src/client/exporters/index.js b/src/client/exporters/index.js index 199e45c6..8d82499a 100644 --- a/src/client/exporters/index.js +++ b/src/client/exporters/index.js @@ -84,6 +84,9 @@ function prepareData(data, options) { let frame = {x: item.frame.x, y: item.frame.y, w: item.frame.w, h: item.frame.h, hw: item.frame.w/2, hh: item.frame.h/2}; let spriteSourceSize = {x: item.spriteSourceSize.x, y: item.spriteSourceSize.y, w: item.spriteSourceSize.w, h: item.spriteSourceSize.h}; let sourceSize = {w: item.sourceSize.w, h: item.sourceSize.h}; + + //Used when importing to Godot Atlas to retain the original sprite size + let margin = {x: (sourceSize.w - spriteSourceSize.w)/2, y: (sourceSize.h - spriteSourceSize.h)/2, h: sourceSize.h - spriteSourceSize.h, w: sourceSize.w - spriteSourceSize.w} let trimmed = item.trimmed; @@ -102,6 +105,10 @@ function prepareData(data, options) { frame.h *= opt.scale; frame.hw *= opt.scale; frame.hh *= opt.scale; + margin.x *= opt.scale; + margin.y *= opt.scale; + margin.w *= opt.scale; + margin.h *= opt.scale; spriteSourceSize.x *= opt.scale; spriteSourceSize.y *= opt.scale; @@ -117,6 +124,7 @@ function prepareData(data, options) { frame: frame, spriteSourceSize: spriteSourceSize, sourceSize: sourceSize, + margin: margin, rotated: item.rotated, trimmed: trimmed }); diff --git a/src/client/exporters/list.json b/src/client/exporters/list.json index 6fb28a7d..255b092f 100644 --- a/src/client/exporters/list.json +++ b/src/client/exporters/list.json @@ -51,15 +51,15 @@ "type": "Godot (atlas)", "description": "Godot Atlas format", "allowTrim": true, - "allowRotation": true, + "allowRotation": false, "template": "GodotAtlas.mst", "fileExt": "tpsheet" }, { "type": "Godot (tileset)", - "description": "Godot Tileset format", + "description": "Godot Tileset format (3.x only)", "allowTrim": true, - "allowRotation": true, + "allowRotation": false, "template": "GodotTileset.mst", "fileExt": "tpset" }, diff --git a/src/client/resources/static/exporters/GodotAtlas.mst b/src/client/resources/static/exporters/GodotAtlas.mst index 890dc8e8..05f97ca5 100644 --- a/src/client/resources/static/exporters/GodotAtlas.mst +++ b/src/client/resources/static/exporters/GodotAtlas.mst @@ -17,10 +17,10 @@ "h": {{frame.h}} }, "margin": { - "x": 0, - "y": 0, - "w": 0, - "h": 0 + "x": {{margin.x}}, + "y": {{margin.y}}, + "w": {{margin.w}}, + "h": {{margin.h}} } }{{^last}},{{/last}} {{/rects}}