예제 #1
0
        public void AbcLoad(bool createMissingNodes = false)
        {
            if (m_pathToAbc == null)
            {
                return;
            }

            m_trans  = GetComponent <Transform>();
            m_abc    = AbcAPI.aiCreateContext(gameObject.GetInstanceID());
            m_loaded = AbcAPI.aiLoad(m_abc, Application.streamingAssetsPath + "/" + m_pathToAbc);

            if (m_loaded)
            {
                m_startTime         = AbcAPI.aiGetStartTime(m_abc);
                m_endTime           = AbcAPI.aiGetEndTime(m_abc);
                m_timeOffset        = -m_startTime;
                m_timeScale         = 1.0f;
                m_preserveStartTime = true;
                m_forceRefresh      = true;

                AbcSyncConfig();

                AbcAPI.UpdateAbcTree(m_abc, m_trans, AbcTime(m_time), createMissingNodes);
            }
        }
예제 #2
0
        bool AbcRecoverContext()
        {
            if (!AbcIsValid())
            {
                if (m_verbose)
                {
                    Debug.Log("AlembicStream.AbcRecoverContext: Try to recover alembic context");
                }

                m_abc = AbcAPI.aiCreateContext(gameObject.GetInstanceID());

                if (AbcIsValid())
                {
                    m_startTime         = AbcAPI.aiGetStartTime(m_abc);
                    m_endTime           = AbcAPI.aiGetEndTime(m_abc);
                    m_timeOffset        = -m_startTime;
                    m_timeScale         = 1.0f;
                    m_preserveStartTime = true;
                    m_forceRefresh      = true;
                    m_trans             = GetComponent <Transform>();
                    m_elements.Clear();

                    AbcSyncConfig();

                    AbcAPI.UpdateAbcTree(m_abc, m_trans, AbcTime(m_time), false);

                    if (m_verbose)
                    {
                        Debug.Log("AlembicStream.AbcRecoverContext: Succeeded (" + m_elements.Count + " element(s))");
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }