浏览代码

Pypi install instead of copy on MacOS/OSX

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

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


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

/// </summary>
[MenuItem("Window/Visualizer/Setup")]
static void SetupVisualizer()
{
{
string project = Application.dataPath;
(int pythonPID, int port, int visualizerPID) = ReadEntry(project);

[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();
}

#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);

{
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
{

正在加载...
取消
保存