Author Topic: Sprite Paddings from Atlas disappear, after upgrading atlas  (Read 18858 times)

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Sprite Paddings from Atlas disappear, after upgrading atlas
« on: November 03, 2014, 05:14:06 PM »
Everytime i update an atlas, it drops padding configuration for sprites. He always keeps everything else, borders are there, but no Padding :(
http://gyazo.com/b8e4f99bc85a4d59d3f55573614d63f7
« Last Edit: December 08, 2014, 04:44:46 AM by AGB »
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #1 on: November 04, 2014, 09:51:59 AM »
That's right. Padding is derived from the original image. It represents the number of pixels cut out and replaced with padding values instead. If you want to keep it, have the original image be the dimensions you want. Instead of specifying a 40x30 image and giving it padding, specify the full sized desired sprite, for example 50x50 -- meaning the source texture needs to have those dimensions.

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #2 on: November 04, 2014, 02:15:28 PM »
Why dont you reset paddings only if the "pixel cut" function is on? im using paddings for big shadows of objects, so when i set width to 100, i never think about how big is the shadow of this sprite - very nice way to use paddings for this case.
I'm a busy man... I have places to go,monsters to kill...

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #3 on: November 05, 2014, 02:53:17 PM »
I mean, shen you are using "Remove empty space" function - those paddings are positive and it works very nice. But paddings are extremally useful, when setting them to negative value! nice for custom shadows and offsetting UI Visual design objects, that must not be affetced by width.
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #4 on: November 06, 2014, 02:08:56 AM »
Simple answer? Because that's not what this feature was meant for :P

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #5 on: November 06, 2014, 02:54:22 AM »
But is there a reason then to allow me to modify those paddings? Maybe they should be read-only?
But anyway - i beg to you to check this feature deeper with those "negative paddings":


I can easily anchor an abstract sprite to a label size, and then change sprite like this:


And because of those negative paddings, sprite will always have a nice look! It is verry useful, when you have to switch different styles of atlases for same prefabs!
(just a bad sample, but still)
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #6 on: November 07, 2014, 01:28:47 PM »
I'm not sure I understand the point of it. What can you do with negative padding that you can't already do by using the built-in anchors?

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #7 on: November 07, 2014, 03:08:16 PM »
Built in anchors help to bing one object to another.
Like this:


Sprite size now depends on Label text amount. But what is i want to change spritte to another frame:


Negative paddings for this sprite help me to adjust its size. Without those negative padding i would get this result:


But because this new sprite has a big part in the left side - i use negative paddings to "move" this design part, and free space for my text:
So i set them like this:

Here is a small video of changing sprites and always getting text inside a frame, even if sprites had different dimensions and offsets:
http://gyazo.com/cce397128c4bb8d7b5c168c117fa2e01

Here is also a package with atlas and prefab - try it yourself!
https://dl.dropboxusercontent.com/u/8776150/paddings-package.unitypackage

It is soo cool, that using negative padding saves so lot of time, when your sprites are anchores to text like this.
I'm a busy man... I have places to go,monsters to kill...

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #8 on: December 08, 2014, 04:44:24 AM »
Hello, mister ArenMook!

Still no chance to use negative padding for buttons, like this one?
http://gyazo.com/99e68755e43314b069f73040f9d59438


If i just want to change button sprite in this screen:
http://gyazo.com/b1f6e38305ead03b79c17aa9cbabb6fb

And just use Borders for that case (without paddings)
http://gyazo.com/408e3682f92cad2fc766b8e52cb0f9c3

It looks like this:
http://gyazo.com/b8da01dd5c20e3c7b9270a78e111d08a

i have to modify the prefab.
But with help of paddings i can get this result:
http://gyazo.com/5d0d33554e2df9bfbe6609b651259ca5

Is it possible to not reset paddings, if i not set "Trim Alpha"?


I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #9 on: December 09, 2014, 01:16:56 PM »
Use them how? You can use them freely, so not sure what you're asking.

Adding an option to not reset padding -- I can add that.

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Sprite Paddings from Atlas disappear, after upgrading atlas
« Reply #10 on: December 09, 2014, 02:36:55 PM »
> Use them how? You can use them freely, so not sure what you're asking.

I cannot use them, because they always reset after i update my atlas. I have 50 sprites with those paddings and have to write them again after each update.

> Adding an option to not reset padding -- I can add that.

 Yaaay!  :) :)
I'm a busy man... I have places to go,monsters to kill...