public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <RecorderPlayableBehaviour> .Create(graph); var behaviour = playable.GetBehaviour(); if (recorderType != null && UnityHelpers.IsPlaying()) { behaviour.session = new RecordingSession() { m_Recorder = RecordersInventory.GenerateNewRecorder(recorderType, m_Settings), m_RecorderGO = SceneHook.HookupRecorder(), }; behaviour.OnEnd = () => { try { if (OnClipDone != null) { OnClipDone(this); } } catch (Exception ex) { Debug.Log("OnClipDone call back generated an exception: " + ex.Message); Debug.LogException(ex); } }; } return(playable); }
internal void ClearExposedReference() { if (string.IsNullOrEmpty(m_BindingId)) { return; } var rb = SceneHook.GetRecorderBindings(); if (rb != null) { rb.RemoveBinding(m_BindingId); } }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <RecorderPlayableBehaviour> .Create(graph); var behaviour = playable.GetBehaviour(); if (recorderType != null && UnityHelpers.IsPlaying()) { behaviour.session = new RecordingSession() { m_Recorder = RecordersInventory.GenerateNewRecorder(recorderType, m_Settings), m_RecorderGO = SceneHook.HookupRecorder(), }; } return(playable); }
internal void DuplicateExposedReference() { if (string.IsNullOrEmpty(m_BindingId)) { return; } var src = m_BindingId; var dst = GenerateBindingId(); m_BindingId = dst; var rb = SceneHook.GetRecorderBindings(); if (rb != null) { rb.DuplicateBinding(src, dst); } }
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(); }