浏览代码

Fixes for probabilities

/main
Steven Borkman 4 年前
当前提交
240a92ec
共有 1 个文件被更改,包括 21 次插入6 次删除
  1. 27
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs

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


// First delete sets option to null, second delete removes option
var numOptions = optionsProperty.arraySize;
optionsProperty.DeleteArrayElementAtIndex(i);
{
}
ResetProbabilities();
void ResetProbabilities()
{
var uniformProbability = probabilitiesProperty.arraySize > 0 ? 1f / probabilitiesProperty.arraySize : 0;
for (var i = 0; i < probabilitiesProperty.arraySize; i++)
{
probabilitiesProperty.GetArrayElementAtIndex(i).floatValue = uniformProbability;
}
}
listView.bindItem = BindItem;
var addOptionButton = template.Q<Button>("add-option");

break;
}
ResetProbabilities();
m_SerializedProperty.serializedObject.ApplyModifiedProperties();
listView.itemsSource = categoricalParameter.probabilities;
listView.Refresh();

return;
var categories = LoadAssetsFromFolder(folderPath, categoricalParameter.sampleType);
var probabilityIndex = probabilitiesProperty.arraySize;
probabilitiesProperty.arraySize += categories.Count;
var uniformProbability = 1f / categories.Count;
probabilitiesProperty.arraySize += categories.Count;
var probabilityProperty = probabilitiesProperty.GetArrayElementAtIndex(probabilityIndex + i);
probabilityProperty.floatValue = uniformProbability;
ResetProbabilities();
m_SerializedProperty.serializedObject.ApplyModifiedProperties();
listView.itemsSource = categoricalParameter.probabilities;

正在加载...
取消
保存