talecrafter / AnimationImporter

Aseprite Animation Importer for Unity
613 stars 72 forks source link

Config as scriptableobject #12

Closed edwardrowe closed 8 years ago

edwardrowe commented 8 years ago

This should fully address issue #5. It uses a ScriptableObject to store most of the old config values, with the exception of AsepritePath (which is user specific) and AnimationController for OverrideController mode (which is more of just a convenience that it remembers the last used Controller, so again, user specific). The ScriptableObject is an asset that's in the repository, so it can be shared between users and moved between projects.

This change moves most of the properties on AnimationImporter into the ScriptableObject, called SharedConfig (or SharedData). When AnimationImporter Loads its config, it will try to automatically create the ScriptableObject if not found. I allowed most things to just reach in and check the config - I'm sure this could be made a bit safer, but it was the easiest fix for now. Note though that during AssetPostprocessing it will not create the saved config if it doesn't exist, or else it tries to create a new config when importing an existing config.

It uses a few new utility libraries that we use at Red Blue - ScriptableObjectUtility for creating the SharedConfig file, and AssetDatabaseUtility for quickly creating all directories along the path to the SharedConfig.

I also included some ability to upgrade to this version through a button that copies Preferences into the SharedConfig file. It doesn't delete the preferences, so that you can always recover them. This is almost entirely just for you @talecrafter, since I figure you've probably added a lot of nonLoopingClips and don't want to reenter them. It could be deleted once we are all upgraded.