//----------------------------------------------------------------------------------------------------------------------
        protected override void DrawPreviewImageV(ref PreviewDrawInfo drawInfo, TimelineClip clip,
                                                  StreamingImageSequencePlayableAsset sisAsset)
        {
            int    imageIndex = sisAsset.LocalTimeToImageIndex(clip, drawInfo.LocalTime);
            string imagePath  = sisAsset.GetImageFilePath(imageIndex);

            PreviewUtility.DrawPreviewImage(ref drawInfo, imagePath);
        }
Exemplo n.º 2
0
//----------------------------------------------------------------------------------------------------------------------

        /// <inheritdoc/>
        public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region)
        {
            base.DrawBackground(clip, region);

            Rect rect = region.position;

            if (rect.width <= SISEditorConstants.MIN_PREVIEW_REGION_WIDTH)
            {
                return;
            }

            ImageFolderPlayableAsset <T> curAsset = clip.asset as ImageFolderPlayableAsset <T>;

            if (null == curAsset)
            {
                return;
            }

            DrawBackgroundTexture(rect, curAsset.GetTimelineBGColor());

            int numImages = curAsset.GetNumImages();

            if (numImages <= 0)
            {
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                PreviewClipInfo clipInfo = new PreviewClipInfo()
                {
                    Duration              = clip.duration,
                    TimeScale             = clip.timeScale,
                    ClipIn                = clip.clipIn,
                    FramePerSecond        = clip.GetParentTrack().timelineAsset.editorSettings.GetFPS(),
                    ImageDimensionRatio   = curAsset.GetOrUpdateDimensionRatio(),
                    VisibleLocalStartTime = region.startTime,
                    VisibleLocalEndTime   = region.endTime,
                    VisibleRect           = rect,
                };

                PreviewUtility.EnumeratePreviewImages(ref clipInfo, (PreviewDrawInfo drawInfo) => {
                    DrawPreviewImageV(ref drawInfo, clip, curAsset);
                });

                //For hiding frame marker automatically
                PlayableFrameClipData clipData = curAsset.GetBoundClipData();
                if (null != clipData)
                {
                    clipData.UpdateTimelineWidthPerFrame(rect.width, region.endTime - region.startTime,
                                                         clipInfo.FramePerSecond, clipInfo.TimeScale);
                }
            }
        }
Exemplo n.º 3
0
//----------------------------------------------------------------------------------------------------------------------
        protected override void DrawPreviewImageV(ref PreviewDrawInfo drawInfo, TimelineClip clip,
                                                  ImageFolderPlayableAsset <SISClipData> playableAsset)
        {
            StreamingImageSequencePlayableAsset sisAsset = playableAsset as StreamingImageSequencePlayableAsset;

            Assert.IsNotNull(sisAsset);

            int    imageIndex = sisAsset.LocalTimeToImageIndex(clip, drawInfo.LocalTime);
            string imagePath  = sisAsset.GetImageFilePath(imageIndex);

            PreviewUtility.DrawPreviewImage(ref drawInfo, imagePath);
        }
Exemplo n.º 4
0
//----------------------------------------------------------------------------------------------------------------------

        protected override void DrawPreviewImageV(ref PreviewDrawInfo drawInfo, TimelineClip clip,
                                                  RenderCachePlayableAsset renderCachePlayableAsset)
        {
            double normalizedLocalTime = drawInfo.LocalTime / clip.duration;
            int    numImages           = renderCachePlayableAsset.GetNumImages();

            Assert.IsTrue(numImages > 0);

            //Can't round up, because if the time for the next frame hasn't been reached, then we should stick
            int index = Mathf.FloorToInt(numImages * (float)normalizedLocalTime);

            index = Mathf.Clamp(index, 0, numImages - 1);

            //Draw
            string imagePath = renderCachePlayableAsset.GetImageFilePath(index);

            PreviewUtility.DrawPreviewImage(ref drawInfo, imagePath);
        }