GetSessionData() public static method

Return the existing session data.
public static GetSessionData ( ) : HEU_SessionData
return HEU_SessionData
コード例 #1
0
        /// <summary>
        /// Connect to a running instance of Houdini with SessionSync enabled.
        /// </summary>
        void ConnectSessionSync(HEU_SessionSyncData syncData)
        {
            if (syncData != null && syncData.SyncStatus != HEU_SessionSyncData.Status.Stopped)
            {
                return;
            }

            Log("Connecting To Houdini...");

            HEU_SessionManager.RecreateDefaultSessionData();

            if (syncData == null)
            {
                HEU_SessionData sessionData = HEU_SessionManager.GetSessionData();
                if (sessionData != null)
                {
                    syncData = sessionData.GetOrCreateSessionSync();
                }
                else
                {
                    syncData = new HEU_SessionSyncData();
                }
            }

            bool result = InternalConnect(_sessionMode, _pipeName,
                                          HEU_PluginSettings.Session_Localhost, _port,
                                          HEU_PluginSettings.Session_AutoClose,
                                          HEU_PluginSettings.Session_Timeout,
                                          true);

            if (result)
            {
                try
                {
                    HEU_SessionManager.InitializeDefaultSession();

                    HEU_SessionManager.GetDefaultSession().GetSessionData().SetSessionSync(syncData);

                    syncData.SyncStatus = HEU_SessionSyncData.Status.Connected;
                    Log("Connected!");
                }
                catch (HEU_HoudiniEngineError ex)
                {
                    syncData.SyncStatus = HEU_SessionSyncData.Status.Stopped;

                    Log("Connection errored!");
                    Log(ex.ToString());
                }
            }
            else
            {
                Log("Connection failed!");
            }
        }
コード例 #2
0
        /// <summary>
        /// Returns the local HEU_SessionSyncData state.
        /// </summary>
        HEU_SessionSyncData GetSessionSyncData()
        {
            HEU_SessionSyncData syncData = _connectionSyncData;

            if (syncData == null)
            {
                HEU_SessionData sessionData = HEU_SessionManager.GetSessionData();
                if (sessionData != null)
                {
                    // On domain reload, re-acquire serialized SessionSync
                    // if session exists
                    syncData = sessionData.GetOrCreateSessionSync();
                }
            }
            return(syncData);
        }
コード例 #3
0
        /// <summary>
        /// Launch Houdini with SessionSync enabled and automatically connect to it.
        /// </summary>
        void StartAndConnectToHoudini(HEU_SessionSyncData syncData)
        {
            if (syncData != null && syncData.SyncStatus != HEU_SessionSyncData.Status.Stopped)
            {
                return;
            }

            if (!OpenHoudini())
            {
                return;
            }

            // Now attempt to connect to it by moving into Connecting state

            HEU_SessionManager.RecreateDefaultSessionData();

            if (syncData == null)
            {
                HEU_SessionData sessionData = HEU_SessionManager.GetSessionData();
                if (sessionData != null)
                {
                    syncData = sessionData.GetOrCreateSessionSync();
                }
                else
                {
                    syncData = new HEU_SessionSyncData();
                }

                syncData._validForConnection = true;
            }

            syncData.SyncStatus = HEU_SessionSyncData.Status.Connecting;

            _connectionSyncData = syncData;
            Log("Connecting...");

            syncData._timeStartConnection = Time.realtimeSinceStartup;
            syncData._timeLastUpdate      = Time.realtimeSinceStartup;
        }