Hello Guest

Author Topic: Batch Rename sprites in collection  (Read 5050 times)

dogbot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Batch Rename sprites in collection
« on: November 15, 2013, 10:48:46 pm »
Is there anyway to batch rename sprites within a sprite collection, built from a sprite sheet? Or is there a way to select a range of frames to be placed in an animation vs. having to select each frame one by one? We're setting up a bunch of animations for a sprite based game and currently is more steps to setup the animations then it is to create them.

Cheers!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Batch Rename sprites in collection
« Reply #1 on: November 15, 2013, 11:18:54 pm »
There isn't, but you can write a really simple editor script to do this. All you need to do is to edit the Selected tk2dSpriteCollection object, run through textureParams, and set names on what you need. Just remember to EditorUtility.SetDirty(...) when you're done.

dogbot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Batch Rename sprites in collection
« Reply #2 on: November 15, 2013, 11:59:16 pm »
Thanks for the quick response. Is there anyway to get the CURRENT selection within the Sprite editor window? I'm not seeing an easy way to access that. For instance, if i have 200 sprites, and i want to name 20 of them x/# i currently have no way to get to that selection set (that i can tell). I can definitely rename within the collection easily enough, just need to get that list.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Batch Rename sprites in collection
« Reply #3 on: November 16, 2013, 11:28:00 am »
How exactly are you going to rename this after selecting a bunch? What kind of logic would you use? I've never implemented it because I can't think of a foolproof way to do this which won't be completely useless.

dogbot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Batch Rename sprites in collection
« Reply #4 on: November 16, 2013, 02:08:21 pm »
Lemme rephrase what i'm trying to do.. it will make a little more sense.

Basically we have a character with 8 animations. each animation has 8 rotations per animation (so 8 x 5 frames). We render that out as a tilemap from our 3D app so that its a little easier to deal with. We then bring that in as a sprite sheet to the collection, which is also super clear because it categorizes them into a group. The problem comes in at the animation creation time. Its not that it doesn't work or anything, its just a little time consuming currently since we are keeping everything in single sets of images. So what i was doing, by hand, was going into the collection and for each direction renaming that portion of animation to say attack_45/1, attack_45/2, etc. This then allows me to go into the animation editor and autofill the animations for each direction vs. manually adding each one from a rather long (or potentially long) list.

So what I was hoping for was to be able to select x number of sprites, rename them as i listed above so that the still follow the convention you've set out (which btw works really well) and allows us to create groups of anims for easier animation setup.

I'm hoping that makes more sense. We've also rendered out all the frames individually and brought those in which also works but it creates an unwieldily sprite list vs. the sprite sheets which group them into subitems.

Alternatively if there's a way to say i want this range of sprites in this animation then that would be even simpler. But there's no way that i've found to group select sprites in the sprite selector when creating animations (like you can in the sprite sheet editor). Maybe i'm just missing something in our setup? Its likely. :)

Appreciate the help! Look forward to hearing your feedback.

Cheers