//---------------------------------------------------------------------------------------------------------------------- void DrawPreviewImage(ref PreviewDrawInfo drawInfo, TimelineClip clip, StreamingImageSequencePlayableAsset sisAsset) { int imageIndex = sisAsset.LocalTimeToImageIndex(clip, drawInfo.LocalTime); IList <string> imageFileNames = sisAsset.GetImageFileNames(); //Load string imagePath = sisAsset.GetImageFilePath(imageIndex); ImageLoader.GetImageDataInto(imagePath, StreamingImageSequenceConstants.IMAGE_TYPE_PREVIEW , out ImageData readResult); switch (readResult.ReadStatus) { case StreamingImageSequenceConstants.READ_STATUS_LOADING: break; case StreamingImageSequenceConstants.READ_STATUS_SUCCESS: { Texture2D tex = PreviewTextureFactory.GetOrCreate(imagePath, ref readResult); if (null != tex) { Graphics.DrawTexture(drawInfo.DrawRect, tex); } break; } default: { ImageLoader.RequestLoadPreviewImage(imagePath, (int)drawInfo.DrawRect.width, (int)drawInfo.DrawRect.height); break; } } }
//---------------------------------------------------------------------------------------------------------------------- void DrawPreviewImage(ref PreviewDrawInfo drawInfo, TimelineClip clip, RenderCachePlayableAsset renderCachePlayableAsset) { double normalizedLocalTime = drawInfo.LocalTime / clip.duration; IList <string> imageFileNames = renderCachePlayableAsset.GetImageFileNames(); Assert.IsNotNull(imageFileNames); int count = imageFileNames.Count; Assert.IsTrue(imageFileNames.Count > 0); int index = Mathf.RoundToInt(count * (float)normalizedLocalTime); index = Mathf.Clamp(index, 0, count - 1); //Load string imagePath = renderCachePlayableAsset.GetImageFilePath(index); if (!File.Exists(imagePath)) { return; } ImageLoader.GetImageDataInto(imagePath, StreamingImageSequenceConstants.IMAGE_TYPE_PREVIEW , out ImageData imageData); switch (imageData.ReadStatus) { case StreamingImageSequenceConstants.READ_STATUS_LOADING: break; case StreamingImageSequenceConstants.READ_STATUS_SUCCESS: { Texture2D tex = PreviewTextureFactory.GetOrCreate(imagePath, ref imageData); if (null != tex) { Graphics.DrawTexture(drawInfo.DrawRect, tex); } break; } default: { ImageLoader.RequestLoadPreviewImage(imagePath, (int)drawInfo.DrawRect.width, (int)drawInfo.DrawRect.height); break; } } }