您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

33 行
1.1 KiB

using System.IO;
using Newtonsoft.Json.Linq;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;
namespace UnityEditor.Perception.GroundTruth
{
[ScriptedImporter(1, "labelconfig")]
public class LabelingConfigurationImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
var text = File.ReadAllText(ctx.assetPath);
var jObject = JObject.Parse(text);
var config = ScriptableObject.CreateInstance<LabelingConfiguration>();
if (jObject["auto-assign-ids"].HasValues)
config.AutoAssignIds = jObject["auto-assign-ids"].Value<bool>();
if (jObject["starting-index"].HasValues)
{
var startingLabelId = (StartingLabelId)jObject["starting-index"].Value<int>();
config.StartingLabelId = startingLabelId;
}
if (jObject["configs"].HasValues)
{
}
ctx.SetMainObject(config);
}
}
}