浏览代码

Handle multiple runs

/pyrception-integration
leopoldo-zugasti 4 年前
当前提交
38bcae7a
共有 1 个文件被更改,包括 42 次插入17 次删除
  1. 59
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

59
com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs


using UnityEngine.Perception.GroundTruth;
public class PyrceptionInstaller : EditorWindow
{
{
#if UNITY_EDITOR_OSX || true
#endif
/// <summary>
/// Runs pyrception instance in default browser
/// </summary>

#if UNITY_EDITOR_OSX
#if UNITY_EDITOR_WIN
if (RestartBrowser())
return;
#elif UNITY_EDITOR_OSX
KillProcess();
#endif
string path = Path.GetFullPath(Application.dataPath.Replace("/Assets", ""));

int ExitCode = 0;
ExecuteCMD(command, ref ExitCode, waitForExit: false, displayWindow: true);
if (ExitCode != 0)
{
}
{
#if UNITY_EDITOR_WIN
UnityEngine.Debug.Log("Launching visualization tool...");
#elif UNITY_EDITOR_OSX
#endif
}
}
/// <summary>

EditorUtility.ClearProgressBar();
}
#if UNITY_EDITOR_OSX || true
void OnDestroy()
#if UNITY_EDITOR_WIN
private static bool RestartBrowser()
KillProcess();
if (currentProcessId != -1)
{
try
{
Process proc = Process.GetProcessById(currentProcessId + 1);
Process.Start("http://localhost:8501");
return true;
}
catch(System.Exception e)
{
currentProcessId = -1;
return false;
}
}
return false;
#elif UNITY_EDITOR_OSX || true
private static void KillProcess()
{

}
#endif
static void Quit()
{
KillProcess();
}
[RuntimeInitializeOnLoadMethod]
static void RunOnStart()
{
Application.quitting += Quit;
}
/// <summary>
/// Executes command in cmd or console depending on system

if (!waitForExit)
{
#if UNITY_EDITOR_WIN
if (currentProcessId == -1)
currentProcessId = cmd.Id;
#elif UNITY_EDITOR_OSX
return "";
#endif
return output;
}

正在加载...
取消
保存