-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix for rotated images #6
Conversation
@@ -88,7 +88,7 @@ | |||
|
|||
<!-- If enabled TexturePacker allows the user to choose non-power-of-2 sizes for sprite | |||
sheets. Otherwise, only power-of-2 (POT) sizes are enabled in the user interface. --> | |||
<supportsNPOT>false</supportsNPOT> | |||
<supportsNPOT>true</supportsNPOT> |
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.
Might as well update the settings when updating the version number more officially to 1.1 as it's a bit of a turnaorund for the TP team to integrate the changes.
<writePivotPoints>trufalsee</writePivotPoints> <!-- true, false --> | ||
<defaultPivotPoint>0.0,0.0</defaultPivotPoint> | ||
<writePivotPoints>false</writePivotPoints> <!-- true, false --> | ||
<defaultPivotPoint>0.5,0.5</defaultPivotPoint> |
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.
Unit coords. I.e. middle of our sprites which is exactly what we currently use.
@@ -130,8 +130,8 @@ | |||
<borderPadding>0</borderPadding> | |||
<trimMode>Polygon</trimMode> <!-- None, Trim, Crop, CropKeepPos, Polygon --> | |||
<sizeConstraints>POT</sizeConstraints> <!-- POT, WordAligned, AnySize --> | |||
<writePivotPoints>trufalsee</writePivotPoints> <!-- true, false --> | |||
<defaultPivotPoint>0.0,0.0</defaultPivotPoint> | |||
<writePivotPoints>false</writePivotPoints> <!-- true, false --> |
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.
Only write the pivot if the user has enabled the check box for the sprite.
default_texture_min_filter = nearest | ||
default_texture_mag_filter = nearest |
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.
Makes it look a lot nicer when inspecting the test data
float originalWidth = image.rotated ? image.rect.height : image.rect.width; | ||
float originalHeight = image.rotated ? image.rect.width : image.rect.height; |
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.
We need the original size when using it with the vertices (as they're not rotated)
@@ -0,0 +1,48 @@ | |||
# The .tpinfo format |
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.
Added a small readme, so that others may help writing exporters from other tools.
// When rotated, the "top left" of the image is now the top right | ||
// and we need to use the tight rect to find it | ||
float corner_x = tightRect.getX() + tightRect.getWidth() + offsety; | ||
float corner_y = tightRect.getY() - offsetx; | ||
x = corner_x - originalSize.getHeight(); | ||
y = corner_y; |
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.
Reconstructing the rectangle when it's rotated, and also uses an offset.
Perhaps that's something that the .tpinfo format should provide, but that's for a future task.
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.
should we have a separate ticket for that to keep it in mind?
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.
Added #7
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.
Looks good. It's a bit complicated logic with rotation, but as I remember we have similiar in the main atlas in bob as well
// When rotated, the "top left" of the image is now the top right | ||
// and we need to use the tight rect to find it | ||
float corner_x = tightRect.getX() + tightRect.getWidth() + offsety; | ||
float corner_y = tightRect.getY() - offsetx; | ||
x = corner_x - originalSize.getHeight(); | ||
y = corner_y; |
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.
should we have a separate ticket for that to keep it in mind?
Related PR: defold/defold#8874