예제 #1
0
        /// <summary>
        /// Return Houdini Engine installation and session information.
        /// Tries to use existing or creates new session to find information.
        /// </summary>
        /// <returns>String containing installation and session information.</returns>
        public static string GetHoudiniEngineInstallationInfo()
        {
#if HOUDINIENGINEUNITY_ENABLED
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Required Houdini Version: {0}.{1}.{2}\nRequired Houdini Engine Version: {3}.{4}.{5}\n\n",
                            HEU_HoudiniVersion.HOUDINI_MAJOR,
                            HEU_HoudiniVersion.HOUDINI_MINOR,
                            HEU_HoudiniVersion.HOUDINI_BUILD,
                            HEU_HoudiniVersion.HOUDINI_ENGINE_MAJOR,
                            HEU_HoudiniVersion.HOUDINI_ENGINE_MINOR,
                            HEU_HoudiniVersion.HOUDINI_ENGINE_API);

            // Check if existing session is valid, or create a new session. Then query installation information.
            HEU_SessionBase session = HEU_SessionManager.GetDefaultSession();
            if (session != null && session.IsSessionValid())
            {
                int hMajor = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_MAJOR);
                int hMinor = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_MINOR);
                int hBuild = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_BUILD);

                int heuPatch = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_PATCH);

                int heuMajor = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MAJOR);
                int heuMinor = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MINOR);
                int heuAPI   = session.GetEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_API);

                sb.AppendFormat("Installed Houdini Version: {0}.{1}.{2}{3}\n", hMajor, hMinor, hBuild, (heuPatch > 0) ? "." + heuPatch.ToString() : "");
                sb.AppendFormat("Installed Houdini Engine Version: {0}.{1}.{2}\n\n", heuMajor, heuMinor, heuAPI);

                sb.AppendFormat("Houdini Binaries Path: {0}\n", HEU_Platform.GetHoudiniEnginePath() + HEU_HoudiniVersion.HAPI_BIN_PATH);
                sb.AppendFormat("Unity Plugin Version: {0}\n\n", HEU_HoudiniVersion.UNITY_PLUGIN_VERSION);

                HEU_SessionData sessionData = session.GetSessionData();
                if (sessionData != null)
                {
                    sb.AppendFormat("Session ID: {0}\n", sessionData.SessionID);
                    sb.AppendFormat("Session Type: {0}\n", sessionData.SessionType);
                    sb.AppendFormat("Process ID: {0}\n", sessionData.ProcessID);

                    if (sessionData.SessionType == HAPI_SessionType.HAPI_SESSION_THRIFT)
                    {
                        sb.AppendFormat("Pipe name: {0}\n", sessionData.PipeName);
                    }

                    sb.AppendLine();
                }

                sb.Append("License Type Acquired: ");
                HAPI_License license = HEU_SessionManager.GetCurrentLicense(false);
                switch (license)
                {
                case HAPI_License.HAPI_LICENSE_NONE: sb.Append("None\n"); break;

                case HAPI_License.HAPI_LICENSE_HOUDINI_ENGINE: sb.Append("Houdini Engine\n"); break;

                case HAPI_License.HAPI_LICENSE_HOUDINI: sb.Append("Houdini (Escape)\n"); break;

                case HAPI_License.HAPI_LICENSE_HOUDINI_FX: sb.Append("Houdini FX\n"); break;

                case HAPI_License.HAPI_LICENSE_HOUDINI_ENGINE_INDIE: sb.Append("Houdini Engine Indie"); break;

                case HAPI_License.HAPI_LICENSE_HOUDINI_INDIE: sb.Append("Houdini Indie\n"); break;

                default: sb.Append("Unknown\n"); break;
                }
            }
            else             // Unable to establish a session
            {
                sb.AppendLine("Unable to detect Houdini Engine installation.");
                sb.AppendLine("License Type Acquired: Unknown\n");
                if (session != null)
                {
                    sb.AppendLine("Failure possibly due to: " + session.GetLastSessionError());
                }
            }

            sb.AppendLine();
            sb.Append("PATH: \n" + GetEnvironmentPath());

            Debug.Log(sb.ToString());

            return(sb.ToString());
#else
            return("");
#endif
        }