void OnGUI()

in Assets/DefaultPlayables/Editor/TimelinePlayableWizard.cs [572:791]


    void OnGUI ()
    {
        if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
            Init ();

        if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
        {
            EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
            return;
        }

        m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);

        bool oldShowHelpBoxes = showHelpBoxes;
        showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
        if (oldShowHelpBoxes != showHelpBoxes)
        {
            EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
            EditorGUILayout.Space ();
        }

        if (showHelpBoxes)
        {
            EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
                               + "It will create 4 scripts that you can then edit to complete their functionality. "
                               + "The purpose is to setup the boilerplate code for you.  If you are already familiar "
                               + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
            EditorGUILayout.Space();
        }

        EditorGUILayout.Space ();
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical (GUI.skin.box);
        if (showHelpBoxes)
        {
            EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
            EditorGUILayout.Space();
        }
        playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);

        bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
        bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
        if (!playableNameNotEmpty || !playableNameFormatted)
        {
            EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
        }
        bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
        if (playableNameTooLong)
        {
            EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
        }
        EditorGUILayout.EndVertical ();

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        if(showHelpBoxes)
        {
            EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
            EditorGUILayout.Space();
        }
        bool oldStandardBlendPlayable = isStandardBlendPlayable;
        isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
        EditorGUILayout.EndVertical ();

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        EditorGUILayout.BeginVertical(GUI.skin.box);
        if(showHelpBoxes)
        {
            EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
            EditorGUILayout.Space();
        }
        int oldIndex = -1;
        if (isStandardBlendPlayable)
        {
            oldIndex = m_ComponentBindingTypeIndex;

            m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
            trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];

            EditorGUILayout.Space ();

            defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
        }
        else
        {
            m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
            trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
        }
        EditorGUILayout.EndVertical ();
        
        bool exposedVariablesNamesValid = true;
        bool scriptVariablesNamesValid = true;
        bool allUniqueVariableNames = true;
        
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        if (isStandardBlendPlayable)
        {
            StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
        }
        else
        {
            exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            allUniqueVariableNames = AllVariablesUniquelyNamed();
            if (!allUniqueVariableNames)
            {
                EditorGUILayout.HelpBox("Your variables to not have unique names.  Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            ClipCapsGUI();
        }

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        /*ClipDefaultsGUI ();

        EditorGUILayout.Space ();
        EditorGUILayout.Space ();*/

        EditorGUILayout.BeginVertical(GUI.skin.box);
        if (showHelpBoxes)
        {
            EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
            EditorGUILayout.Space();
        }
        trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
        EditorGUILayout.EndVertical ();

        if (!isStandardBlendPlayable)
        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(GUI.skin.box);
            if (showHelpBoxes)
            {
                EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
                EditorGUILayout.Space();
            }
            m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
            EditorGUILayout.EndVertical ();
        }

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        
        if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
        {
            if (GUILayout.Button("Create", GUILayout.Width(60f)))
            {
                m_CreateButtonPressed = true;

                for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
                {
                    standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
                }

                m_CreationError = CreateScripts();

                if (m_CreationError == CreationError.NoError)
                {
                    Close ();
                }
            }
        }

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        
        if (m_CreateButtonPressed)
        {
            switch (m_CreationError)
            {
                case CreationError.NoError:
                    EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
                    break;
                case CreationError.PlayableAssetAlreadyExists:
                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
                    break;
                case CreationError.PlayableBehaviourAlreadyExists:
                    EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
                    break;
                case CreationError.PlayableBehaviourMixerAlreadyExists:
                    EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
                    break;
                case CreationError.TrackAssetAlreadyExists:
                    EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
                    break;
                case CreationError.PlayableDrawerAlreadyExists:
                    EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
                    break;
            }
        }

        if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
        {
            ResetWindow ();
        }

        EditorGUILayout.EndScrollView ();
    }