void OnRecorderSelected(Type selectedRecorder) { var clip = (RecorderClip)target; if (m_Editor != null) { UnityHelpers.Destroy(m_Editor); m_Editor = null; } if (selectedRecorder == null) { return; } if (clip.settings != null && RecordersInventory.GetRecorderInfo(selectedRecorder).settingsType != clip.settings.GetType()) { Undo.DestroyObjectImmediate(clip.settings); clip.settings = null; } if (clip.settings == null) { clip.settings = RecordersInventory.CreateDefaultRecorderSettings(selectedRecorder); Undo.RegisterCreatedObjectUndo(clip.settings, "Recorder Create Settings"); AssetDatabase.AddObjectToAsset(clip.settings, clip); } m_Editor = (RecorderEditor)CreateEditor(clip.settings); }
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); } }
public void OnRecorderSelected() { if (m_Editor != null) { UnityHelpers.Destroy(m_Editor); m_Editor = null; } if (m_recorderSelector.selectedRecorder == null) { return; } if (m_WindowSettingsAsset.m_Settings != null && RecordersInventory.GetRecorderInfo(m_recorderSelector.selectedRecorder).settings != m_WindowSettingsAsset.m_Settings.GetType()) { UnityHelpers.Destroy(m_WindowSettingsAsset.m_Settings, true); m_WindowSettingsAsset.m_Settings = null; } if (m_WindowSettingsAsset.m_Settings == null) { m_WindowSettingsAsset.m_Settings = RecordersInventory.GenerateNewSettingsAsset(m_WindowSettingsAsset, m_recorderSelector.selectedRecorder); } m_Editor = Editor.CreateEditor(m_WindowSettingsAsset.m_Settings) as RecorderEditor; AssetDatabase.Refresh(); }
public void OnRecorderSelected() { var clip = this.target as RecorderClip; if (m_Editor != null) { UnityHelpers.Destroy(m_Editor); m_Editor = null; } if (m_recorderSelector.selectedRecorder == null) { return; } if (clip.m_Settings != null && RecordersInventory.GetRecorderInfo(m_recorderSelector.selectedRecorder).settings != clip.m_Settings.GetType()) { UnityHelpers.Destroy(clip.m_Settings, true); clip.m_Settings = null; } if (clip.m_Settings == null) { clip.m_Settings = RecordersInventory.GenerateNewSettingsAsset(clip, m_recorderSelector.selectedRecorder); } m_Editor = Editor.CreateEditor(clip.m_Settings) as RecorderEditor; AssetDatabase.Refresh(); }
void OnRecorderSelected(Type selectedRecorder) { var clip = (RecorderClip)target; if (m_Editor != null) { UnityHelpers.Destroy(m_Editor); m_Editor = null; } if (selectedRecorder == null) { return; } if (clip.settings != null && RecordersInventory.GetRecorderInfo(selectedRecorder).settingsType != clip.settings.GetType()) { UnityHelpers.Destroy(clip.settings, true); clip.settings = null; } if (clip.settings == null) { clip.settings = RecordersInventory.CreateDefaultRecorderSettings(selectedRecorder); AssetDatabase.AddObjectToAsset(clip.settings, clip); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } m_Editor = (RecorderEditor)CreateEditorWithContext(new UnityObject[] { clip.settings }, SceneHook.GetRecorderBindings()); AssetDatabase.Refresh(); }