Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero offset when use "Spine" exporter #39

Open
songinnight2 opened this issue Mar 16, 2022 · 0 comments
Open

zero offset when use "Spine" exporter #39

songinnight2 opened this issue Mar 16, 2022 · 0 comments

Comments

@songinnight2
Copy link

songinnight2 commented Mar 16, 2022

Spine atlas exporter offset is always 0,0
Offset should be calculated from lower-left corner.
I forked your module and wrote some additional codes.
I hope you helped a little.

exporters/index.js

let tpOffset = {
  x: item.spriteSourceSize.x,
  // *Caculate lower-left corner based offset for TexturePacker .atlas format
  y: item.sourceSize.h - (item.spriteSourceSize.y + item.spriteSourceSize.h)
};
return {
  name: name,
  frame: frame,
  spriteSourceSize: spriteSourceSize,
  sourceSize: sourceSize,
  index: index,
  first: index === 0,
  last: index === data.length - 1,
  rotated: item.rotated,
  trimmed: trimmed,
  // *Added tpOffset value to use inside .mst
  tpOffset: tpOffset,
};

exporters/Spine.mst

offset: {{tpOffset.x}},{{tpOffset.y}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant