浏览代码

Merge pull request #118 from Unity-Technologies/report-annotation-result-fix-il2cpp

Report annotation result fix il2cpp
/main
GitHub 4 年前
当前提交
9be224dc
共有 2 个文件被更改,包括 19 次插入14 次删除
  1. 21
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  2. 12
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs

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


string m_OutputDirectoryPath;
JsonSerializer m_AnnotationSerializer;
public bool IsRunning { get; private set; }
public string OutputDirectory

m_AnnotationSerializer = JsonSerializer.CreateDefault();
m_AnnotationSerializer.Converters.Add(new Vector3Converter());
m_AnnotationSerializer.Converters.Add(new QuaternionConverter());
m_OutputDirectoryName = outputDirectory;
IsRunning = true;
}

{
var q = Quaternion.identity;
reader.Read(); // open [ token
q.x = (float)reader.ReadAsDecimal();
q.x = (float)reader.ReadAsDecimal();
q.y = (float)reader.ReadAsDecimal();
q.z = (float)reader.ReadAsDecimal();
q.w = (float)reader.ReadAsDecimal();

}
[SuppressMessage("ReSharper", "PossibleInvalidOperationException")]
public class Vector3Converter : JsonConverter<Vector3>
{

return outVector;
}
}
var jArray = values == null ? null : JArray.FromObject(values, m_AnnotationSerializer);
JArray jArray = null;
if (values != null)
{
jArray = new JArray();
foreach (var value in values)
{
if (value != null)
jArray.Add(new JRaw(DatasetJsonUtility.ToJToken(value)));
}
}
ReportAsyncAnnotationResult<T>(asyncAnnotation, filename, jArray);
}

12
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs


""annotation_definition"": <guid>,
""values"": [
{{
""a"": ""a string"",
""b"": 10
}},
""a"": ""a string"",
""b"": 10
}},
""a"": ""a second string"",
""b"": 20
}}
""a"": ""a second string"",
""b"": 20
}}
]
}}
]";

正在加载...
取消
保存