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

Texture Packer page indexes #6630

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
@@ -1,5 +1,6 @@
[1.10.1]
- [BREAKING CHANGE] Android Moved natives loading out of static init block, see #5795
- [BREAKING CHANGE] Texture Packer: Filenames are now zero-indexed, including the first file (when there are multiple pages) - e.g. pack.png, pack2.png would now be pack0.png, pack1.png
- API Addition: ObjLoader now supports ambientColor, ambientTexture, transparencyTexture, specularTexture and shininessTexture
- API Addition: PointSpriteParticleBatch blending is now configurable.
- TOOLS Features: Blending mode and sort mode can be changed in Flame particle 3D editor.
Expand Down
Expand Up @@ -201,7 +201,7 @@ private void writeImages (File outputDir, String scaledPackFileName, Array<Page>
File packDir = packFileNoExt.getParentFile();
String imageName = packFileNoExt.getName();

int fileIndex = 1;
int fileIndex = 0;
Frosty-J marked this conversation as resolved.
Show resolved Hide resolved
for (int p = 0, pn = pages.size; p < pn; p++) {
Page page = pages.get(p);

Expand Down Expand Up @@ -233,9 +233,9 @@ private void writeImages (File outputDir, String scaledPackFileName, Array<Page>
page.imageHeight = height;

File outputFile;
while (true) {
do {
String name = imageName;
if (fileIndex > 1) {
if (pages.size > 1) {
// Last character is a digit or a digit + 'x'.
char last = name.charAt(name.length() - 1);
if (Character.isDigit(last)
Expand All @@ -246,8 +246,7 @@ private void writeImages (File outputDir, String scaledPackFileName, Array<Page>
}
fileIndex++;
outputFile = new File(packDir, name + "." + settings.outputFormat);
if (!outputFile.exists()) break;
}
} while (outputFile.exists());
new FileHandle(outputFile).parent().mkdirs();
page.imageName = outputFile.getName();

Expand Down Expand Up @@ -704,9 +703,8 @@ public boolean equals (Object obj) {
if (getClass() != obj.getClass()) return false;
Rect other = (Rect)obj;
if (name == null) {
if (other.name != null) return false;
} else if (!name.equals(other.name)) return false;
return true;
return other.name == null;
} else return name.equals(other.name);
}

@Override
Expand All @@ -719,7 +717,7 @@ static public String getAtlasName (String name, boolean flattenPaths) {
}
}

static public enum Resampling {
public enum Resampling {
Frosty-J marked this conversation as resolved.
Show resolved Hide resolved
nearest(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR), //
bilinear(RenderingHints.VALUE_INTERPOLATION_BILINEAR), //
bicubic(RenderingHints.VALUE_INTERPOLATION_BICUBIC);
Expand Down Expand Up @@ -802,10 +800,10 @@ static public boolean processIfModified (Settings settings, String input, String
return false;
}

static public interface Packer {
public Array<Page> pack (Array<Rect> inputRects);
public interface Packer {
Array<Page> pack(Array<Rect> inputRects);

public Array<Page> pack (ProgressListener progress, Array<Rect> inputRects);
Array<Page> pack(ProgressListener progress, Array<Rect> inputRects);
}

static final class InputImage {
Expand Down
Expand Up @@ -38,9 +38,9 @@
public class TexturePackerFileProcessor extends FileProcessor {
private final Settings defaultSettings;
private final ProgressListener progress;
private ObjectMap<File, Settings> dirToSettings = new ObjectMap();
private Json json = new Json();
private String packFileName;
private final ObjectMap<File, Settings> dirToSettings = new ObjectMap();
private final Json json = new Json();
private final String packFileName;
private File root;
ArrayList<File> ignoreDirs = new ArrayList();
boolean countOnly;
Expand Down