Sign in to follow this  
Ninjadoodle

Latest Panda 2 Dev - Images from atlases size bug - SOLVED

Recommended Posts

Hi @enpu

I just wanted to double check if this is a bug, or whether I'm doing something wrong.

I am using texture packer and the Panda *.json format to export my sprite sheet - has something changed and do need to to use another format? 

The sizes of the graphics are all wrong when using @2x and @4x variants.

I'd like to start sharing some source code / examples with the community in the near future, but right now I can't get this working :)

Thanks in advance!

Share this post


Link to post
Share on other sites

Hi,

This was a bit tricky one, because there are two types of json files supported in Panda. Generic json files and sprite sheets. When using hires mode, you only want sprite sheet json filenames to change to load the hires one, not on generic json files. Since you can't know which type of json file it is before loading it, this makes it a bit tricky. I think there are two options:

1) Load json file and read it. If it's sprite sheet and hires is on, then load new proper hires version of the json file. Bad thing in this option is, that then there is always one unnecessary json file loaded in every sprite sheet. Though json files are typically pretty small files.

2) Change sprite sheet json files to other extension. Like spritesheet.atlas or something. This would need update on Texture Packer also.

I did now some changes on the loader based on the option 1, since it doesn't require any changes from user. But i will really have to think about other options, because loading unnecessary files doesn't feel really good idea. 

Share this post


Link to post
Share on other sites

Hi @enpu

Thank you for your indepth explanation of the issue. It sound like it's quite annoying to deal with.

I really appreciate you putting in the time to find a workaround for this, until there is a better solution.

Thanks again :)

Share this post


Link to post
Share on other sites

Hi @enpu

There is still a problem with sizing when setting up animations from atlases.

The animations show at half the size they are supposed to be. I've tested this by loading a single image with @2x @4x variants and also by loading a single image from an atlas.

Everything works unless you are setting up an animation.

Share this post


Link to post
Share on other sites

Hi @enpu

I've just attacked an example of the sprite sheet issue.

I've included a single image with @2x and @4x assets as well as the atlases.

As you see, the single image loads at the correct size, while the sprite sheet anim shows at half dimensions.

Thank you!

Archive.zip

Share this post


Link to post
Share on other sites

No problem!

I'm doing some refactoring on the code and there will be some functions renamed/moved etc and anchors are switched back to percents (using pixels was not a good idea after all). So if you are in a middle of a project, might be good idea to not pull any changes if you don't have any bigger issues, or you might have to rewrite some of your code.

Share this post


Link to post
Share on other sites

Hi @enpu

i actually prefer the percentages for anchors :)

I don't mind rewriting the code, but it would be awesome to have some sort of resource / log, of the changes made.

I'd really like to do some tutorials as well, and keep them up to date with the latest changes, but a lot of the time I don't know what's changed until I hit an error.

A good example is the particles. I can't get them working, as I can't figure out what's changed since the last version.

A small log file with the changes made would be absolutely awesome :)

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.