public List <string> CreateTrackText(PureDataSequence sequence, PureDataSequenceTrack track) { List <string> trackText = new List <string>(); trackText.Add("#N canvas 43 653 311 113 utrack 0;"); trackText.Add("#X obj 23 65 outlet~ left;"); trackText.Add("#X obj 103 65 outlet~ right;"); trackText.Add(string.Format("#X obj 23 44 ../../{0};", HelperFunctions.GetPathWithoutExtension(track.instrumentPatchPath))); trackText.Add(string.Format("#X obj 23 24 usequencemessager {0} {1};", sequence.Id, track.Id)); trackText.Add("#X connect 2 0 0 0;"); trackText.Add("#X connect 2 1 1 0;"); trackText.Add("#X connect 3 0 2 0;"); trackText.Add("#X connect 3 1 2 1;"); trackText.Add(string.Format("#X restore 21 99 pd utrack {0};", track.Name)); return(trackText); }
void ShowTracks() { Separator(); GUILayout.Space(10); Rect rect = EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" "); // Add Tracks Button EditorGUI.BeginDisabledGroup(Application.isPlaying); GUIStyle style = new GUIStyle("PreButton"); style.clipping = TextClipping.Overflow; style.contentOffset = new Vector2(-2, -1); style.fontSize = 10; rect = EditorGUI.IndentedRect(rect); rect.width = 86; rect.height = 16; if (GUI.Button(new Rect(rect.x + 1, rect.y - 1, rect.width - 1, rect.height), "Add Track", style) || tracksProperty.arraySize == 0) { AddTrack(); } EditorGUI.EndDisabledGroup(); // Step Buttons GUI.Box(new Rect(rect.x + 84, rect.y - 1, stepsProperty.arraySize * 18, 18), "", new GUIStyle("ColorPickerBox")); rect.x += rect.width; rect.width = 16; for (int i = 0; i < stepsProperty.arraySize; i++) { GUI.Box(new Rect(rect.x - 1, rect.y, 18, tracksProperty.arraySize * 18 + 23), "", new GUIStyle("ColorPickerBox")); if (GUI.Button(rect, "", GetSequenceStepStyle(i))) { currentSequenceSelection.SetStep(i); } // Reorder Handles EditorGUI.BeginDisabledGroup(Application.isPlaying); Rect handleRect = new Rect(rect.x + 11, rect.y - 11, -7, 8); Reorderable(stepsProperty, i, true, new Rect(handleRect.x - 12, handleRect.y - 4, Mathf.Abs(handleRect.width) + 10, handleRect.height + 6), OnStepReorder); GUI.Label(handleRect, "", new GUIStyle("ColorPickerVertThumb")); EditorGUI.EndDisabledGroup(); rect.x += rect.width + 2; } EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField(GUIContent.none, new GUIStyle("RL DragHandle"), GUILayout.Height(4), GUILayout.Width(86 + 18 * stepsProperty.arraySize + 29)); for (int i = 0; i < tracksProperty.arraySize; i++) { currentTrack = currentSequence.tracks[i]; currentTrackIndex = i; currentTrackProperty = tracksProperty.GetArrayElementAtIndex(i); ShowTrack(); } // Add Steps Button EditorGUI.BeginDisabledGroup(Application.isPlaying); style = new GUIStyle("buttonRight"); style.fontStyle = FontStyle.Bold; style.clipping = TextClipping.Overflow; style.contentOffset = new Vector2(-1, 0); style.fontSize = 19; if (GUI.Button(new Rect(rect.x, rect.y - 1, 16, tracksProperty.arraySize * 18 + 25), "+", style) || stepsProperty.arraySize == 0) { AddStep(); } EditorGUI.EndDisabledGroup(); ShowSelectedTrackDetails(); ShowSelectedStepDetails(); }