浏览代码

Some tag manager updates

/fod_generator_randomization_changes
Steven Borkman 4 年前
当前提交
2097428d
共有 3 个文件被更改,包括 15 次插入5 次删除
  1. 9
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs
  2. 9
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerTag.cs
  3. 2
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerTagManager.cs

9
com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs


if (folderPath == string.Empty)
return;
var categories = LoadAssetsFromFolder(folderPath, categoricalParameter.sampleType);
var probabilityIndex = probabilitiesProperty.arraySize;
var optionsIndex = optionsProperty.arraySize;
var optionProperty = optionsProperty.GetArrayElementAtIndex(i);
var probabilityProperty = probabilitiesProperty.GetArrayElementAtIndex(i);
var optionProperty = optionsProperty.GetArrayElementAtIndex(optionsIndex + i);
var probabilityProperty = probabilitiesProperty.GetArrayElementAtIndex(probabilityIndex + i);
optionProperty.objectReferenceValue = categories[i];
probabilityProperty.floatValue = uniformProbability;
}

9
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerTag.cs


{
RandomizerTagManager tagManager => RandomizerTagManager.singleton;
void Awake()
void OnDestroy()
{
tagManager.RemoveTag(this);
}
protected virtual void OnEnable()
void OnDestroy()
protected virtual void OnDisable()
{
tagManager.RemoveTag(this);
}

2
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerTagManager.cs


internal void RemoveTag<T>(T tag) where T : RandomizerTag
{
var tagType = typeof(T);
var tagType = tag.GetType();
if (m_TagMap.ContainsKey(tagType) && m_TagMap[tagType].Contains(tag))
m_TagMap[tagType].Remove(tag);
}
正在加载...
取消
保存