I just had a quick go at this (going through my whole HUD to fix items that had changed rotation every time I re-packed the textures was really getting on my nerves). My solution seems to work fine, and is pretty easy. No guarantees though - it's likely I've missed something somewhere...
Anyway, a brief summary of my changes:
NGUIJson.cs:
Just under
bool rotated = (bool)table["rotated"];
add
newSprite.isRotated = rotated;
UIAtlas.cs
Under
public bool hasPadding { get { return paddingLeft != 0f || paddingRight != 0f || paddingTop != 0f || paddingBottom != 0f; } }
add
public bool isRotated;
UISprite.cs
Under
float pixelSize = atlas.pixelSize
add
if (mSprite.isRotated)
{
float tmp = rect.width;
rect.width = rect.height;
rect.height = tmp;
}
Replace
uvs.Add(uv1);
uvs.Add(new Vector2(uv1.x, uv0.y));
uvs.Add(uv0);
uvs.Add(new Vector2(uv0.x, uv1.y));
with
if (!mSprite.isRotated)
{
uvs.Add(uv1);
uvs.Add(new Vector2(uv1.x, uv0.y));
uvs.Add(uv0);
uvs.Add(new Vector2(uv0.x, uv1.y));
}
else
{
uvs.Add(new Vector2(uv1.x, uv0.y));
uvs.Add(uv0);
uvs.Add(new Vector2(uv0.x, uv1.y));
uvs.Add(uv1);
}
That should be it!
ArenMook - if this looks OK to you, any chance you could drop it into the next version? I'd hate to have to merge it in every time.
Cheers!
Rob.