//---------------------------------------------------------------------------------------------------------------------- internal static ImageSequenceImportWindow Show(ImageFileImporterParam param) { Rect rect = new Rect(160, 160, 0, 0); ImageSequenceImportWindow window = EditorWindow.GetWindow <ImageSequenceImportWindow>(); window.ShowAsDropDown(rect, new Vector2(640, 480)); window.m_importerParam = param; return(window); }
//---------------------------------------------------------------------------------------------------------------------- /// Import images in the path to create StreamingImageSequence assets with those images /// <param name="path"> Can be a directory path or a file path</param> /// <param name="targetAsset"> The target asset where the images are assigned to</param> /// <param name="askToCopy"> Ask to copy if path is not under StreamingAssets. Default to true</param> internal static void ImportImages(string path, StreamingImageSequencePlayableAsset targetAsset, bool askToCopy = true) { Assert.IsFalse(string.IsNullOrEmpty(path)); FindFolderAndImages(path, out string folder, out List <string> relFilePaths); if (relFilePaths.Count <= 0) { EditorUtility.DisplayDialog(StreamingImageSequenceConstants.DIALOG_HEADER, @"No files in folder:: " + folder, "OK"); return; } //Estimate the asset name. Use the filename without numbers at the end string assetName = EstimateAssetName(relFilePaths[0]); // set dest folder string streamingAssetsPath = AssetEditorUtility.NormalizeAssetPath(Application.streamingAssetsPath); //Set importer param ImageFileImporterParam importerParam = new ImageFileImporterParam { strSrcFolder = folder, RelativeFilePaths = relFilePaths, CopyToStreamingAssets = true, TargetAsset = targetAsset }; //Import immediately if the assets are already under StreamingAssets if (folder.StartsWith(streamingAssetsPath) || !askToCopy) { importerParam.strDstFolder = importerParam.strSrcFolder; importerParam.CopyToStreamingAssets = false; ImageSequenceImporter.Import(importerParam); } else { importerParam.strDstFolder = Path.Combine(streamingAssetsPath, assetName).Replace("\\", "/"); ImageSequenceImportWindow.Show(importerParam); } }