浏览代码

Merge pull request #13 from Unity-Technologies/logdatadirectory

Fixes and UX to help users find local datasets
/main
GitHub 5 年前
当前提交
96c0d411
共有 7 个文件被更改,包括 50 次插入9 次删除
  1. 5
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  2. 11
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  3. 1
      com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs
  4. 7
      com.unity.perception/LICENSE.md.meta
  5. 25
      com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs
  6. 3
      com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs.meta
  7. 7
      com.unity.perception/LICENSE.meta

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


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

//Based on logic in HDRenderPipeline.PrepareFinalBlitParameters
return camera.targetTexture != null || hdAdditionalCameraData.flipYMode == HDAdditionalCameraData.FlipYMode.ForceFlipY || camera.cameraType == CameraType.Game;
#elif URP_PRESENT
return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 && (camera.targetTexture != null || camera.cameraType == CameraType.Game);
return (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal) &&
(camera.targetTexture != null || camera.cameraType == CameraType.Game);
#else
return false;
#endif

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


public void AddEgo(EgoHandle egoHandle)
{
CheckDatasetAllowed();
public bool IsEnabled(SensorHandle sensorHandle) => m_ActiveSensors.Contains(sensorHandle);

m_ActiveSensors.Remove(sensorHandle);
else
m_ActiveSensors.Add(sensorHandle);
}
void CheckDatasetAllowed()
{
if (!Application.isPlaying)
{
throw new InvalidOperationException("Dataset generation is only supported in play mode.");
}
}
public void Update()

void RegisterAdditionalInfoType<TSpec>(string name, TSpec[] specValues, string description, string format, Guid id, AdditionalInfoKind additionalInfoKind)
{
CheckDatasetAllowed();
var annotationDefinitionInfo = new AdditionalInfoTypeData()
{
additionalInfoKind = additionalInfoKind,

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


WriteJObjectToFile(metricDefinitionsJObject, "metric_definitions.json");
}
}
Debug.Log($"Dataset written to {Path.GetDirectoryName(OutputDirectory)}");
}
void WriteJObjectToFile(JObject jObject, string filename)

7
com.unity.perception/LICENSE.md.meta


fileFormatVersion: 2
guid: 4396a357bb154764ba0cbeb2e508fba9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

25
com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs


using System;
using NUnit.Framework;
using UnityEngine.Perception.GroundTruth;
namespace GroundTruth
{
public class SimulationManagerEditorTests
{
[Test]
public void RegisterEgo_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterEgo(""));
}
[Test]
public void RegisterAnnotationDefinition_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterAnnotationDefinition(""));
}
[Test]
public void RegisterMetricDefinition_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterMetricDefinition(""));
}
}
}

3
com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs.meta


fileFormatVersion: 2
guid: d5f343d2138c4cba865d1094f6b80bff
timeCreated: 1589923850

7
com.unity.perception/LICENSE.meta


fileFormatVersion: 2
guid: 1011799e246cfca4085ea04ca29c9ab0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存