/// <summary> /// Ends the recording session. /// </summary> public void EndRecording() { if (!m_recording) { return; } m_iidToRemove = null; m_newNodes = null; m_nodes = null; m_root = null; m_ctx.Destroy(); // flush archive m_recording = false; Debug.Log("AlembicRecorder: end: " + m_settings.OutputPath); }
/// <summary> /// Starts a recording session. /// </summary> /// <returns>True if succeeded, false otherwise.</returns> public bool BeginRecording() { if (m_recording) { Debug.LogWarning("AlembicRecorder: already recording"); return(false); } if (m_settings.Scope == ExportScope.TargetBranch && TargetBranch == null) { Debug.LogWarning("AlembicRecorder: target object is not set"); return(false); } { var dir = Path.GetDirectoryName(m_settings.OutputPath); if (!Directory.Exists(dir)) { try { Directory.CreateDirectory(dir); } catch (Exception) { Debug.LogWarning("AlembicRecorder: Failed to create directory " + dir); return(false); } } } // create context and open archive m_ctx = aeContext.Create(); if (m_ctx.self == IntPtr.Zero) { Debug.LogWarning("AlembicRecorder: failed to create context"); return(false); } m_ctx.SetConfig(m_settings.ExportOptions); if (!m_ctx.OpenArchive(m_settings.OutputPath)) { Debug.LogWarning("AlembicRecorder: failed to open file " + m_settings.OutputPath); m_ctx.Destroy(); return(false); } m_root = new RootCapturer(this, m_ctx.topObject); m_nodes = new Dictionary <int, CaptureNode>(); m_newNodes = new List <CaptureNode>(); m_iidToRemove = new List <int>(); m_lastTimeSamplingIndex = 1; m_startFrameOfLastTimeSampling = 0; // create capturers SetupCapturerTable(); m_recording = true; m_time = m_timePrev = 0.0f; m_frameCount = 0; if (m_settings.ExportOptions.TimeSamplingType == TimeSamplingType.Uniform && m_settings.FixDeltaTime) { Time.maximumDeltaTime = (1.0f / m_settings.ExportOptions.FrameRate); } Debug.Log("AlembicRecorder: start " + m_settings.OutputPath); return(true); }