void OnRecorderSettingsGUI()
        {
            PrepareGUIState(m_RecorderSettingPanel.layout.width);

            if (m_SelectedRecorderItem != null)
            {
                if (m_SelectedRecorderItem.state == RecorderItem.State.HasErrors)
                {
                    EditorGUILayout.LabelField("Missing reference to the recorder.");
                }
                else
                {
                    var editor = m_SelectedRecorderItem.editor;

                    if (editor == null)
                    {
                        EditorGUILayout.LabelField("Error while displaying the recorder inspector");
                    }
                    else
                    {
                        EditorGUILayout.LabelField("Recorder Type",
                                                   ObjectNames.NicifyVariableName(editor.target.GetType().Name));

                        if (!(editor is RecorderEditor))
                        {
                            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
                        }

                        EditorGUI.BeginChangeCheck();

                        editor.OnInspectorGUI();

                        if (EditorGUI.EndChangeCheck())
                        {
                            m_ControllerSettings.Save();
                            m_SelectedRecorderItem.UpdateState();
                            UIElementHelper.SetDirty(m_RecorderSettingPanel);
                        }
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("No recorder selected");
            }
        }
Ejemplo n.º 2
0
        void OnRecorderSettingsGUI()
        {
            PrepareGUIState(m_RecorderSettingPanel.layout.width);

            if (m_SelectedRecorderItem != null)
            {
                if (m_SelectedRecorderItem.state == RecorderItem.State.HasErrors)
                {
                    EditorGUILayout.LabelField("Missing reference to the recorder.");
                }
                else
                {
                    var editor = m_SelectedRecorderItem.editor;

                    if (editor == null)
                    {
                        EditorGUILayout.LabelField("Error while displaying the recorder inspector");
                    }
                    else
                    {
                        EditorGUIUtility.labelWidth = Mathf.Min(Mathf.Max(m_RecorderSettingPanel.layout.width * 0.45f - 40, 110), 140);
                        EditorGUILayout.Separator();

                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField("Recorder Type",
                                                   ObjectNames.NicifyVariableName(editor.target.GetType().Name));

                        if (!(editor is RecorderEditor))
                        {
                            EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider);
                        }

                        // Open Manual
                        if (GUILayout.Button(GetIconAndTooltip("_Help", "Open Reference for Recorder"), PresetHelper.presetButtonStyle))
                        {
                            Application.OpenURL(Styles.GetLinkToManual(s_PackageShortVersionNumber));
                        }

                        if (GUILayout.Button(PresetHelper.presetIcon, PresetHelper.presetButtonStyle))
                        {
                            var settings = editor.target as RecorderSettings;

                            if (settings != null)
                            {
                                var presetReceiver = CreateInstance <PresetHelper.PresetReceiver>();
                                presetReceiver.Init(settings, Repaint);

                                PresetSelector.ShowSelector(settings, null, true, presetReceiver);
                            }
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Separator();

                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.Separator();

                        editor.OnInspectorGUI();

                        if (EditorGUI.EndChangeCheck())
                        {
                            m_ControllerSettings.Save();
                            m_SelectedRecorderItem.UpdateState();
                            UIElementHelper.SetDirty(m_RecorderSettingPanel);
                        }
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("No recorder selected");
            }
        }