浏览代码

Code formatting

/format
Jon Hogins 5 年前
当前提交
664c2450
共有 40 个文件被更改,包括 171 次插入87 次删除
  1. 2
      com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs
  2. 2
      com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs
  3. 2
      com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs
  4. 2
      com.unity.perception/Editor/GroundTruth/LabelingEditor.cs
  5. 2
      com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs
  6. 2
      com.unity.perception/Editor/GroundTruth/SemanticSegmentationPassEditor.cs
  7. 2
      com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs
  8. 4
      com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs
  9. 2
      com.unity.perception/Runtime/GroundTruth/Ego.cs
  10. 6
      com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs
  11. 2
      com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs
  12. 7
      com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs
  13. 4
      com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs
  14. 2
      com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs
  15. 4
      com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs
  16. 2
      com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs
  17. 2
      com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs
  18. 4
      com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs
  19. 7
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  20. 2
      com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs
  21. 2
      com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs
  22. 2
      com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs
  23. 2
      com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs
  24. 2
      com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs
  25. 2
      com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs
  26. 15
      com.unity.perception/Runtime/GroundTruth/SimulationManager.cs
  27. 7
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  28. 4
      com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs
  29. 9
      com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs
  30. 2
      com.unity.perception/Tests/Editor/PerceptionCameraEditorTests.cs
  31. 6
      com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs
  32. 2
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs
  33. 2
      com.unity.perception/Tests/Runtime/GroundTruthTests/GroundTruthTestBase.cs
  34. 4
      com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs
  35. 2
      com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs
  36. 5
      com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs
  37. 21
      com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerSensorSchedulingTests.cs
  38. 29
      com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs
  39. 4
      com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs
  40. 74
      .editorconfig

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using System;
using System.Collections.Generic;

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using UnityEditor.Rendering.HighDefinition;
using UnityEngine.Perception.GroundTruth;

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


using UnityEditorInternal;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;

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


using UnityEditorInternal;
using UnityEditorInternal;
using UnityEngine;
namespace UnityEditor.Perception.GroundTruth

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using System;
using UnityEditor.Rendering.HighDefinition;

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using System;
using UnityEditor.Rendering.HighDefinition;

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


using System;
using System;
namespace UnityEngine.Perception.GroundTruth
{

4
com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs


obj.Add(value.z);
return obj;
}
public static JToken ToJToken(Quaternion value)
{
var obj = new JArray();

obj.Add(value.w);
return obj;
}
public static JToken ToJToken(float3x3 value)
{
var obj = new JArray();

return obj;
}
public static JToken ToJToken(float3 value)
{
var obj = new JArray();

return obj;
}
public static JToken ToJToken<T>(T value)
{
switch (value)

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


using System;
using System;
using UnityEngine;
namespace UnityEngine.Perception.GroundTruth

6
com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs


using System;
using System;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Experimental.Rendering;

labelSetupSystem?.Deactivate(this);
}
protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask/*, PerObjectData perObjectData*/)
protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask /*, PerObjectData perObjectData*/)
{
var shaderPasses = new[]
{

};
return result;
}
public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList)
{

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


using Unity.Entities;
using Unity.Entities;
namespace UnityEngine.Perception.GroundTruth
{

7
com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs


using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading;
using Unity.Entities;

protected override void OnCreate()
{
//These are here to inform the system runner the queries we are interested in. Without these calls, OnUpdate() might not be called
GetEntityQuery( ComponentType.Exclude<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
GetEntityQuery( ComponentType.ReadOnly<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
GetEntityQuery(ComponentType.Exclude<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
GetEntityQuery(ComponentType.ReadOnly<GroundTruthInfo>(), ComponentType.ReadOnly<Labeling>());
}
/// <inheritdoc/>

var gameObject = labeling.gameObject;
InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, info.instanceId);
});
}
/// <summary>

4
com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs


#if URP_PRESENT
#if URP_PRESENT
using System;
using UnityEditor;
using UnityEngine;

public class GroundTruthRendererFeature : ScriptableRendererFeature
{
public override void Create() { }
public override void Create() {}
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{

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


using UnityEngine;
using UnityEngine;
namespace UnityEngine.Perception.GroundTruth
{

4
com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs


using System;
using System;
using System.Collections.Generic;
using Unity.Profiling;
using UnityEngine;

/// <param name="targetCamera"></param>
/// <exception cref="ArgumentNullException"></exception>
public InstanceSegmentationCrossPipelinePass(Camera targetCamera)
:base(targetCamera)
: base(targetCamera)
{
if (targetCamera == null)
throw new ArgumentNullException(nameof(targetCamera));

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using System;
using JetBrains.Annotations;

2
com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs


using System;
using System;
using System.Collections.Generic;
namespace UnityEngine.Perception.GroundTruth

4
com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs


#if HDRP_PRESENT
#if HDRP_PRESENT
using Unity.Collections.LowLevel.Unsafe;
using System;

m_InstanceIdToClassIdLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory);
}
m_IdBuffersNeedUpdating = true;
m_InstanceIdToClassIdLookup[(int) instanceId] = index + 1;
m_InstanceIdToClassIdLookup[(int)instanceId] = index + 1;
}
}

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


using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;

/// </summary>
public event Action<int, NativeArray<RenderedObjectInfo>> renderedObjectInfosCalculated;
internal event Action<int,NativeArray<uint>> segmentationImageReceived;
internal event Action<int, NativeArray<uint>> segmentationImageReceived;
internal event Action<NativeSlice<uint>, IReadOnlyList<LabelingConfigurationEntry>, int> classCountsReceived;

if (produceSegmentationImages)
customPassVolume.customPasses.Add(m_SemanticSegmentationPass);
}
#endif
void ProduceBoundingBoxesAnnotation(NativeArray<RenderedObjectInfo> renderedObjectInfos, List<LabelingConfigurationEntry> labelingConfigurations, int frameCount)

