浏览代码

Fix merge

/pyrception-integration
leopoldo-zugasti 3 年前
当前提交
6033a00e
共有 1 个文件被更改,包括 27 次插入17 次删除
  1. 44
      com.unity.perception/Editor/Visualizer/VisualizerInstaller.cs

44
com.unity.perception/Editor/Visualizer/VisualizerInstaller.cs


#if UNITY_EDITOR_WIN
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), _filename_streamlit_instances);
#elif UNITY_EDITOR_OSX
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), _filename_streamlit_instances);
return Path.Combine(
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library"
),
_filenameStreamlitInstances);
#endif
}
}

= "";
#endif
/// <summary>
/// Install visualizer (Assumes python3 and pip3 are already installed)

return;
}
}
int steps = 3;
int ExitCode = 0;

packagesPath = packagesPath.Replace("/", "\\");
#endif
//==============================INSTALL VISUALIZER IN PYTHON FOR UNITY======================================
EditorUtility.DisplayProgressBar("Setting up the Visualizer", "Installing the Visualizer...", 2.5f / steps);

[MenuItem("Window/Visualizer/Run")]
private static void RunVisualizer()
{
if(!PlayerPrefs.HasKey("VisualizerSetup") || PlayerPrefs.GetInt("VisualizerSetup") != 1)
if (!PlayerPrefs.HasKey("VisualizerSetup") || PlayerPrefs.GetInt("VisualizerSetup") != 1)
{
SetupVisualizer();
}

//If there is a python instance for this project AND it is alive then just run browser
if(pythonPID != -1 && ProcessAlive(pythonPID, port, visualizerPID))
{
LaunchBrowser(port);
LaunchBrowser(port);
DeleteEntry(project);
DeleteEntry(project);
Process[] before = Process.GetProcesses();
int errorCode = ExecuteVisualizer();

}*/
LaunchBrowser(newPort);
}
}

#elif UNITY_EDITOR_OSX
string packagesPath = Application.dataPath.Replace("/Assets","/Library/PythonInstall/bin");
#endif
string pathToData = PlayerPrefs.GetString(SimulationState.latestOutputDirectoryKey);
#if UNITY_EDITOR_WIN
path = path.Replace("/", "\\");

string command = "";
command = $"cd \'{packagesPath}\'; datasetvisualizer preview --data=\'{pathToData}\'";
command = $"cd \'{pathToData}\'; \'{packagesPath}/datasetvisualizer\' preview --data=\'.\'";
UnityEngine.Debug.Log(pathToData);
UnityEngine.Debug.Log(command);
int ExitCode = 0;
int PID = ExecuteCMD(command, ref ExitCode, waitForExit: false, displayWindow: false);

return false;
}
else
{
{
return true;
}
}

{
try
{
ProcessPorts.Add(new ProcessPort(
GetProcessName(Convert.ToInt32(Tokens[8])),
Convert.ToInt32(Tokens[8]),
"tcp4",
Convert.ToInt32(Tokens[3].Split('.')[1])
));
if(Tokens[5] != "CLOSED"){
ProcessPorts.Add(new ProcessPort(
GetProcessName(Convert.ToInt32(Tokens[8])),
Convert.ToInt32(Tokens[8]),
"tcp4",
Convert.ToInt32(Tokens[3].Split('.')[1])
));
}
}
catch
{

正在加载...
取消
保存