Skip to content

Commit 0b0208d

Browse files
authored
Informative tooltips and ui labels (#75)
* Merge branch 'dr-test3' of https://github.com/Unity-Technologies/com.unity.perception into dr-test3 Add some tooltips and UI labels to perception camera, labelers, randomization scenarios, and parameter configurations * making requested change variable name case change * added ///<inheritdoc/> to description overrides * two more xmldoc additions to fix warnings
1 parent 3b61394 commit 0b0208d

File tree

12 files changed

+56
-12
lines changed

12 files changed

+56
-12
lines changed

com.unity.perception/Editor/GroundTruth/CameraLabelerDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void DoHeaderGUI(ref Rect rect)
116116
enabledRect.x = rect.xMax - enabledSize.x;
117117
enabledRect.width = enabledSize.x;
118118

119-
EditorGUI.LabelField(headerRect, $"{cameraLabeler.GetType().Name}", EditorStyles.boldLabel);
119+
EditorGUI.LabelField(headerRect, new GUIContent($"{cameraLabeler.GetType().Name}", $"{cameraLabeler.description}"), EditorStyles.boldLabel);
120120
EditorGUIUtility.labelWidth = enabledRect.width - 14;
121121
m_Enabled.boolValue = EditorGUI.Toggle(enabledRect, Styles.enabled, m_Enabled.boolValue);
122122
EditorGUIUtility.labelWidth = 0;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ public override void OnInspectorGUI()
8080
{
8181
using(new EditorGUI.DisabledScope(EditorApplication.isPlaying))
8282
{
83-
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.description)));
84-
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.period)));
85-
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.startTime)));
86-
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.showVisualizations)));
87-
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.captureRgbImages)));
83+
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.description)), new GUIContent("Description", "Provide a description for this perception camera (optional)."));
84+
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.period)), new GUIContent("Capture Interval", "The interval at which the perception camera should render and capture (seconds)."));
85+
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.startTime)), new GUIContent("Start Time","Time at which this perception camera starts rendering and capturing (seconds)."));
86+
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.showVisualizations)), new GUIContent("Show Labeler Visualizations", "Display realtime visualizations for labelers that are currently active on this perception camera."));
87+
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.captureRgbImages)),new GUIContent("Save Camera Output to Disk", "For each captured frame, save an RGB image of the perception camera's output to disk."));
8888
serializedObject.ApplyModifiedProperties();
8989

