|
|
|
|
|
|
// 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; |
|
|
|