浏览代码

Merge pull request #315 from Unity-Technologies/output_directory

Output directory option added to PerceptionCamera
/main
GitHub 4 年前
当前提交
336f5379
共有 3 个文件被更改,包括 62 次插入3 次删除
  1. 2
      com.unity.perception/CHANGELOG.md
  2. 43
      com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
  3. 20
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs

2
com.unity.perception/CHANGELOG.md


Added random seed field to the Run in Unity Simulation Window
User can now choose the base folder location to store their generated data.
### Changed
Increased color variety in instance segmentation images

43
com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs


m_LabelersList.DoLayoutList();
}
var s = new GUIStyle(EditorStyles.textField);
s.wordWrap = true;
var defaultColor = s.normal.textColor;
EditorGUILayout.LabelField("Latest Output Folder");
EditorGUILayout.LabelField("Latest Generated Dataset");
EditorGUILayout.HelpBox(dir, MessageType.None);
s.normal.textColor = Color.green;
EditorGUILayout.LabelField(dir, s);
if (GUILayout.Button("Show Folder"))
{
EditorUtility.RevealInFinder(dir);

GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
GUILayout.Space(10);
var userBaseDir = PlayerPrefs.GetString(SimulationState.userBaseDirectoryKey);
if (userBaseDir == string.Empty)
{
var folder = PlayerPrefs.GetString(SimulationState.defaultOutputBaseDirectory);
userBaseDir = folder != string.Empty ? folder : Application.persistentDataPath;
}
EditorGUILayout.LabelField("Output Base Folder");
GUILayout.BeginVertical("TextArea");
s.normal.textColor = defaultColor;
EditorGUILayout.LabelField(userBaseDir, s);
GUILayout.BeginHorizontal();
if (GUILayout.Button("Change Folder"))
{
var path = EditorUtility.OpenFolderPanel("Choose Output Folder", "", "");
if (path.Length != 0)
{
Debug.Log($"Chose path: {path}");
PlayerPrefs.SetString(SimulationState.userBaseDirectoryKey, path);
}
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
if (EditorSettings.asyncShaderCompilation)
{

20
com.unity.perception/Runtime/GroundTruth/SimulationState.cs


float m_LastTimeScale;
readonly string m_OutputDirectoryName;
string m_OutputDirectoryPath;
public const string userBaseDirectoryKey = "userBaseDirectory";
public const string defaultOutputBaseDirectory = "defaultOutputBaseDirectory";
public bool IsRunning { get; private set; }

public SimulationState(string outputDirectory)
{
PlayerPrefs.SetString(defaultOutputBaseDirectory, Configuration.Instance.GetStorageBasePath());
PlayerPrefs.SetString(latestOutputDirectoryKey, Manager.Instance.GetDirectoryFor());
var basePath = PlayerPrefs.GetString(userBaseDirectoryKey, string.Empty);
if (basePath != string.Empty)
{
if (Directory.Exists(basePath))
{
Configuration.localPersistentDataPath = basePath;
}
else
{
Debug.LogWarning($"Passed in directory to store simulation artifacts: {basePath}, does not exist. Using default directory {Configuration.localPersistentDataPath} instead.");
basePath = Configuration.localPersistentDataPath;
}
}
PlayerPrefs.SetString(latestOutputDirectoryKey, Manager.Instance.GetDirectoryFor("", basePath));
IsRunning = true;
}

正在加载...
取消
保存