コード例 #1
0
//----------------------------------------------------------------------------------------------------------------------

        internal static float CalculateFPS(StreamingImageSequencePlayableAsset sisPlayableAsset)
        {
            double      clipTimeScale = 1;
            SISClipData sisClipData   = sisPlayableAsset.GetBoundClipData();

            if (null == sisClipData)
            {
                return(0);
            }

            if (null != sisClipData.GetOwner())
            {
                clipTimeScale = sisClipData.GetOwner().timeScale;
            }

            int   numImages = sisPlayableAsset.GetNumImages();
            float fps       = (float)(numImages * clipTimeScale / sisClipData.CalculateCurveDuration());

            return(fps);
        }
コード例 #2
0
        internal static void SetFPS(StreamingImageSequencePlayableAsset sisPlayableAsset, float newFPS)
        {
            SISClipData sisClipData = sisPlayableAsset.GetBoundClipData();

            Assert.IsNotNull(sisClipData);
            TimelineClip clip = sisClipData.GetOwner();

            Assert.IsNotNull(clip);

            int numImages = sisPlayableAsset.GetNumImages();

            if (numImages <= 0)
            {
                Debug.LogWarning("[SIS] There are no images in folder: " + sisPlayableAsset.GetFolder());
                return;
            }

            double prevTimeScale = clip.timeScale;
            float  clipTimeScale = (newFPS * sisClipData.CalculateCurveDuration() / numImages);

            clip.timeScale = clipTimeScale;
            clip.duration  = clip.duration * (prevTimeScale / clipTimeScale);
        }