{
var stride = dataColorBuffer.Length / height;
var buffer = new NativeArray<byte>(stride, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
fixed (byte* colorBufferPtr = &dataColorBuffer[0])
fixed(byte* colorBufferPtr = &dataColorBuffer[0])
{
var unsafePtr = (byte*)buffer.GetUnsafePtr();
for (var row = 0; row < height / 2; row++)

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


using System;
using System;
using System.Linq;
using Unity.Collections;
using Unity.Simulation;

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


using System;
using System;
// ReSharper disable NonReadonlyMemberInGetHashCode
namespace UnityEngine.Perception.GroundTruth

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


using System;
using System;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;

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


using System;
using System;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;

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


#if HDRP_PRESENT
#if HDRP_PRESENT
using System;
using UnityEngine.Rendering;

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


using System;
using System;
using Unity.Entities;
namespace UnityEngine.Perception.GroundTruth

15
com.unity.perception/Runtime/GroundTruth/SimulationManager.cs


using System;
using System;
using JetBrains.Annotations;
using Newtonsoft.Json.Linq;
using Unity.Simulation;

/// <param name="sensorSpatialData">Spatial data describing the sensor and the ego containing it.</param>
/// <param name="additionalSensorValues">Additional values to be emitted as json name/value pairs on the sensor object under the capture.</param>
/// <exception cref="InvalidOperationException">Thrown if ReportCapture is being called when ShouldCaptureThisFrame is false or it has already been called this frame.</exception>
public void ReportCapture(string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues)
public void ReportCapture(string filename, SensorSpatialData sensorSpatialData, params(string, object)[] additionalSensorValues)
{
if (!ShouldCaptureThisFrame)
{

/// <param name="left">The first SensorHandle.</param>
/// <param name="right">The second SensorHandle.</param>
/// <returns>Returns true if the two SensorHandles refer to the same sensor.</returns>
public static bool operator ==(SensorHandle left, SensorHandle right)
public static bool operator==(SensorHandle left, SensorHandle right)
{
return left.Equals(right);
}

/// <param name="left">The first SensorHandle.</param>
/// <param name="right">The second SensorHandle.</param>
/// <returns>Returns false if the two SensorHandles refer to the same sensor.</returns>
public static bool operator !=(SensorHandle left, SensorHandle right)
public static bool operator!=(SensorHandle left, SensorHandle right)
{
return !left.Equals(right);
}

/// <param name="left">The first EgoHandle.</param>
/// <param name="right">The second EgoHandle.</param>
/// <returns>Returns true if the two EgoHandles refer to the same ego.</returns>
public static bool operator ==(EgoHandle left, EgoHandle right)
public static bool operator==(EgoHandle left, EgoHandle right)
/// <summary>
/// Compares two <see cref="EgoHandle"/> instances for inequality.

/// <returns>Returns true if the two EgoHandles refer to the same ego.</returns>
public static bool operator !=(EgoHandle left, EgoHandle right)
public static bool operator!=(EgoHandle left, EgoHandle right)
{
return !left.Equals(right);
}

{
Id = id;
}
/// <inheritdoc />
public bool Equals(MetricDefinition other)
{

return sensorSpatialData;
}
}
}

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


public float Timestamp;
public Guid SequenceId;
public (string, object)[] AdditionalSensorValues;
public List<(Annotation, AnnotationData )> Annotations = new List<(Annotation, AnnotationData)>();
public List<(Annotation, AnnotationData)> Annotations = new List<(Annotation, AnnotationData)>();
public bool CaptureReported;
public PendingCapture(Guid id, SensorHandle sensorHandle, SensorData sensorData, Guid sequenceId, int frameCount, int step, float timestamp)

}
}
internal void ReportCapture(SensorHandle sensorHandle, string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues)
internal void ReportCapture(SensorHandle sensorHandle, string filename, SensorSpatialData sensorSpatialData, params(string, object)[] additionalSensorValues)
{
var sensorData = m_Sensors[sensorHandle];
var pendingCapture = GetOrCreatePendingCaptureForThisFrame(sensorHandle, out _);

do
{
sensorData.sequenceTimeNextCapture += sensorData.period;
} while (sensorData.sequenceTimeNextCapture <= UnscaledSequenceTime);
}
while (sensorData.sequenceTimeNextCapture <= UnscaledSequenceTime);
sensorData.lastCaptureFrameCount = Time.frameCount;
m_Sensors[activeSensor] = sensorData;

4
com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs


using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;

if (pendingCapture.AdditionalSensorValues != null)
{
foreach (var (name, value) in pendingCapture.AdditionalSensorValues)
foreach (var(name, value) in pendingCapture.AdditionalSensorValues)
sensorJObject.Add(name, DatasetJsonUtility.ToJToken(value));
}

9
com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs


}
else if (targetPath.EndsWith(".unity"))
if (targetPath.EndsWith(".unity"))
{
Debug.Log("Scenes Path : " + targetPath);
{
Debug.Log("Scenes Path : " + targetPath);
m_EditorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true));
}
m_EditorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true));
}
}
EditorBuildSettings.scenes = m_EditorBuildSettingsScenes.ToArray();
}

}
}
}

