public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        Plugin = playerData as Plugin4DS;

        if (onstart)
        {
            if (Plugin == null)
            {
                return;
            }

            double duration = playable.GetDuration() * Plugin.Framerate;
            double newSpeed = 1;

            if (firstFrame < lastFrame && firstFrame >= 0)
            {
                newSpeed = (lastFrame - firstFrame) / duration;
                //Debug.Log("new speed : " + newSpeed);
            }
            else
            {
                newSpeed = (Plugin.SequenceNbOfFrames - firstFrame) / duration;
                //Debug.Log("new speed : " + newSpeed);
            }

            Plugin.SpeedRatio = (float)newSpeed;
            Plugin.GotoFrame(firstFrame);
            Plugin.Play(true);

            onstart = false;
        }

        base.ProcessFrame(playable, info, playerData);
    }
Ejemplo n.º 2
0
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
        Plugin4DS plugin = go.GetComponent <Plugin4DS>();

        foreach (var clip in GetClips())
        {
            Playable4DS myAsset = clip.asset as Playable4DS;

            if (myAsset)
            {
                myAsset.clipstarttime = clip.start;
                myAsset.clipendtime   = clip.end;
                if (myAsset.sequence4DS.lastFrame == -1)
                {
                    myAsset.sequence4DS.firstFrame = plugin.FirstActiveFrame;
                    myAsset.sequence4DS.lastFrame  = plugin.LastActiveFrame;
                    //Debug.Log(clip.start + " ; " + clip.end);
                }
            }
        }

        return(base.CreateTrackMixer(graph, go, inputCount));
    }