Esempio n. 1
0
        public void ReinitializePDGContext()
        {
            HEU_SessionBase session = GetHAPIPDGSession();

            if (session == null || !session.IsSessionValid())
            {
                _pdgContextIDs = null;
                return;
            }

            int numContexts = 0;

            HAPI_StringHandle[]       contextNames = new HAPI_StringHandle[_pdgContextSize];
            HAPI_PDG_GraphContextId[] contextIDs   = new HAPI_PDG_GraphContextId[_pdgContextSize];
            if (!session.GetPDGGraphContexts(out numContexts, contextNames, contextIDs, _pdgContextSize) || numContexts <= 0)
            {
                _pdgContextIDs = null;
                return;
            }

            if (_pdgContextIDs == null || numContexts != _pdgContextIDs.Length)
            {
                _pdgContextIDs = new HAPI_PDG_GraphContextId[numContexts];
            }

            for (int i = 0; i < numContexts; ++i)
            {
                _pdgContextIDs[i] = contextIDs[i];
                //Debug.LogFormat("PDG Context: {0} - {1}", HEU_SessionManager.GetString(contextNames[i], session), contextIDs[i]);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Query the currently active PDG graph contexts in the Houdini Engine session.
        /// Should be done each time to get latest set of graph contexts.
        /// </summary>
        public void ReinitializePDGContext()
        {
#if HOUDINIENGINEUNITY_ENABLED
            HEU_SessionBase session = GetHAPIPDGSession();
            if (session == null || !session.IsSessionValid())
            {
                _pdgContextIDs = null;
                return;
            }

            int numContexts = 0;
            HAPI_StringHandle[]       contextNames = new HAPI_StringHandle[_pdgContextSize];
            HAPI_PDG_GraphContextId[] contextIDs   = new HAPI_PDG_GraphContextId[_pdgContextSize];
            if (!session.GetPDGGraphContexts(out numContexts, contextNames, contextIDs, _pdgContextSize) || numContexts <= 0)
            {
                _pdgContextIDs = null;
                return;
            }

            if (_pdgContextIDs == null || numContexts != _pdgContextIDs.Length)
            {
                _pdgContextIDs = new HAPI_PDG_GraphContextId[numContexts];
            }

            // TODO: might be okay to just use _pdgContextIDs above instead of doing a copy here
            for (int i = 0; i < numContexts; ++i)
            {
                _pdgContextIDs[i] = contextIDs[i];
                //Debug.LogFormat("PDG Context: {0} - {1}", HEU_SessionManager.GetString(contextNames[i], session), contextIDs[i]);
            }
#endif
        }