浏览代码

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
/main
GitHub 4 年前
当前提交
38a180a6
共有 12 个文件被更改,包括 56 次插入12 次删除
  1. 2
      com.unity.perception/Editor/GroundTruth/CameraLabelerDrawer.cs
  2. 12
      com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
  3. 6
      com.unity.perception/Editor/Randomization/Uxml/ParameterConfiguration.uxml
  4. 4
      com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
  5. 7
      com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs
  6. 5
      com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs
  7. 7
      com.unity.perception/Runtime/GroundTruth/Labelers/ObjectCountLabeler.cs
  8. 7
      com.unity.perception/Runtime/GroundTruth/Labelers/RenderedObjectInfoLabeler.cs
  9. 9
      com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
  10. 4
      com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs
  11. 3
      com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs
  12. 2
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

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


enabledRect.x = rect.xMax - enabledSize.x;
enabledRect.width = enabledSize.x;
EditorGUI.LabelField(headerRect, $"{cameraLabeler.GetType().Name}", EditorStyles.boldLabel);
EditorGUI.LabelField(headerRect, new GUIContent($"{cameraLabeler.GetType().Name}", $"{cameraLabeler.description}"), EditorStyles.boldLabel);
EditorGUIUtility.labelWidth = enabledRect.width - 14;
m_Enabled.boolValue = EditorGUI.Toggle(enabledRect, Styles.enabled, m_Enabled.boolValue);
EditorGUIUtility.labelWidth = 0;

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


{
using(new EditorGUI.DisabledScope(EditorApplication.isPlaying))
{
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.description)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.period)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.startTime)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.showVisualizations)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.captureRgbImages)));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.description)), new GUIContent("Description", "Provide a description for this perception camera (optional)."));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.period)), new GUIContent("Capture Interval", "The interval at which the perception camera should render and capture (seconds)."));
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(perceptionCamera.startTime)), new GUIContent("Start Time","Time at which this perception camera starts rendering and capturing (seconds)."));
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."));
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."));
serializedObject.ApplyModifiedProperties();
//EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(PerceptionCamera.labelers)));

#if HDRP_PRESENT
var hdRenderPipelineAsset = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset as UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset;
if (hdRenderPipelineAsset != null &&
hdRenderPipelineAsset.currentPlatformRenderPipelineSettings.supportedLitShaderMode ==
hdRenderPipelineAsset.currentPlatformRenderPipelineSettings.supportedLitShaderMode ==
UnityEngine.Rendering.HighDefinition.RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly)
{
EditorGUILayout.HelpBox("Deferred Only shader mode is not supported by rendering-based labelers. " +

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


<UXML xmlns="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements">
<VisualElement>
<Style src="../Uss/Styles.uss"/>
<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."/>
<Label style="white-space: normal; margin-bottom: 2px; margin-top: 10px" text ="Search parameter names:"/>
<ScrollView name="parameter-scroll-view" class="dark-viewport" style="min-height: 100px; max-height: 600px;">
<Label style="white-space: normal; margin-bottom: 2px; margin-top: 10px" text ="Parameter list:"/>
<ScrollView name="parameter-scroll-view" class="dark-viewport" style="min-height: 100px; max-height: 600px; margin-top: 2px">
<VisualElement name="parameters-container" style="flex-shrink: 0;"/>
</ScrollView>

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


<UXML xmlns="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements">
<VisualElement>
<Style src="../Uss/Styles.uss"/>
<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."/>
<editor:PropertyField binding-path="constants"/>
<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."/>
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>
<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;"/>
<VisualElement style="flex-direction: row;">

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


[Serializable]
public sealed class BoundingBox2DLabeler : CameraLabeler
{
///<inheritdoc/>
public override string description
{
get => "Produces 2D bounding box annotations for all visible objects that bear a label defined in this labeler's associated label configuration.";
protected set {}
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
struct BoundingBoxValue

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


public abstract class CameraLabeler
{
/// <summary>
/// A human-readable description of the labeler
/// </summary>
public abstract string description { get; protected set; }
/// <summary>
/// Whether the CameraLabeler should be set up and called each frame.
/// </summary>
public bool enabled = true;

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


[Serializable]
public sealed class ObjectCountLabeler : CameraLabeler
{
///<inheritdoc/>
public override string description
{
get => "Produces object counts for each label defined in this labeler's associated label configuration.";
protected set {}
}
/// <summary>
/// The ID to use for object count annotations in the resulting dataset
/// </summary>

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


[Serializable]
public sealed class RenderedObjectInfoLabeler : CameraLabeler
{
///<inheritdoc/>
public override string description
{
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.";
protected set {}
}
// ReSharper disable InconsistentNaming
struct RenderedObjectInfoValue
{

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


[Serializable]
public sealed class SemanticSegmentationLabeler : CameraLabeler
{
///<inheritdoc/>
public override string description
{
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. " +
"Semantic segmentation images are saved to the dataset in PNG format. " +
"Please note that only one " + this.GetType().Name + " can render at once across all cameras.";
protected set {}
}
const string k_SemanticSegmentationDirectory = "SemanticSegmentation";
const string k_SegmentationFilePrefix = "segmentation_";

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


const int k_BoxWidth = 200;
const int k_YLineSpacing = 4;
/// <summary>
/// The number of labelers currently displaying real-time information on the visualization HUD
/// </summary>
public int entryCount => m_Entries.Keys.Count();
void Awake()

3
com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs


[FormerlySerializedAs("classes")]
public List<string> labels = new List<string>();
/// <summary>
/// The unique id of this labeling component instance
/// </summary>
public uint instanceId { get; private set; }
Entity m_Entity;

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


/// </summary>
public string description;
/// <summary>
/// The period in seconds that the Camera should render
/// The interval in seconds at which the camera should render and capture.
/// </summary>
public float period = .0166f;
/// <summary>

正在加载...
取消
保存