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
Texture Packer page indexes #6630
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn't have to be a breaking change if it is made configurable.
extensions/gdx-tools/src/com/badlogic/gdx/tools/texturepacker/TexturePacker.java
Outdated
Show resolved
Hide resolved
extensions/gdx-tools/src/com/badlogic/gdx/tools/texturepacker/TexturePacker.java
Outdated
Show resolved
Hide resolved
@tommyettinger Did you know there's a I'm going to add that I should go to bed - marking this as draft so someone doesn't go merging it in its current state, even if I end up opening it again tomorrow. |
Indeed I do know, I set |
Tested as working. Marking as draft was overkill, in hindsight. |
String name = imageName; | ||
if (fileIndex > 1) { | ||
if (settings.legacyPages && fileIndex > 1 || !settings.legacyPages && pages.size > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs parenthesis to make it clear.
Sorry, but I don't really see the usefulness of this setting. It's not difficult to read files with the naming before this PR. Most people use TextureAtlas to do the reading anyway, so the file names are unimportant. IMO for any feature, ideally default behavior should be found so a setting is not needed. Settings should only be added where necessary. This simplifies using a tool and forces putting in the effort to make the tool work well without a user needing to understand hundreds settings. Look at Maya or similar software for how not to do it.
The packer doesn't know how many page images there will be. It may pack one page the first time, then later be run again, append to the atlas file and pack additional pages.
When naming files I prefer It's common that an atlas has only one page image, in which case |
I would prefer to not use a setting, but that would make this a breaking change and not everyone is a fan of that. Meanwhile, I'm not a fan of discovering that we're already using a legacy output mode by default just for the sake of ensuring everything keeps ticking along unchanged.
If you saw what this paragraph said previously, forget about it. I've now tested running it after adding and removing images, and the previous output gets deleted. I don't see under what circumstances future runs could pose an issue.
Could fix this with another setting. Haha, just kidding. Yeah, it's divisive. Trivial to change back to being one-indexed if that's the consensus.
Agreed. In the event it only has one page, it would be |
TexturePackerFileProcessor processes a directory hierarchy of image files. It first deletes all output files, then creates and runs a TexturePacker for each directory: I greatly appreciate your enthusiasm, but I'm not convinced this needs changing. Does it really matter if the images are named |
Thanks for the code link and explanation. You're right - this does require more thought. And due to how it goes along one subdirectory at a time like that, I can't currently see how to solve this. It doesn't need changing, though 5 people agree with the original issue with no disagreements, so it would certainly be nice to have. |
Don't be deceived by the number of changed lines. Only lines 204 and 238 inTexturePacker.java
actually change any functionality. But those lines make this a breaking change! At least, I think they do - the linked issue was labelled as breaking.[That opening paragraph is now outdated. It is no longer a breaking change (meaning we're stuck with the old behaviour by default FOREVER) and now a couple more lines do stuff.]
It aims to fix #6239 by adding an index to the first texture page. Just like previously, an index isn't added if the atlas is only one page long.
No-one asked for this, but I also made the index start at 0 instead of 1. My reasoning behind this is it's easier to iterate over your textures and all that this way - no need to have
+ 1
all over the place. It wouldn't be worth changing this on its own, but seeing as this would still be a breaking change without it....There's also a little bit of tidy-up to reduce warnings about redundancy and whatnot, but it's a very minimal effort.
P.S. I actually have Git configured properly now - there'll be no more "Frosty-J and Frosty-J committed" business.
P.P.S. Now it's configured even better. Verified commits!