Example #1
0
 [DllImport("AlembicExporter")] public static extern void        aeAddTime(aeContext ctx, float time, int tsi = 1); // relevant only if timeSamplingType is acyclic
        /// <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);
        }
Example #3
0
 [DllImport("AlembicExporter")] public static extern aeObject    aeGetTopObject(aeContext ctx);
Example #4
0
 [DllImport("AlembicExporter")] public static extern int         aeAddTimeSampling(aeContext ctx, float start_time);
Example #5
0
 [DllImport("AlembicExporter")] public static extern void        aeDestroyContext(aeContext ctx);
Example #6
0
 [DllImport("AlembicExporter")] public static extern bool        aeOpenArchive(aeContext ctx, string path);
Example #7
0
 [DllImport("AlembicExporter")] public static extern int         aeAddTimeSampling(aeContext ctx, float start_time);
Example #8
0
 [DllImport("AlembicExporter")] public static extern void        aeAddTime(aeContext ctx, float time, int tsi = 1); // relevant only if timeSamplingType is acyclic
Example #9
0
 [DllImport("AlembicExporter")] public static extern bool        aeOpenArchive(aeContext ctx, string path);
Example #10
0
 [DllImport("AlembicExporter")] public static extern aeObject    aeGetTopObject(aeContext ctx);
Example #11
0
 [DllImport("AlembicExporter")] public static extern void        aeDestroyContext(aeContext ctx);
Example #12
0
 // relevant only if timeSamplingType is acyclic. if tsi==-1, add time to all time samplings.
 [DllImport("AlembicExporter")] public static extern void        aeAddTime(aeContext ctx, float time, int tsi = -1);
Example #13
0
 [DllImport("AlembicExporter")] public static extern void        aeSetConfig(aeContext ctx, ref aeConfig conf);
Example #14
0
 // relevant only if timeSamplingType is acyclic. if tsi==-1, add time to all time samplings.
 [DllImport("AlembicExporter")] public static extern void        aeAddTime(aeContext ctx, float time, int tsi = -1);
Example #15
0
 [DllImport("AlembicExporter")] public static extern void        aeSetConfig(aeContext ctx, ref aeConfig conf);