public void OnRecorderSelected() { if (m_Editor != null) { UnityHelpers.Destroy(m_Editor); m_Editor = null; } if (m_recorderSelector.selectedRecorder == null) { return; } m_Category = m_recorderSelector.category; if (m_WindowSettingsAsset.m_Settings != null && RecordersInventory.GetRecorderInfo(m_recorderSelector.selectedRecorder).settingsClass != m_WindowSettingsAsset.m_Settings.GetType()) { CleanupSettingsAsset(); } if (m_WindowSettingsAsset.m_Settings == null) { m_WindowSettingsAsset.m_Settings = RecordersInventory.GenerateRecorderInitialSettings(m_WindowSettingsAsset, m_recorderSelector.selectedRecorder); } m_Editor = Editor.CreateEditor(m_WindowSettingsAsset.m_Settings) as RecorderEditor; AssetDatabase.Refresh(); }
public void Init(RecorderSettings settings, string startingCategory = "") { // Pre existing settings obj? if (settings != null) { var recInfo = RecordersInventory.GetRecorderInfo(settings.recorderType); // category value overrides existing settings. if (!string.IsNullOrEmpty(startingCategory)) { if (string.Compare(recInfo.category, startingCategory, StringComparison.InvariantCultureIgnoreCase) != 0) { // forced another category, flush existing settings obj. SetCategory(startingCategory); SelectRecorder(GetRecorderFromIndex(0)); } } // Not invalidated by category, so set and we are done if (settings != null) { SetCategory(recInfo.category); SelectRecorder(settings.recorderType); return; } } else { SetCategory(startingCategory); } }
void StartRecording(bool autoExitPlayMode) { var settings = (RecorderSettings)m_Editor.target; var go = SceneHook.HookupRecorder(); var session = new RecordingSession() { m_Recorder = RecordersInventory.GenerateNewRecorder(m_recorderSelector.selectedRecorder, settings), m_RecorderGO = go, }; var component = go.AddComponent <RecorderComponent>(); component.session = session; component.autoExitPlayMode = autoExitPlayMode; if (session.SessionCreated() && session.BeginRecording()) { m_State = EState.Recording; } else { m_State = EState.Idle; StopRecording(); } }
void OnAddNewRecorder(RecorderInfo info) { var recorder = RecordersInventory.CreateDefaultRecorderSettings(info.settingsType); AddLastAndSelect(recorder, ObjectNames.NicifyVariableName(info.displayName), true); UIElementHelper.SetDirty(m_RecorderSettingPanel); }
public RecordingSession CreateRecorderSessionWithRecorderComponent(RecorderSettings settings) { var component = GetRecorderComponent(settings); var session = new RecordingSession { recorder = RecordersInventory.CreateDefaultRecorder(settings), recorderGameObject = component.gameObject, recorderComponent = component }; component.session = session; return(session); }
public RecordingSession CreateRecorderSession(RecorderSettings settings) { var sceneHook = GetSessionHook(); if (sceneHook == null) { return(null); } var session = new RecordingSession { recorder = RecordersInventory.CreateDefaultRecorder(settings), recorderGameObject = sceneHook }; return(session); }
RecorderItem CreateRecorderItem(RecorderSettings recorderSettings) { var info = RecordersInventory.GetRecorderInfo(recorderSettings.GetType()); var hasError = info == null; var recorderItem = new RecorderItem(m_ControllerSettings, recorderSettings, hasError ? null : info.iconName); recorderItem.OnEnableStateChanged += enabled => { if (enabled) { m_RecordingListItem.selection = recorderItem; } }; if (hasError) { recorderItem.state = RecorderItem.State.HasErrors; } return(recorderItem); }