Beispiel #1
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);
        }
Beispiel #2
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);
            }
        }