Exemplo n.º 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);
        }
Exemplo n.º 3
0
 // relevant only if timeSamplingType is acyclic. if tsi==-1, add time to all time samplings.
 [DllImport("abci")] public static extern void        aeAddTime(aeContext ctx, float time, int tsi = -1);
Exemplo n.º 4
0
 [DllImport("abci")] public static extern int         aeAddTimeSampling(aeContext ctx, float start_time);
Exemplo n.º 5
0
 [DllImport("abci")] public static extern aeObject    aeGetTopObject(aeContext ctx);
Exemplo n.º 6
0
 [DllImport("abci")] public static extern Bool        aeOpenArchive(aeContext ctx, string path);
Exemplo n.º 7
0
 [DllImport("abci")] public static extern void        aeSetConfig(aeContext ctx, ref aeConfig conf);
Exemplo n.º 8
0
 [DllImport("abci")] public static extern void        aeDestroyContext(aeContext ctx);
        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);
        }