void ShowSequenceSelector()
        {
            var allDirectors = TimelineUtility.GetDirectorsInSceneUsingAsset(null);

            var formatter         = new SequenceMenuNameFormater();
            var namesAndDirectors = new List <ValueTuple <string, PlayableDirector> >();

            foreach (var d in allDirectors)
            {
                if (d.playableAsset is TimelineAsset)
                {
                    var text = formatter.Format(DisplayNameHelper.GetDisplayName(d));
                    namesAndDirectors.Add(new ValueTuple <string, PlayableDirector>(text, d));
                }
            }

            var sequenceMenu = new GenericMenu();

            foreach (var(timelineName, playableDirector) in namesAndDirectors.OrderBy(i => i.Item1))
            {
                var isCurrent = state.masterSequence.director == playableDirector;
                sequenceMenu.AddItem(new GUIContent(timelineName), isCurrent, OnSequenceSelected, playableDirector);
            }

            if (allDirectors.Length == 0)
            {
                sequenceMenu.AddDisabledItem(DirectorStyles.noTimelinesInScene);
            }

            sequenceMenu.DropDown(EditorGUILayout.s_LastRect);
        }
        void ShowSequenceSelector()
        {
            var allDirectors = TimelineUtility.GetDirectorsInSceneUsingAsset(null);

            var formatter = new SequenceMenuNameFormater();
            var namesAndDirectors = new List<ValueTuple<string, PlayableDirector>>();
            foreach (var d in allDirectors)
            {
                if (d.playableAsset is TimelineAsset)
                {
                    var text = formatter.Format(DisplayNameHelper.GetDisplayName(d));
                    namesAndDirectors.Add(new ValueTuple<string, PlayableDirector>(text, d));
                }
            }

            var sequenceMenu = new GenericMenu();
            foreach (var (timelineName, playableDirector) in namesAndDirectors.OrderBy(i => i.Item1))
            {
                var isCurrent = state.masterSequence.director == playableDirector;
                sequenceMenu.AddItem(new GUIContent(time
        void DoSequenceSelectorGUI()
        {
            using (new EditorGUI.DisabledScope(currentMode.headerState.sequenceSelector == TimelineModeGUIState.Disabled))
            {
                if (GUILayout.Button(DirectorStyles.sequenceSelectorIcon, EditorStyles.toolbarPopup, GUILayout.Width(WindowConstants.selectorWidth)))
                {
                    var allDirectors = TimelineUtility.GetDirectorsInSceneUsingAsset(null);

                    GenericMenu sequenceMenu          = new GenericMenu();
                    SequenceMenuNameFormater formater = new SequenceMenuNameFormater();

                    foreach (var d in allDirectors)
                    {
                        if (d.playableAsset is TimelineAsset)
                        {
                            string text      = formater.Format(DisplayNameHelper.GetDisplayName(d));
                            bool   isCurrent = state.masterSequence.director == d;
                            sequenceMenu.AddItem(new GUIContent(text), isCurrent, arg =>
                            {
                                var directorToBindTo = (PlayableDirector)arg;
                                if (directorToBindTo)
                                {
                                    // don't just select the object, it may already be selected.
                                    SetCurrentTimeline(directorToBindTo);
                                }
                            }, d);
                        }
                    }

                    if (allDirectors.Length == 0)
                    {
                        sequenceMenu.AddDisabledItem(DirectorStyles.noTimelinesInScene);
                    }

                    sequenceMenu.ShowAsContext();
                }

                GUILayout.Space(10f);
            }
        }