Example #1
0
        public bool BeginCapture()
        {
            if (m_recording)
            {
                Debug.Log("AlembicExporter: already started");
                return(false);
            }

            {
                var dir = Path.GetDirectoryName(m_outputPath);
                if (!Directory.Exists(dir))
                {
                    try
                    {
                        Directory.CreateDirectory(dir);
                    }
                    catch (Exception)
                    {
                        Debug.LogWarning("Failed to create directory " + dir);
                        return(false);
                    }
                }
            }

            // create context and open archive
            m_ctx = aeContext.Create();
            if (m_ctx.self == IntPtr.Zero)
            {
                Debug.LogWarning("aeCreateContext() failed");
                return(false);
            }

            m_ctx.SetConfig(ref m_conf);
            if (!m_ctx.OpenArchive(m_outputPath))
            {
                Debug.LogWarning("aeOpenArchive() failed");
                m_ctx.Destroy();
                return(false);
            }

            // create capturers
            CreateCapturers();

            m_recording  = true;
            m_time       = m_conf.startTime;
            m_frameCount = 0;

            if (m_conf.timeSamplingType == aeTimeSamplingType.Uniform && m_fixDeltaTime)
            {
                Time.maximumDeltaTime = (1.0f / m_conf.frameRate);
            }

            Debug.Log("AlembicExporter: start " + m_outputPath);
            return(true);
        }
        public bool BeginRecording()
        {
            if (m_recording)
            {
                Debug.Log("AlembicRecorder: already recording");
                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(ref m_settings.conf);
            if (!m_ctx.OpenArchive(m_settings.outputPath))
            {
                Debug.LogWarning("AlembicRecorder: failed to open file " + m_settings.outputPath);
                m_ctx.Destroy();
                return(false);
            }

            // create capturers
            CreateCapturers();

            m_recording  = true;
            m_time       = m_settings.conf.startTime;
            m_frameCount = 0;

            Debug.Log("AlembicRecorder: start " + m_settings.outputPath);
            return(true);
        }
Example #3
0
        public void EndCapture()
        {
            if (!m_recording)
            {
                return;
            }

            m_capturers.Clear();
            m_ctx.Destroy(); // flush archive
            m_recording  = false;
            m_time       = 0.0f;
            m_frameCount = 0;

            Debug.Log("AlembicExporter: end: " + m_outputPath);
        }
        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(ref m_settings.conf);
            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.conf.timeSamplingType == aeTimeSamplingType.Uniform && m_settings.fixDeltaTime)
            {
                Time.maximumDeltaTime = (1.0f / m_settings.conf.frameRate);
            }

            Debug.Log("AlembicRecorder: start " + m_settings.outputPath);
            return(true);
        }
 public void Dispose()
 {
     m_ctx.Destroy();
 }