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

[Feature Request] Export Solar2D information and data #68

Open
Hexality opened this issue Feb 28, 2022 · 2 comments
Open

[Feature Request] Export Solar2D information and data #68

Hexality opened this issue Feb 28, 2022 · 2 comments

Comments

@Hexality
Copy link

Export sheet options information as a importable (local name = require("animation") lua file.
image

@Hexality
Copy link
Author

(these lua files and sheet got exported using trial version of texturepacker with sucks)

@jcbk101
Copy link

jcbk101 commented Jul 2, 2022

Here, try the code block at the very bottom.
Remember though, if 'trimmed' is not checked, remove these lines.

        sourceX = {{spriteSourceSize.x}},
        sourceY = {{spriteSourceSize.y}},
        sourceWidth = {{spriteSourceSize.w}},
        sourceHeight = {{spriteSourceSize.h}},

I cannot get...

 {{#trimmed}}
 "data in here" 
{{/trimmed}} 

...to act as "logic" though it is checked if true or false. :(

These lines are just here to produce the names. I cannot get any index numbers to print to save my life.
I guess that data is not passed in the "rects" prop. :( But they can be adjusted after all data is printed.

SheetInfo.frameIndex =
{
    {{#rects}}
    ["{{name}}"] = 1,
    {{/rects}}
}

If trim is checked then leave as is. Also, don't forget the check the box "Remove file ext".

Actual code to use in the "custom" export format window.

local SheetInfo = {}

SheetInfo.sheet =
{
  frames =  {
    {{#rects}}
      {
        -- {{{name}}}
        sourceX = {{spriteSourceSize.x}},
        sourceY = {{spriteSourceSize.y}},
        sourceWidth = {{spriteSourceSize.w}},
        sourceHeight = {{spriteSourceSize.h}},
 
        x = {{frame.x}},
        y = {{frame.y}},
        width = {{frame.w}},
        height = {{frame.h}},
      },
    {{/rects}} 
  },

  sheetContentWidth = {{config.imageWidth}},
  sheetContentHeight = {{config.imageHeight}}
}


SheetInfo.frameIndex =
{
    {{#rects}}
    ["{{name}}"] = 1,
    {{/rects}}
}


function SheetInfo:getSheet()
    return self.sheet;
end


function SheetInfo:getFrameIndex(name)
    return self.frameIndex[name];
end


return SheetInfo

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

2 participants