public static void ShowWindow()
    {
        OsvrEditorUtils osvrUtilsWindow = EditorWindow.GetWindow <OsvrEditorUtils>();

        osvrUtilsWindow.Load();
        GUIContent titleContent = new GUIContent("OSVR");

        osvrUtilsWindow.titleContent = titleContent;

        //set the OSVR server directory
        if (osvrUtilsWindow.OsvrServerDirectory == "" && Directory.Exists(OSVR_RUNTIME_DIR))
        {
            osvrUtilsWindow.OsvrServerDirectory = OSVR_RUNTIME_DIR;
            osvrUtilsWindow.SavePath(OSVR_RUNTIME_DIR);
        }
        else if (osvrUtilsWindow.OsvrServerDirectory == "" && Directory.Exists(OSVR_SDK_DIR))
        {
            osvrUtilsWindow.OsvrServerDirectory = OSVR_SDK_DIR;
            osvrUtilsWindow.SavePath(OSVR_SDK_DIR);
        }
    }
Esempio n. 2
0
    public static void ShowWindow()
    {
        OsvrEditorUtils osvrUtilsWindow = EditorWindow.GetWindow <OsvrEditorUtils>();

        osvrUtilsWindow.Load();
        osvrUtilsWindow.GetLatestOsvrUnity();
        GUIContent titleContent = new GUIContent("OSVR");

        osvrUtilsWindow.titleContent                = titleContent;
        osvrUtilsWindow.versionLabelStyle           = new GUIStyle();
        osvrUtilsWindow.versionLabelStyle.fontStyle = FontStyle.Bold;
        osvrUtilsWindow.versionLabelStyle.padding   = new RectOffset(5, 0, 0, 0);

        //check if the server directory path has been set
        string serverPath = osvrUtilsWindow.GetPath(PP_OSVR_ARGS_KEY);

        if (Directory.Exists(serverPath) && File.Exists(serverPath + "\\" + OSVR_SERVER_FILENAME))
        {
            //a server exists at the saved path
            //check if it is the official SDK path
            if (serverPath.CompareTo(osvrUtilsWindow.GetDefaultPath()) == 0)
            {
                osvrUtilsWindow.usingDefaultServer = true;
            }
            else
            {
                osvrUtilsWindow.usingDefaultServer = false;
                Debug.LogWarning("[OSVR-Unity] Warning, saved server path in OSVR Editor Window is not the OSVR SDK default. This may or may not be intended.");
            }
        }
        else
        {
            Debug.Log("[OSVR-Unity] OSVR server not found, reverting to default path.");
            osvrUtilsWindow.OsvrServerDirectory = osvrUtilsWindow.GetDefaultPath();
            osvrUtilsWindow.SaveServerDirectory(osvrUtilsWindow.OsvrServerDirectory);
        }
    }