Example #1
0
        public void usdiUnload()
        {
            if (!m_ctx)
            {
                return;
            }

            usdiWaitAsyncUpdateTask();
            m_asyncUpdate = null;

            int c = m_schemas.Count;

            for (int i = 0; i < c; ++i)
            {
                m_schemas[i].usdiOnUnload();
            }

            m_schemas.Clear();
            m_schemaLUT.Clear();

            usdi.usdiDestroyContext(m_ctx);
            m_ctx = default(usdi.Context);

            usdiLog("usdiStream: unloaded " + m_path.GetFullPath());
        }
Example #2
0
        public bool usdiLoad(string path)
        {
            usdiUnload();

            m_path = path;
            m_ctx  = usdi.usdiCreateContext();
            usdiApplyImportConfig();
            if (!usdi.usdiOpen(m_ctx, Application.streamingAssetsPath + "/" + m_path))
            {
                usdi.usdiDestroyContext(m_ctx);
                m_ctx = default(usdi.Context);
                usdiLog("usdiStream: failed to load " + m_path);
                return(false);
            }

            m_updater = new usdiStreamUpdater(m_ctx, this);
            m_updater.ConstructScene();
            m_updater.OnLoad();
            //usdiCreateNodeRecursive(GetComponent<Transform>(), usdi.usdiGetRoot(m_ctx),
            //    (e, schema) => {
            //        m_elements.Add(e);
            //        //m_updator.Add(schema, e.gameObject);
            //    });

            usdiAsyncUpdate(m_time);
            usdiUpdate(m_time);

            usdiLog("usdiStream: loaded " + m_path);
            return(true);
        }
Example #3
0
        bool usdiLoad(DataPath path)
        {
            usdiUnload();

            m_path          = path;
            m_path.readOnly = true;
            m_ctx           = usdi.usdiCreateContext();

            var fullpath = m_path.GetFullPath();

            if (!usdi.usdiOpen(m_ctx, fullpath))
            {
                usdi.usdiDestroyContext(m_ctx);
                m_ctx = default(usdi.Context);
                usdiLog("usdiStream: failed to load " + fullpath);
                return(false);
            }

            // apply variant selections
            if (usdiApplyVarianceSelections())
            {
                usdi.usdiRebuildSchemaTree(m_ctx);
            }
            usdiApplyImportConfig(true);

            usdiConstructTrees();

            // fill sample data with initial time
            m_requestForceUpdate = true;
            usdiAsyncUpdate(m_time);
            usdiUpdate(m_time);

            usdiLog("usdiStream: loaded " + fullpath);
            return(true);
        }
Example #4
0
        public bool BeginCapture()
        {
            if (m_recording)
            {
                Debug.Log("usdiExporter: already started");
                return(false);
            }

            // create context and open archive
            m_ctx = usdi.usdiCreateContext();
            if (!usdi.usdiCreateStage(m_ctx, m_outputPath))
            {
                Debug.Log("usdiExporter: failed to create " + m_outputPath);
                usdi.usdiDestroyContext(m_ctx);
                m_ctx = default(usdi.Context);
                return(false);
            }
            ApplyExportConfig();

            // create capturers
            ConstructCaptureTree();

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

            Debug.Log("usdiExporter: start " + m_outputPath);
            return(true);
        }
Example #5
0
        public void EndCapture()
        {
            if (!m_recording)
            {
                return;
            }

            FlushUSD();
            m_capturers.Clear();
            usdi.usdiDestroyContext(m_ctx); // flush archive
            m_ctx        = default(usdi.Context);
            m_recording  = false;
            m_time       = 0.0f;
            m_frameCount = 0;

            Debug.Log("usdiExporter: end: " + m_outputPath);
        }
Example #6
0
        public void usdiUnload()
        {
            if (m_ctx)
            {
                usdiWaitAsyncUpdateTask();
                m_asyncUpdate = null;

                int c = m_elements.Count;
                for (int i = 0; i < c; ++i)
                {
                    m_elements[i].usdiOnUnload();
                }
                m_updater.OnUnload();
                m_updater = null;

                usdi.usdiDestroyContext(m_ctx);
                m_ctx = default(usdi.Context);

                usdiLog("usdiStream: unloaded " + m_path);
            }
        }
 private static extern IntPtr _Ctor(usdi.Context usd, usdiStream stream);
 public usdiStreamUpdater(usdi.Context usd, usdiStream stream)
 {
     m_rep = _Ctor(usd, stream);
 }
 public usdiStreamUpdaterM(usdi.Context usd, usdiStream stream)
 {
     m_trans = stream.GetComponent <Transform>();
 }
 public abstract void CreateUSDObject(usdi.Context ctx, usdi.Schema parent);