浏览代码

Merge pull request #2 from Unity-Technologies/label_id

Fix UI bugs in LabelingConfiguration inspector
/main
GitHub 5 年前
当前提交
1aaf0ce6
共有 4 个文件被更改,包括 42 次插入13 次删除
  1. 8
      TestProjects/PerceptionURP/Packages/manifest.json
  2. 4
      TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt
  3. 28
      com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs
  4. 15
      TestProjects/PerceptionURP/ProjectSettings/URPProjectSettings.asset

8
TestProjects/PerceptionURP/Packages/manifest.json


{
"dependencies": {
"com.unity.simulation.capture": "0.0.10-preview.6",
"com.unity.simulation.core": "0.0.10-preview.8",
"com.unity.render-pipelines.universal": "7.1.8",
"com.unity.test-framework": "1.1.11",
"com.unity.render-pipelines.universal": "7.3.1",
"com.unity.simulation.capture": "0.0.10-preview.6",
"com.unity.simulation.core": "0.0.10-preview.8",
"com.unity.test-framework": "1.1.13",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.12",
"com.unity.ugui": "1.0.0",

4
TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.3.6f1
m_EditorVersionWithRevision: 2019.3.6f1 (5c3fb0a11183)
m_EditorVersion: 2019.3.9f1
m_EditorVersionWithRevision: 2019.3.9f1 (e6e740a1c473)

28
com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs


void OnRemove(ReorderableList list)
{
if (list.index != -1)
config.LabelingConfigurations.RemoveAt(list.index);
list.serializedProperty.DeleteArrayElementAtIndex(list.index);
this.serializedObject.ApplyModifiedProperties();
EditorUtility.SetDirty(target);
}
LabelingConfiguration config => (LabelingConfiguration)this.target;

config.LabelingConfigurations.Add(new LabelingConfigurationEntry("", 0));
var index = list.serializedProperty.arraySize;
list.serializedProperty.InsertArrayElementAtIndex(index);
var element = list.serializedProperty.GetArrayElementAtIndex(index);
var labelProperty = element.FindPropertyRelative(nameof(LabelingConfigurationEntry.label));
labelProperty.stringValue = "";
var valueProperty = element.FindPropertyRelative(nameof(LabelingConfigurationEntry.value));
valueProperty.intValue = 0;
serializedObject.ApplyModifiedProperties();
EditorUtility.SetDirty(target);
var entry = config.LabelingConfigurations[index];
var element = m_LabelsList.serializedProperty.GetArrayElementAtIndex(index);
var labelProperty = element.FindPropertyRelative(nameof(LabelingConfigurationEntry.label));
var valueProperty = element.FindPropertyRelative(nameof(LabelingConfigurationEntry.value));
var newLabel = EditorGUI.TextField(contentRect, nameof(LabelingConfigurationEntry.label), entry.label);
var newLabel = EditorGUI.TextField(contentRect, nameof(LabelingConfigurationEntry.label), labelProperty.stringValue);
config.LabelingConfigurations[index] = new LabelingConfigurationEntry(newLabel, entry.value);
labelProperty.stringValue = newLabel;
var newValue = EditorGUI.IntField(contentRect, nameof(LabelingConfigurationEntry.value), entry.value);
var newValue = EditorGUI.IntField(contentRect, nameof(LabelingConfigurationEntry.value), valueProperty.intValue);
config.LabelingConfigurations[index] = new LabelingConfigurationEntry(entry.label, newValue);
valueProperty.intValue = newValue;
}
}

this.serializedObject.ApplyModifiedProperties();
}
}

15
TestProjects/PerceptionURP/ProjectSettings/URPProjectSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 247994e1f5a72c2419c26a37e9334c01, type: 3}
m_Name:
m_EditorClassIdentifier:
m_LastMaterialVersion: 1
正在加载...
取消
保存