浏览代码

Deleting option now actually removes option from list

/main
Steven Leal 4 年前
当前提交
ec1aad35
共有 1 个文件被更改,包括 11 次插入4 次删除
  1. 15
      com.unity.perception/Editor/Randomization/ParameterElement.cs

15
com.unity.perception/Editor/Randomization/ParameterElement.cs


{
m_SerializedProperty.FindPropertyRelative("target.component").objectReferenceValue = null;
m_SerializedProperty.FindPropertyRelative("target.propertyName").stringValue = string.Empty;
m_SerializedProperty.FindPropertyRelative("target.applicationFrequency").enumValueIndex = 0;
m_SerializedProperty.serializedObject.ApplyModifiedProperties();
}

removeButton.clicked += () =>
{
probabilitiesProperty.DeleteArrayElementAtIndex(i);
// First delete sets option to null, second delete removes option
var numOptions = optionsProperty.arraySize;
if (numOptions == optionsProperty.arraySize)
optionsProperty.DeleteArrayElementAtIndex(i);
m_SerializedProperty.serializedObject.ApplyModifiedProperties();
listView.itemsSource = categoricalParameter.probabilities;
listView.Refresh();

else
listView.RemoveFromClassList("uniform-probability");
}
uniformToggle.RegisterCallback<ChangeEvent<bool>>(evt =>
{
ToggleProbabilityFields(evt.newValue);
});
if (Application.isPlaying)
uniformToggle.SetEnabled(false);
else
uniformToggle.RegisterCallback<ChangeEvent<bool>>(evt => ToggleProbabilityFields(evt.newValue));
var seedField = template.Q<IntegerField>("seed");
seedField.BindProperty(m_SerializedProperty.FindPropertyRelative("m_Sampler.<baseSeed>k__BackingField"));

正在加载...
取消
保存