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

        // create context and open archive
        m_ctx = AbcAPI.aeCreateContext(ref m_conf);
        if (m_ctx.ptr == IntPtr.Zero)
        {
            Debug.LogWarning("aeCreateContext() failed");
            return(false);
        }
        if (!AbcAPI.aeOpenArchive(m_ctx, m_outputPath))
        {
            Debug.LogWarning("aeOpenArchive() failed");
            AbcAPI.aeDestroyContext(m_ctx);
            m_ctx = new AbcAPI.aeContext();
            return(false);
        }

        // create capturers
        if (m_preserveTreeStructure)
        {
            CreateCapturers_Tree();
        }
        else
        {
            CreateCapturers_Flat();
        }

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

        if (m_conf.timeSamplingType == AbcAPI.aeTypeSamplingType.Uniform)
        {
            Time.maximumDeltaTime = (1.0f / m_conf.frameRate);
        }

        Debug.Log("AlembicExporter: start " + m_outputPath);
        return(true);
    }