示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }