houmain / spright

An advanced sprite sheet packer and sprite annotator.
GNU General Public License v3.0
50 stars 10 forks source link

Sprite with same key prefix with same size #16

Closed paulocoutinhox closed 3 weeks ago

paulocoutinhox commented 1 month ago

Hi,

There is any option that make all images with same prefix have the same size?

Example:

<key>explosion_1_2</key>
<dict>
      <key>spriteOffset</key>
      <string>{ 0, 0 }</string>
      <key>spriteSize</key>
      <string>{ 57, 56 }</string>
      <key>spriteSourceSize</key>
      <string>{ 57, 56 }</string>
      <key>textureRect</key>
      <string>{ { 964, 2 }, { 57, 56 } }</string>
      <key>textureRotated</key>
      <true />
      <key>aliases</key>
      <array />
</dict>
<key>explosion_1_3</key>
<dict>
      <key>spriteOffset</key>
      <string>{ 0, 0 }</string>
      <key>spriteSize</key>
      <string>{ 64, 63 }</string>
      <key>spriteSourceSize</key>
      <string>{ 64, 63 }</string>
      <key>textureRect</key>
      <string>{ { 449, 449 }, { 64, 63 } }</string>
      <key>textureRotated</key>
      <false />
      <key>aliases</key>
      <array />
</dict>
<key>explosion_1_4</key>
<dict>
      <key>spriteOffset</key>
      <string>{ 0, 0 }</string>
      <key>spriteSize</key>
      <string>{ 46, 45 }</string>
      <key>spriteSourceSize</key>
      <string>{ 46, 45 }</string>
      <key>textureRect</key>
      <string>{ { 964, 281 }, { 46, 45 } }</string>
      <key>textureRotated</key>
      <true />
      <key>aliases</key>
      <array />
</dict>
<key>explosion_1_5</key>
<dict>
      <key>spriteOffset</key>
      <string>{ 0, 0 }</string>
      <key>spriteSize</key>
      <string>{ 53, 52 }</string>
      <key>spriteSourceSize</key>
      <string>{ 53, 52 }</string>
      <key>textureRect</key>
      <string>{ { 964, 120 }, { 53, 52 } }</string>
      <key>textureRotated</key>
      <true />
      <key>aliases</key>
      <array />
</dict>

How to make all images that start with "explosion1" have the same size?

Thanks.

paulocoutinhox commented 1 month ago

Hi,

the option trim none is the correct option?

Thanks.

houmain commented 1 month ago

Yes, you could either disable the trimming for these sprites or interpret the pivot point (aka anchor) which allows you to place differently trimmed sprites at the correct position. I just added the anchor to the cocos2x template.

houmain commented 1 month ago

With the latest version 3.5.2 glob only adds not yet encountered inputs. So you could disable the trimming only for the explosion and keep it for the rest like this:

glob "images/explosion/*.png"
  trim none

glob "images/**/*.png"
paulocoutinhox commented 1 month ago

perfect, thanks