public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
        var scriptPlayable = ScriptPlayable <TimeMachineMixerBehaviour> .Create(graph, inputCount);

        TimeMachineMixerBehaviour b = scriptPlayable.GetBehaviour();

        b.markerClips = new System.Collections.Generic.Dictionary <string, double>();

        var events = (graph.GetResolver() as PlayableDirector)?.GetComponent <TimelineControllerEvents>();


        foreach (var c in GetClips())
        {
            TimeMachineClip clip = (TimeMachineClip)c.asset;

            clip.clip = c;

            clip.events = events;

            if (!b.markerClips.ContainsKey(c.displayName))
            {
                b.markerClips.Add(c.displayName, (double)c.start);
            }
        }

        return(scriptPlayable);
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        clip = target as TimeMachineClip;

        GetAction(clip.Start, "Start");

        //EditorGUILayout.Space();

        GetAction(clip.End, "End");
    }
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
        var scriptPlayable = ScriptPlayable <TimeMachineMixerBehaviour> .Create(graph, inputCount);

        TimeMachineMixerBehaviour b = scriptPlayable.GetBehaviour();

        b.markerClips = new System.Collections.Generic.Dictionary <string, double>();


        foreach (var c in GetClips())
        {
            TimeMachineClip clip     = (TimeMachineClip)c.asset;
            string          clipName = c.displayName;

            switch (clip.action)
            {
            case TimeMachineBehaviour.TimeMachineAction.Pause:
                clipName = "||";
                break;

            case TimeMachineBehaviour.TimeMachineAction.Marker:
                clipName = "● " + clip.markerLabel.ToString();

                //Insert the marker clip into the Dictionary of markers
                if (!b.markerClips.ContainsKey(clip.markerLabel))                        //happens when you duplicate a clip and it has the same markerLabel
                {
                    b.markerClips.Add(clip.markerLabel, (double)c.start);
                }
                break;

            case TimeMachineBehaviour.TimeMachineAction.JumpToMarker:
                clipName = "↩︎  " + clip.markerToJumpTo.ToString();
                break;

            case TimeMachineBehaviour.TimeMachineAction.JumpToTime:
                clipName = "↩ " + clip.timeToJumpTo.ToString();
                break;
            }

            c.displayName = clipName;


            if (clip.action == TimeMachineBehaviour.TimeMachineAction.Marker)
            {
                if (!b.markerClips.ContainsKey(clip.markerLabel))                //happens when you duplicate a clip and it has the same markerLabel
                {
                    b.markerClips.Add(clip.markerLabel, (double)c.start);
                }
            }
        }

        return(scriptPlayable);
    }
Esempio n. 4
0
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
        var scriptPlayable = ScriptPlayable <TimeMachineMixerBehaviour> .Create(graph, inputCount);

        TimeMachineMixerBehaviour b = scriptPlayable.GetBehaviour();

        b.markerClips = new System.Collections.Generic.Dictionary <string, double>();


        //This foreach will rename clips based on what they do, and collect the markers and put them into a dictionary
        //Since this happens when you enter Preview or Play mode, the object holding the Timeline must be enabled or you won't see any change in names
        foreach (var c in GetClips())
        {
            TimeMachineClip clip     = (TimeMachineClip)c.asset;
            string          clipName = c.displayName;

            switch (clip.action)
            {
            /*
             *              case TimeMachineBehaviour.TimeMachineAction.Pause:
             *                      clipName = "||";
             *                      break;
             */

            case TimeMachineBehaviour.TimeMachineAction.Marker:
                clipName = "● " + clip.markerLabel.ToString();

                //Insert the marker clip into the Dictionary of markers
                if (!b.markerClips.ContainsKey(clip.markerLabel))                        //happens when you duplicate a clip and it has the same markerLabel
                {
                    b.markerClips.Add(clip.markerLabel, (double)c.start);
                }
                break;

            case TimeMachineBehaviour.TimeMachineAction.JumpToMarker:
                clipName = "↩︎  " + clip.markerToJumpTo.ToString();
                break;

            case TimeMachineBehaviour.TimeMachineAction.JumpToTime:
                clipName = "↩ " + clip.timeToJumpTo.ToString();
                break;
            }

            c.displayName = clipName;
        }

        return(scriptPlayable);
    }