//--------------------------------------------------------------------------------------------------------------------- //Path can point to a file or a folder. //If it points to a file, then the folder will be automatically detected private static void FindFolderAndImages(string path, out string folder, out List <string> imagePaths) { Assert.IsFalse(string.IsNullOrEmpty(path)); //Convert path to folder here folder = path; FileAttributes attr = File.GetAttributes(path); if (!attr.HasFlag(FileAttributes.Directory)) { folder = Path.GetDirectoryName(folder); } imagePaths = ImageFolderPlayableAsset.FindImageFileNames(folder); }
public IEnumerator ReloadPlayableAsset() { PlayableDirector director = EditorUtilityTest.NewSceneWithDirector(); TimelineClip clip = EditorUtilityTest.CreateTestTimelineClip(director); StreamingImageSequencePlayableAsset sisAsset = clip.asset as StreamingImageSequencePlayableAsset; Assert.IsNotNull(sisAsset); string folder = sisAsset.GetFolder(); Assert.IsNotNull(folder); int numOriginalImages = sisAsset.GetImageFileNames().Count; Assert.Greater(numOriginalImages, 0); List <string> testImages = ImageFolderPlayableAsset.FindImageFileNames(folder); List <string> copiedImagePaths = new List <string>(testImages.Count); foreach (string imageFileName in testImages) { string src = Path.Combine(folder, imageFileName); string dest = Path.Combine(folder, "Copied_" + imageFileName); File.Copy(src, dest); copiedImagePaths.Add(dest); } yield return(null); sisAsset.Reload(); yield return(null); Assert.AreEqual(numOriginalImages * 2, sisAsset.GetImageFileNames().Count); //Cleanup foreach (string imagePath in copiedImagePaths) { File.Delete(imagePath); } EditorUtilityTest.DestroyTestTimelineAssets(clip); yield return(null); }