Class UnitFrames
- Namespace
- TDMaker.Editor
- Assembly
- TDMaker.Editor.dll
Bulk frame registration for the Unit Workshop: sorts sprite files into walk / idle / attack / hurt / death sequences by file name ("Orc_Walk_003", "walk (2)", "1_ATTACK_005", "goblinRun07", "Hit1"), fixes their texture import settings (single sprite, pivot at the feet, compressed) and writes the sequences into an ArtSet.Entry. Facing is never guessed; the author ticks Faces Left.
public static class UnitFrames
- Inheritance
-
UnitFrames
- Inherited Members
Methods
Classify(string)
Guesses the action and frame number of a sprite file name.
public static UnitFrames.Classified Classify(string fileName)
Parameters
fileNamestring
Returns
CollectTexturePaths(IEnumerable<string>)
Texture files (png, psd, tga, jpg) under the dropped paths, folders searched recursively, in name order.
public static List<string> CollectTexturePaths(IEnumerable<string> assetPaths)
Parameters
assetPathsIEnumerable<string>
Returns
ConfigureImporter(string)
Sets sprite import settings for unit frames: Sprite (single unless the file is already sliced), pivot at the bottom centre (the feet), no mip maps, alpha is transparency, normal-quality compression. Returns true when it changed anything.
public static bool ConfigureImporter(string texturePath)
Parameters
texturePathstring
Returns
LoadSprites(IList<string>)
First sprite of each texture (sliced textures add every sub-sprite in name order).
public static List<KeyValuePair<string, Sprite>> LoadSprites(IList<string> texturePaths)
Parameters
Returns
- List<KeyValuePair<string, Sprite>>
Register(ArtSet, Entry, IEnumerable<string>, bool)
Registers dropped files or folders into entry of set (with Undo): sequences that
were found replace the entry's arrays, the idle sprite is the first idle (or walk) frame when the entry has none.
public static UnitFrames.Report Register(ArtSet set, ArtSet.Entry entry, IEnumerable<string> droppedPaths, bool fixImport = true)
Parameters
Returns
Sort<T>(IList<KeyValuePair<string, T>>, List<T>)
Groups named items into sequences: each action keeps its lowest variant, frames are ordered by frame number then name.
Items without an action word are returned in unsorted.
public static Dictionary<FrameAction, List<T>> Sort<T>(IList<KeyValuePair<string, T>> items, List<T> unsorted = null)
Parameters
itemsIList<KeyValuePair<string, T>>unsortedList<T>
Returns
- Dictionary<FrameAction, List<T>>
Type Parameters
T
Tokens(string)
Splits a file name into lower-case word and number tokens (camelCase, separators and digits split).
public static List<string> Tokens(string fileName)
Parameters
fileNamestring