//export and try to decimate the scene public static void ExportScene(bool includeTextures, bool staticGeometry, float minSize, int textureDivisor, string developerkey, string texturename) { if (blenderProcess != null) { Debug.LogError("Currently decimating a scene. Please wait until this is finished!"); return; } if (UploadSceneSettings != null) { Debug.LogError("Currently uploading a scene. Please wait until this is finished!"); return; } string fullName = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name; //export scene from unity bool successfulExport = CognitiveVR_SceneExplorerExporter.ExportScene(fullName, includeTextures, staticGeometry, minSize, textureDivisor, texturename); string objPath = CognitiveVR_SceneExplorerExporter.GetDirectory(fullName); //write json settings file string jsonSettingsContents = "{ \"scale\":1,\"sceneName\":\"" + fullName + "\",\"sdkVersion\":\"" + Core.SDK_VERSION + "\"}"; File.WriteAllText(objPath + "settings.json", jsonSettingsContents); if (!successfulExport) { Debug.LogError("Scene export failed!"); return; } //begin scene decimation if (!EditorCore.IsBlenderPathValid) { Debug.LogWarning("Blender not found during scene export. May result in large files uploaded to Scene Explorer"); return; } string filepath = ""; if (!EditorCore.RecursiveDirectorySearch("", out filepath, "CognitiveVR" + System.IO.Path.DirectorySeparatorChar + "Editor")) { Debug.LogError("Could not find CognitiveVR/Editor/decimateall.py"); } string decimateScriptPath = filepath + System.IO.Path.DirectorySeparatorChar + "decimateall.py"; decimateScriptPath = decimateScriptPath.Replace(" ", "\" \""); objPath = objPath.Replace(" ", "\" \""); fullName = fullName.Replace(" ", "\" \""); EditorUtility.ClearProgressBar(); ProcessStartInfo processInfo; #if UNITY_EDITOR_WIN processInfo = new ProcessStartInfo(EditorCore.BlenderPath); processInfo.UseShellExecute = true; processInfo.Arguments = "-P " + decimateScriptPath + " " + objPath + " " + EditorCore.ExportSettings.ExplorerMinimumFaceCount + " " + EditorCore.ExportSettings.ExplorerMaximumFaceCount + " " + fullName; #elif UNITY_EDITOR_OSX processInfo = new ProcessStartInfo("open"); processInfo.Arguments = EditorCore.BlenderPath + " --args -P " + decimateScriptPath + " " + objPath + " " + EditorCore.ExportSettings.ExplorerMinimumFaceCount + " " + EditorCore.ExportSettings.ExplorerMaximumFaceCount + " " + fullName; processInfo.UseShellExecute = false; #endif //changing scene while blender is decimating the level will break the file that will be automatically uploaded blenderProcess = Process.Start(processInfo); BlenderRequest = true; HasOpenedBlender = false; EditorApplication.update += UpdateProcess; UploadSceneSettings = CognitiveVR_Preferences.FindCurrentScene(); blenderStartTime = (float)EditorApplication.timeSinceStartup; }