浏览代码

Do not allow setup while running and do not allow run before setup

/pyrception-integration
leopoldo-zugasti 3 年前
当前提交
d82b2bab
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28
      com.unity.perception/Editor/Pyrception/PyrceptionInstaller.cs

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


[MenuItem("Window/Pyrception/Setup")]
static void SetupPyrception()
{
string project = Application.dataPath;
(int pythonPID, int port, int pyrceptionPID) = ReadEntry(project);
//If there is a python instance for this project AND it is alive then setup will fail (must kill instance)
if(pythonPID != -1 && ProcessAlive(pythonPID, port, pyrceptionPID))
{
if (EditorUtility.DisplayDialog("Kill visualizer?",
"The visualizer tool can't be running while you setup, would you like to kill the current instance?",
"Kill visualizer",
"Cancel"))
{
Process.GetProcessById(pythonPID + 1).Kill();
}
else
{
return;
}
}
int steps = 3;
int ExitCode = 0;

}
EditorUtility.ClearProgressBar();
PlayerPrefs.SetInt("VisualizerSetup", 1);
}
/// <summary>

[MenuItem("Window/Pyrception/Run")]
private static void RunPyrception()
{
if(!PlayerPrefs.HasKey("VisualizerSetup") || PlayerPrefs.GetInt("VisualizerSetup") != 1)
{
SetupPyrception();
}
//The dataPath is used as a unique identifier for the project
string project = Application.dataPath;

正在加载...
取消
保存