2
com.unity.perception/Tests/Editor/PerceptionCameraEditorTests.cs


using System;
using System;
using System.Collections;
using System.IO;
using NUnit.Framework;

6
com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs


using System;
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;

}, new uint[]
{
1,
0
0
},
2,
BoundingBoxOrigin.BottomLeft,

}
[UnityTest]
public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))]ProducesCorrectBoundingBoxesData producesCorrectBoundingBoxesData)
public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))] ProducesCorrectBoundingBoxesData producesCorrectBoundingBoxesData)
{
var label = "label";
var label2 = "label2";

2
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs


var jsonActual = DatasetJsonUtility.ToJToken(new Vector3(x, y, z));
Assert.AreEqual(jsonExpected, jsonActual.ToString());
}
[Test]
[TestCase(-2f, 0f, 3f, 4f, @"[
-2.0,

var jsonActual = DatasetJsonUtility.ToJToken(new Quaternion(x, y, z, w)).ToString();
Assert.AreEqual(jsonExpected, jsonActual);
}
[Test]
[TestCase(0.1f, 0.2f, 0.3f, 4f, 5f, 6f, 70f, 80f, 90f, @"[
[

2
com.unity.perception/Tests/Runtime/GroundTruthTests/GroundTruthTestBase.cs


using System;
using System;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

4
com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs


using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

//TestHelper.LoadAndStartRenderDocCapture(out EditorWindow gameView);
var startFrameCount = Time.frameCount;
var expectedFramesAndCounts= new Dictionary<int, int>()
var expectedFramesAndCounts = new Dictionary<int, int>()
{
{Time.frameCount , 0},
{startFrameCount + 1, 1},

2
com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs


using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

5
com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs


using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

//Put a plane in front of the camera
var planeObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0) );
planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0));
planeObject.transform.localScale = new Vector3(10, -1, 10);
planeObject.AddComponent<Labeling>();
AddTestObjectForCleanup(planeObject);

Assert.AreEqual(4, timesSegmentationImageReceived);
}
[UnityTest]
public IEnumerator SegmentationPassProducesCorrectValuesEachFrame()
{

21
com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerSensorSchedulingTests.cs


using System.Collections;
using System.Collections;
using System.Text.RegularExpressions;
using NUnit.Framework;
using UnityEngine;

var period = .4f;
SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime);
float[] deltaTimeSamplesExpected = {
float[] deltaTimeSamplesExpected =
{
firstCaptureTime,
period,
period,

Time.timeScale = timeScale;
SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime);
float[] deltaTimeSamplesExpected = {
float[] deltaTimeSamplesExpected =
{
timeScale * firstCaptureTime,
timeScale * period,
timeScale * period,

var ego = SimulationManager.RegisterEgo("ego");
var firstCaptureTime = 2f;
var period = 1f;
float[] newTimeScalesPerFrame = {
float[] newTimeScalesPerFrame =
{
2f,
10f,
.01f,

float[] deltaTimeSamplesExpected = {
float[] deltaTimeSamplesExpected =
{
newTimeScalesPerFrame[0] * firstCaptureTime,
newTimeScalesPerFrame[1] * period,
newTimeScalesPerFrame[2] * period,

var sensor3 = SimulationManager.RegisterSensor(ego, "cam", "3", 1, 1);
sensor3.Enabled = false;
(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[] samplesExpected = {
(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[] samplesExpected =
{
((float)firstCaptureTime1, true, true),
(4, true, false),
(2, false, true),

var samplesActual = new (float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[samplesExpected.Length];
var samplesActual = new(float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[samplesExpected.Length];
for (int i = 0; i < samplesActual.Length; i++)
{
yield return null;

[Test]
public void Enabled_StartsTrue()
{
var sensor1 = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "cam", "1", 1,1);
var sensor1 = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "cam", "1", 1, 1);
Assert.IsTrue(sensor1.Enabled);
}
}

29
com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs


using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;

[UnityTest]
public IEnumerator StartNewSequence_ProperlyIncrementsSequence()
{
var timingsExpected = new (int step, int timestamp, bool expectNewSequence)[]
var timingsExpected = new(int step, int timestamp, bool expectNewSequence)[]
{
(0, 0, true),
(1, 2, false),

var filename = "my/file.png";
var annotationDefinitionGuid = Guid.NewGuid();
var annotationDefinitionsJsonExpected=
var annotationDefinitionsJsonExpected =
$@"{{
""version"": ""{SimulationManager.SchemaVersion}"",
""annotation_definitions"": [

}}
]
}}";
var annotationsJsonExpected=
var annotationsJsonExpected =
$@" ""annotations"": [
{{
""id"": <guid>,

var ego = SimulationManager.RegisterEgo("");
var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationFile(annotationDefinition, ""));
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationFile(annotationDefinition, ""));
}
[Test]

var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationValues(annotationDefinition, new int[0]));
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationValues(annotationDefinition, new int[0]));
}
[Test]

var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("");
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportAnnotationAsync(annotationDefinition));
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportAnnotationAsync(annotationDefinition));
}
[Test]

FileAssert.Exists(capturesPath);
StringAssert.Contains(expectedAnnotation, EscapeGuids(File.ReadAllText(capturesPath)));
}
public struct TestValues
{

{
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var annotationDefinitionsJsonExpected=
var annotationDefinitionsJsonExpected =
$@"{{
""version"": ""{SimulationManager.SchemaVersion}"",
""annotation_definitions"": [

{
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var annotationDefinitionsJsonExpected=
var annotationDefinitionsJsonExpected =
$@"{{
""version"": ""{SimulationManager.SchemaVersion}"",
""annotation_definitions"": [

var ego = SimulationManager.RegisterEgo("");
var metricDefinition = SimulationManager.RegisterMetricDefinition("");
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportMetric(metricDefinition, new int[0]));
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportMetric(metricDefinition, new int[0]));
}
[Test]

var metricDefinition = SimulationManager.RegisterMetricDefinition("");
var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100);
Assert.Throws<InvalidOperationException>(()=>sensorHandle.ReportMetricAsync(metricDefinition));
Assert.Throws<InvalidOperationException>(() => sensorHandle.ReportMetricAsync(metricDefinition));
}
[Test]

{
var metricDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var metricDefinitionsJsonExpected=
var metricDefinitionsJsonExpected =
$@"{{
""version"": ""{SimulationManager.SchemaVersion}"",
""metric_definitions"": [

public void CreateAnnotationOrMetric_WithSpecValues_WritesProperTypes(
[Values(AdditionalInfoKind.Annotation, AdditionalInfoKind.Metric)] AdditionalInfoKind additionalInfoKind)
{
var specValues = new []
var specValues = new[]
{
new TestSpec
{

jsonContainerName = "metric_definitions";
}
var annotationDefinitionsJsonExpected=
var annotationDefinitionsJsonExpected =
$@"{{
""version"": ""{SimulationManager.SchemaVersion}"",
""{jsonContainerName}"": [

4
com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs


using System;
using System;
using UnityEngine;
namespace GroundTruthTests

labeling.labels.Add(label);
return planeObject;
}
#if UNITY_EDITOR
public static void LoadAndStartRenderDocCapture(out UnityEditor.EditorWindow gameView)
{

gameView = UnityEditor.EditorWindow.GetWindow(type);
UnityEditorInternal.RenderDoc.BeginCaptureRenderDoc(gameView);
}
#endif
}
}

74
.editorconfig


; see http://editorconfig.org/ for docs on this file
root = true
[*]
ignore_if_in_header = This code was generated by a tool|<auto-generated>
indent_style = space
indent_size = 4
; uncomment to help with sharing files across os's (i.e. network share or through local vm)
#end_of_line = lf
; avoid a bom, which causes endless problems with naive text tooling
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
; keeping auto-format enabled helps avoid merge hell for projects without CI-based format validation
#disable_auto_format = true
[*.cs]
; uncomment to enable full formatting of c# files
formatters = generic, uncrustify
[*.asmdef]
scrape_api = true
[**/Tests/**.asmdef]
scrape_api = false
[*.Tests.asmdef]
scrape_api = false
[*.md]
indent_size = 2
; trailing whitespace is unfortunately significant in markdown
trim_trailing_whitespace = false
; uncomment to enable basic formatting of markdown files
#formatters = generic
[{Makefile,makefile}]
; tab characters are part of the Makefile format
indent_style = tab
[*.asmdef]
indent_size = 4
[*.json]
indent_size = 2
[*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}]
end_of_line = crlf
; this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited.
; the settings are meant to closely match what VS does to minimize unnecessary diffs.
[*.{vcxproj,vcxproj.filters}]
indent_style = space
indent_size = 2
end_of_line = crlf
charset = utf-8-bom
trim_trailing_whitespace = true
insert_final_newline = false
; must be broken out because of 51-char bug (https://github.com/editorconfig/editorconfig-visualstudio/issues/21)
[*.{csproj,pyproj,props,targets}]
indent_style = space
indent_size = 2
end_of_line = crlf
charset = utf-8-bom
trim_trailing_whitespace = true
insert_final_newline = false
[*.{sln,sln.template}]
indent_style = tab
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
正在加载...
取消
保存