void NarrationGUI(TreeViewItem <VideoDataTreeElement> item) { GUILayout.Label("Narration item", EditorStyles.boldLabel); GUILayout.BeginVertical(); NamedLabel("Narration", item.data.name); NamedLabel("Occurences", item.data.display_occurences_count.ToString()); NamedLabel("Noun", item.data.display_noun); NamedLabel("Verb", item.data.display_verb); if (GUILayout.Button("Play all clips")) { VideoPlayerWindow.GetWindow <VideoPlayerWindow>().PlayClips(item.data.occurences); } GUILayout.EndVertical(); }
void ClipGUI(TreeViewItem <VideoDataTreeElement> item) { TrainActionLabel d = item.data.occurences[0]; GUILayout.Label("Clip item", EditorStyles.boldLabel); GUILayout.BeginVertical(); NamedLabel("Video id", d.video_id); NamedLabel("Narration", d.narration); NamedLabel("Start frame", d.start_frame.ToString()); NamedLabel("Stop frame", d.stop_frame.ToString()); NamedLabel("Duration", string.Format("{0:0.##} seconds", ((float)(d.stop_frame - d.start_frame) / 30f))); if (GUILayout.Button("Play Clip")) { VideoPlayerWindow.GetWindow <VideoPlayerWindow>().PlayClip(d); } GUILayout.EndVertical(); }
private void OpenVideo(object sender, MouseButtonEventArgs e) { if (VideoPlayerWindow == null) { VideoPlayerWindow = new VideoPlayerWindow(); VideoPlayerWindow.Owner = Application.Current.MainWindow; //VideoPlayerWindow.ShowTitleBar = false; VideoPlayerWindow.Closed += (x, y) => { VideoPlayerWindow = null; Application.Current.MainWindow.Show(); }; VideoPlayerWindow.Show(); Application.Current.MainWindow.Hide(); } }
void CellGUI(Rect cellRect, UnityEditor.TreeViewExamples.TreeViewItem <VideoDataTreeElement> item, MyColumns column, ref RowGUIArgs args) { // Center cell rect vertically (makes it easier to place controls, icons etc in the cells) CenterRectUsingSingleLineHeight(ref cellRect); switch (column) { case MyColumns.Narration: { args.rowRect = cellRect; base.RowGUI(args); } break; case MyColumns.Verb: { string value = item.data.display_verb; if (item.depth == 0 && showControls) { value = ""; } DefaultGUI.LabelRightAligned(cellRect, value, args.selected, args.focused); break; } case MyColumns.Noun: { string value = item.data.display_noun; if (item.depth == 0 && showControls) { value = ""; } DefaultGUI.LabelRightAligned(cellRect, value, args.selected, args.focused); break; } case MyColumns.Occurences: { int occurences = item.data.display_occurences_count; string value; if (occurences == -1) { TrainActionLabel v = item.data.occurences[0]; value = string.Format("{0:0.##} seconds", ((float)(v.stop_frame - v.start_frame) / 30f)); } else { value = occurences.ToString(); } DefaultGUI.LabelRightAligned(cellRect, value, args.selected, args.focused); } break; case MyColumns.PlayVideo: { if (item.depth == 2) { if (GUI.Button(cellRect, "Play")) { VideoPlayerWindow.GetWindow <VideoPlayerWindow>().PlayClip(item.data.occurences[0]); } } } break; } }