Author Topic: Optional Padding?  (Read 4630 times)

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Optional Padding?
« on: May 06, 2012, 08:26:10 PM »
Hey Aren,

Can you please add the option to disable/enable padding on the UIAtlas or base it from the crop feature of texturepacker? Setting them all to 0 manually gets overridden when you update the atlas with a new text file.

Thanks,
Rani

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Optional Padding?
« Reply #1 on: May 06, 2012, 08:27:23 PM »
Crop feature of texture packer?

What trouble are you having with padding? It simply replaces empty pixels with a number instead, for alignment purposes.

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Re: Optional Padding?
« Reply #2 on: May 06, 2012, 08:41:08 PM »
Hmm. We use the crop feature of texturepacker to remove unneeded (transparent) pixels surrounding the images and would like to anchor objects based on those "new" dimensions instead of the old one. For example, currently with padding, the pivot point would be outside of the image's boundaries due to padding, but we would like the pivot point to respect the new dimensions of the image in other words, not include the padding or extra pixels.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Optional Padding?
« Reply #3 on: May 06, 2012, 08:56:23 PM »
That's what the cropping feature in Atlas Maker does as well -- removes unneeded transparent pixels, replacing them with padding instead. This is necessary because otherwise it would be impossible to make frames of an animation line up when you place them on the screen. One frame may have a sprite of one size, another frame -- another size, and they simply won't line up. Padding resolves this.

It's equivalent to bringing the original texture in using UITexture. The pivot point will match. If I add an option to remove this feature for the entire atlas (thus cancelling out all padding), I can foresee a lot more problems from people posting "why is X offset?" and "why doesn't Y line up with Z?" from those who use it unknowingly.