// ================================================================================ // private methods // -------------------------------------------------------------------------------- // parses a JSON file and creates the raw data for ImportedAnimationSheet from it private static ImportedAnimationSheet CreateAnimationSheetFromMetaData(AnimationImportJob job, AnimationImporterSharedConfig config) { string textAssetFilename = job.directoryPathForSprites + "/" + job.name + ".json"; TextAsset textAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(textAssetFilename); if (textAsset != null) { JSONObject jsonObject = JSONObject.Parse(textAsset.ToString()); ImportedAnimationSheet animationSheet = GetAnimationInfo(jsonObject); if (animationSheet == null) { return(null); } animationSheet.previousImportSettings = job.previousImportSettings; animationSheet.SetNonLoopingAnimations(config.animationNamesThatDoNotLoop); // delete JSON file afterwards AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(textAsset)); return(animationSheet); } else { Debug.LogWarning("Problem with JSON file: " + textAssetFilename); } return(null); }
// ================================================================================ // private methods // -------------------------------------------------------------------------------- // parses a JSON file and creates the raw data for ImportedAnimationSheet from it private static ImportedAnimationSheet CreateAnimationSheetFromMetaData(AnimationImportJob job, AnimationImporterSharedConfig config, Texture2D srcTex, JSONObject metadata) { job.SetProgress(0.2f, "getting animation sheet..."); if (metadata != null && srcTex != null) { ImportedAnimationSheet animationSheet = GetAnimationInfo(metadata); if (animationSheet == null) { return(null); } animationSheet.srcTex = srcTex; if (!animationSheet.hasAnimations) { Debug.LogWarning("No Animations found in Aseprite file. Use Aseprite Tags to assign names to Animations."); } animationSheet.SetNonLoopingAnimations(config.animationNamesThatDoNotLoop); return(animationSheet); } return(null); }