void OnAddNewRecorder(RecorderInfo info) { var recorder = RecordersInventory.CreateDefaultRecorderSettings(info.settingsType); AddLastAndSelect(recorder, ObjectNames.NicifyVariableName(info.displayName), true); UIElementHelper.SetDirty(m_RecorderSettingPanel); }
void SaveAndRepaint() { if (m_ControllerSettings != null) { m_ControllerSettings.Save(); } if (m_SelectedRecorderItem != null) { UIElementHelper.SetDirty(m_RecorderSettingPanel); } Repaint(); }
void OnRecordSelectionChanged() { m_SelectedRecorderItem = m_RecordingListItem.selection; foreach (var r in m_RecordingListItem.items) { r.SetItemSelected(m_SelectedRecorderItem == r); } if (m_SelectedRecorderItem != null) { UIElementHelper.SetDirty(m_RecorderSettingPanel); } Repaint(); }
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"); } }
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"); } }