public ImportedAnimationSheet ImportSpritesAndAnimationSheet(string assetPath, string additionalCommandLineArguments = null) { if (assetPath == null) { return(null); } if (sharedData == null) { LoadUserConfig(); } string fileName = Path.GetFileName(assetPath); string assetName = Path.GetFileNameWithoutExtension(fileName); string basePath = GetBasePath(assetPath); // we analyze import settings on existing files PreviousImportSettings previousAnimationInfo = CollectPreviousImportSettings(basePath, assetName); if (AsepriteImporter.CreateSpriteAtlasAndMetaFile(_asepritePath, additionalCommandLineArguments, basePath, fileName, assetName, _sharedData.saveSpritesToSubfolder)) { AssetDatabase.Refresh(); return(ImportJSONAndCreateSprites(basePath, assetName, previousAnimationInfo)); } return(null); }
public ImportedAnimationInfo CreateAnimationsForAssetFile(string assetPath) { if (!IsValidAsset(assetPath)) { return(null); } string fileName = Path.GetFileName(assetPath); string assetName = Path.GetFileNameWithoutExtension(fileName); string basePath = GetBasePath(assetPath); // we analyze import settings on existing files PreviousImportSettings previousAnimationInfo = CollectPreviousImportSettings(basePath, assetName); if (AsepriteImporter.CreateSpriteAtlasAndMetaFile(_asepritePath, basePath, fileName, assetName, _sharedData.saveSpritesToSubfolder)) { AssetDatabase.Refresh(); return(ImportJSONAndCreateAnimations(basePath, assetName, previousAnimationInfo)); } return(null); }
private ImportedAnimationInfo CreateAnimationsForAssetFile(DefaultAsset droppedAsset) { string path = AssetDatabase.GetAssetPath(droppedAsset); string name = Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(droppedAsset)); string lastPart = "/" + name + ".ase"; // check if this is an ASE file (HACK!) if (!path.Contains(lastPart)) { return(null); } path = path.Replace(lastPart, ""); if (AsepriteImporter.CreateSpriteAtlasAndMetaFile(_asepritePath, path, name, _saveSpritesToSubfolder)) { AssetDatabase.Refresh(); return(ImportJSONAndCreateAnimations(path, name)); } return(null); }