2D Toolkit Forum

2D Toolkit => Support => Topic started by: pixeltrap on January 13, 2014, 04:14:26 pm

Title: Grouping Sprite Collections within the dropdown list
Post by: pixeltrap 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!
Title: Re: Grouping Sprite Collections within the dropdown list
Post by: unikronsoftware 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.