diff --git a/src/client/exporters/index.js b/src/client/exporters/index.js index 199e45c..dc48fba 100644 --- a/src/client/exporters/index.js +++ b/src/client/exporters/index.js @@ -84,6 +84,7 @@ 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}; + let margin = {x: spriteSourceSize.x, y: spriteSourceSize.y, w: sourceSize.w - spriteSourceSize.w, h: sourceSize.h - spriteSourceSize.h}; let trimmed = item.trimmed; @@ -110,11 +111,15 @@ function prepareData(data, options) { sourceSize.w *= opt.scale; sourceSize.h *= opt.scale; + + margin.x *= opt.scale; + margin.y *= opt.scale; } ret.push({ name: name, frame: frame, + margin: margin, spriteSourceSize: spriteSourceSize, sourceSize: sourceSize, rotated: item.rotated, diff --git a/src/client/resources/static/exporters/GodotAtlas.mst b/src/client/resources/static/exporters/GodotAtlas.mst index 890dc8e..05f97ca 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}} diff --git a/src/client/resources/static/exporters/GodotTileset.mst b/src/client/resources/static/exporters/GodotTileset.mst index 890dc8e..05f97ca 100644 --- a/src/client/resources/static/exporters/GodotTileset.mst +++ b/src/client/resources/static/exporters/GodotTileset.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}}