spright icon indicating copy to clipboard operation
spright copied to clipboard

Sprite with same key prefix with same size

Open paulocoutinhox opened this issue 1 year ago • 4 comments

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 "explosion_1_" have the same size?

Thanks.

paulocoutinhox avatar Jul 25 '24 23:07 paulocoutinhox

Hi,

the option trim none is the correct option?

Thanks.

paulocoutinhox avatar Jul 26 '24 00:07 paulocoutinhox

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 avatar Jul 27 '24 14:07 houmain

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"

houmain avatar Jul 28 '24 08:07 houmain

perfect, thanks

paulocoutinhox avatar Jul 28 '24 15:07 paulocoutinhox