void AddParameterAutomation(string name) { serializedObject.Update(); if (!ParameterLinkExists(name)) { int slot = -1; for (int i = 0; i < AutomatableSlots.Count; ++i) { if (!parameterLinksProperty.ArrayContains("Slot", p => p.intValue == i)) { slot = i; break; } } if (slot >= 0) { DeleteInitialParameterValue(name); parameterLinksProperty.ArrayAdd(p => { p.FindPropertyRelative("Name").stringValue = name; p.FindPropertyRelative("Slot").intValue = slot; }); serializedObject.ApplyModifiedProperties(); RefreshMissingParameterLists(); RefreshTimelineEditor(); } } }
void AddInitialParameterValue(EditorParamRef editorParamRef) { serializedObject.Update(); if (!InitialParameterValueExists(editorParamRef.Name)) { DeleteParameterAutomation(editorParamRef.Name); parametersProperty.ArrayAdd(p => { p.FindPropertyRelative("Name").stringValue = editorParamRef.Name; p.FindPropertyRelative("Value").floatValue = editorParamRef.Default; }); serializedObject.ApplyModifiedProperties(); RefreshMissingParameterLists(); } }