浏览代码

some more UI polish

/main
Mohsen Kamalzadeh 3 年前
当前提交
d2432f17
共有 2 个文件被更改,包括 28 次插入23 次删除
  1. 49
      com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
  2. 2
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs

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


PerceptionCamera perceptionCamera => ((PerceptionCamera)this.target);
string m_PreviousOutputDir;
bool m_ShowPatchChangedLabel;
public void OnEnable()
{
m_LabelersList = new ReorderableList(this.serializedObject, labelersProperty, true, true, true, true);

m_LabelersList.DoLayoutList();
}
var s = new GUIStyle(EditorStyles.textField);
s.wordWrap = true;
var defaultColor = s.normal.textColor;
m_PreviousOutputDir = dir;
EditorGUILayout.LabelField("Latest Dataset");
EditorGUILayout.LabelField("Latest Generated Dataset");
EditorGUILayout.HelpBox(dir, MessageType.None);
s.normal.textColor = Color.green;
EditorGUILayout.LabelField(dir, s);
GUILayout.BeginHorizontal();

GUILayout.Space(10);
if (GUILayout.Button("Choose Output Folder"))
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)

m_ShowPatchChangedLabel = true;
if (m_ShowPatchChangedLabel)
{
if (m_PreviousOutputDir == dir)
{
var s = new GUIStyle(EditorStyles.textField);
s.normal.textColor = Color.green;
s.wordWrap = true;
EditorGUILayout.LabelField("Output folder changed to: ");
EditorGUILayout.LabelField($"{PlayerPrefs.GetString(SimulationState.userBaseDirectoryKey)}", s);
}
else
{
m_ShowPatchChangedLabel = false;
}
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
if (EditorSettings.asyncShaderCompilation)

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


string m_OutputDirectoryPath;
public const string userBaseDirectoryKey = "userBaseDirectory";
public const string latestOutputDirectoryKey = "latestOutputDirectory";
public const string defaultOutputBaseDirectory = "defaultOutputBaseDirectory";
public bool IsRunning { get; private set; }

}
PlayerPrefs.SetString(latestOutputDirectoryKey, Manager.Instance.GetDirectoryFor("", basePath));
PlayerPrefs.SetString(defaultOutputBaseDirectory, Configuration.Instance.GetStorageBasePath());
IsRunning = true;
}

正在加载...
取消
保存