9090
//EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(PerceptionCamera.labelers)));
@@ -98,7 +98,7 @@ public override void OnInspectorGUI()
9898
#if HDRP_PRESENT
9999
var hdRenderPipelineAsset = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset as UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset;
100100
if (hdRenderPipelineAsset != null &&
101-
hdRenderPipelineAsset.currentPlatformRenderPipelineSettings.supportedLitShaderMode ==
101+
hdRenderPipelineAsset.currentPlatformRenderPipelineSettings.supportedLitShaderMode ==
102102
UnityEngine.Rendering.HighDefinition.RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly)
103103
{
104104
EditorGUILayout.HelpBox("Deferred Only shader mode is not supported by rendering-based labelers. " +

com.unity.perception/Editor/Randomization/Uxml/ParameterConfiguration.uxml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<UXML xmlns="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements">
22
<VisualElement>
33
<Style src="../Uss/Styles.uss"/>
4-
4+
<Label style="white-space: normal; margin-bottom: 2px; margin-top: 2px;" text="Use this component to define a list of parameters for randomizing various aspects of your scene throughout the simulation (e.g. object size and placement, lighting, etc.) and assign them to properties of GameObjects present in your scene."/>
5+
<Label style="white-space: normal; margin-bottom: 2px; margin-top: 10px" text ="Search parameter names:"/>
56
<VisualElement style="flex-direction: row; align-items: center; margin-bottom: 2px; margin-top: 2px;">
67
<VisualElement class="search-icon" style="margin-left: 3px; margin-right: 2px;"/>
78
<TextField name="filter-parameters" style="flex-grow: 1; flex-shrink: 1;"/>
89
</VisualElement>
9-
<ScrollView name="parameter-scroll-view" class="dark-viewport" style="min-height: 100px; max-height: 600px;">
10+
<Label style="white-space: normal; margin-bottom: 2px; margin-top: 10px" text ="Parameter list:"/>
11+
<ScrollView name="parameter-scroll-view" class="dark-viewport" style="min-height: 100px; max-height: 600px; margin-top: 2px">
1012
<VisualElement name="parameters-container" style="flex-shrink: 0;"/>
1113
</ScrollView>
1214

com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<UXML xmlns="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements">
22
<VisualElement>
33
<Style src="../Uss/Styles.uss"/>
4-
4+
<Label style="white-space: normal; margin-bottom: 5px; margin-top: 2px" text="Scenarios control the execution flow of your simulation by applying randomization parameters. Make sure to always have only one scenario active within your scene."/>
55
<VisualElement name="inspector-properties" style="margin-bottom: 20px;"/>
66

77
<VisualElement name="configuration-container" class="dark-viewport">
88
<Toggle label="Quit On Complete" tooltip="Quit the application when the scenario completes" binding-path="quitOnComplete" style="margin-left: 3px"/>
99
<VisualElement name="constants-container">
10-
<editor:PropertyField binding-path="constants"/>
10+
<editor:PropertyField binding-path="constants" tooltip="A custom list of parameters for this scenario that will be JSON serialized. You can add or remove constants by modifying the code for this scenario class. Only these properties of the simulation can be changed externally from a built player."/>
1111
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>
1212
<editor:PropertyField tooltip="Read constants from JSON when the application starts" name="deserialize-on-start" label="Deserialize On Start" binding-path="deserializeOnStart" style="padding-left: 4px;"/>
1313
<VisualElement style="flex-direction: row;">

com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ namespace UnityEngine.Perception.GroundTruth
1515
[Serializable]
1616
public sealed class BoundingBox2DLabeler : CameraLabeler
1717
{
18+
///<inheritdoc/>
19+
public override string description
20+
{
21+
get => "Produces 2D bounding box annotations for all visible objects that bear a label defined in this labeler's associated label configuration.";
22+
protected set {}
23+
}
24+
1825
[SuppressMessage("ReSharper", "InconsistentNaming")]
1926
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
2027
struct BoundingBoxValue

com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ namespace UnityEngine.Perception.GroundTruth
1414
[Serializable]
1515
public abstract class CameraLabeler
1616
{
17+
/// <summary>
18+
/// A human-readable description of the labeler
19+
/// </summary>
20+
public abstract string description { get; protected set; }
21+
1722
/// <summary>
1823
/// Whether the CameraLabeler should be set up and called each frame.
1924
/// </summary>

com.unity.perception/Runtime/GroundTruth/Labelers/ObjectCountLabeler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ namespace UnityEngine.Perception.GroundTruth
1313
[Serializable]
1414
public sealed class ObjectCountLabeler : CameraLabeler
1515
{
16+
///<inheritdoc/>
17+
public override string description
18+
{
19+
get => "Produces object counts for each label defined in this labeler's associated label configuration.";
20+
protected set {}
21+
}
22+
1623
/// <summary>
1724
/// The ID to use for object count annotations in the resulting dataset
1825
/// </summary>

com.unity.perception/Runtime/GroundTruth/Labelers/RenderedObjectInfoLabeler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ namespace UnityEngine.Perception.GroundTruth
1515
[Serializable]
1616
public sealed class RenderedObjectInfoLabeler : CameraLabeler
1717
{
18+
///<inheritdoc/>
19+
public override string description
20+
{
21+
get => "Produces label id, instance id, and visible pixel count in a single metric each frame for each object which takes up one or more pixels in the camera's frame, based on this labeler's associated label configuration.";
22+
protected set {}
23+
}
24+
1825
// ReSharper disable InconsistentNaming
1926
struct RenderedObjectInfoValue
2027
{

com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ namespace UnityEngine.Perception.GroundTruth
2727
[Serializable]
2828
public sealed class SemanticSegmentationLabeler : CameraLabeler
2929
{
30+
///<inheritdoc/>
31+
public override string description
32+
{
33+
get => "Generates a semantic segmentation image for each captured frame. Each object is rendered to the semantic segmentation image using the color associated with it based on this labeler's associated semantic segmentation label configuration. " +
34+
"Semantic segmentation images are saved to the dataset in PNG format. " +
35+
"Please note that only one " + this.GetType().Name + " can render at once across all cameras.";
36+
protected set {}
37+
}
38+
3039
const string k_SemanticSegmentationDirectory = "SemanticSegmentation";
3140
const string k_SegmentationFilePrefix = "segmentation_";
3241

com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public class HUDPanel : MonoBehaviour
2525
const int k_BoxWidth = 200;
2626
const int k_YLineSpacing = 4;
2727

28+
29+
/// <summary>
30+
/// The number of labelers currently displaying real-time information on the visualization HUD
31+
/// </summary>
2832
public int entryCount => m_Entries.Keys.Count();
2933

3034
void Awake()

0 commit comments

Comments
 (0)