Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

"Texture name already in use"
Started by travis.gesslein Sep 28 2015 04:08 AM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

travis.gesslein

[GLOBAL: userInfoPane.html]
travis.gesslein
  • Observer

  • 2 posts
  • Corona SDK

Hello.

 

My artist has created dozens of different sprites for various creatures, but he (understandably) named them similarly and put them into different sub folders. So now there are a lot of creatures who have shared names in their sprites, like idle1.png, idle2.png, attack1.png, attack2.png (for the different frames of the animation). 

 

It seems I can't just include them into the texture atlas - it will complain about duplicated uses. 

 

It seems to me this problem can be solved if there was an option that prepended the sub folder (relative to the folder of the .tps file) name to the texture name, such that in the exported sprite sheet (for example, a plist) would read "subfolder1/subfolder2/attack1.png" etc. 

 

Is this somehow possible with texturepacker? Or can I solve this problem another way without renaming all the sprites?

 

What complicates the problem is that these sprites are used in Spriter, so the animations in that project would have to be updated too.



[TOPIC: post.html]
#2

andreas.loew

[GLOBAL: userInfoPane.html]
andreas.loew
  • Enthusiast

  • 79 posts
  • Corona SDK

That's no problem in TexturePacker:

 

Make sure that you use smart folders. That means: Don't add single images - add the containing folders

E.g. if your file structure is

 

  • MySprites
    • Enemy1
      • ​Walk01.png
      • Walk02.png
    • Enemy2
      • Walk01.png
      • Walk02.png

Simply add the MySprites folder. This will create the following sprite names for you:

 

  • Enemy1/Walk01.png
  • Enemy1/Walk02.png
  • Enemy2/Walk01.png
  • Enemy2/Walk02.png

If you want the MySprites folder as part of the name too, either add one more folder level on top. Or use "prepend folder name"

Attached File  corona.png   24.05KB   2 downloads

 

Using smart folders has another big advantage: TexturePacker re-scans the folder contents and updates the sprite sheets. You don't have to add single sprites anymore. Just save them into the right folder.

 

About the second problem: Spine - I think that it should work too, if you add the folders. But I am not sure about that.



[TOPIC: post.html]
#3

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 466 posts
  • Corona SDK

Hi Travis,

 

This is pretty much just an echo of Andreas' post mentioning the use of smart folders, but Texture Packer came up on tonight's Corona Geek After Dark hangout and then this forum post got mentioned - and we walked through the process of adding identically-named images in separate subfolders using smart folders on the call. So if you want to see it in action in a video format, you can check out tonight's hangout. We talked about this around the 1-hour, 35-minute mark. The video may not be up immediately, but by tomorrow you'll be able to view it at http://www.youtube.com/coronageek.

 

Good luck!



[TOPIC: post.html]
#4

travis.gesslein

[GLOBAL: userInfoPane.html]
travis.gesslein
  • Observer

  • 2 posts
  • Corona SDK

Yup, that solved the problem completely. Thank you!




[topic_controls]
[/topic_controls]