Hello Guest

Author Topic: Grouping Sprite Collections within the dropdown list  (Read 3061 times)

pixeltrap

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Pixel Trap
Grouping Sprite Collections within the dropdown list
« on: January 13, 2014, 04:14:26 pm »
Hello, there.

I'm working on project which has different sprite collections for each game chapter. Having all of them in one dropdown list is a bit annoying and we resorted to adding prefixes for sorting.
Is there any way to group them in folders within the dropdown list?

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Grouping Sprite Collections within the dropdown list
« Reply #1 on: January 14, 2014, 10:51:12 am »
In tk2dSpriteGuiUtility.cs,
BuildLookupIndex

change these lines (312 or so)
Code: [Select]
for (int i = 0; i < allSpriteCollections.Count; ++i)
{
allSpriteCollectionLookup[allSpriteCollections[i].spriteCollectionDataGUID] = i;
spriteCollectionNames[i] = allSpriteCollections[i].name;
spriteCollectionNamesInclTransient[i] = allSpriteCollections[i].name;
}

to

Code: [Select]
for (int i = 0; i < allSpriteCollections.Count; ++i)
{
allSpriteCollectionLookup[allSpriteCollections[i].spriteCollectionDataGUID] = i;
string name = allSpriteCollections[i].name.Replace("__", "/");
spriteCollectionNames[i] = name;
spriteCollectionNamesInclTransient[i] = name;
}

Feel free to replace __ with a separator of your choice. If you're already using a single underscore for the prefix, then use that and it should put those into folders.