private static TrackAsset GetTrack(TreeViewItem item) { TimelineTrackBaseGUI baseGui = item as TimelineTrackBaseGUI; if (baseGui == null) return null; return baseGui.track; }
public static void AddMenuItems(GenericMenu menu, GroupTrack track) { TimelineWindow.TimelineState state = TimelineWindow.instance.state; TrackType[] array = TimelineHelpers.GetMixableTypes(); array = (from x in array orderby(!x.trackType.Assembly.FullName.Contains("UnityEngine.Sequence")) ? 1 : 0 select x).ToArray <TrackType>(); TrackType[] array2 = array; for (int i = 0; i < array2.Length; i++) { TrackType trackType = array2[i]; if (trackType.trackType != typeof(GroupTrack)) { GenericMenu.MenuFunction2 menuFunction = delegate(object e) { track.SetCollapsed(false); state.GetWindow().AddTrack((e as TrackType).trackType, track, null); TimelineTrackBaseGUI timelineTrackBaseGUI = TimelineTrackBaseGUI.FindGUITrack(track); if (timelineTrackBaseGUI != null) { TimelineWindow.instance.treeView.data.SetExpanded(timelineTrackBaseGUI, true); } }; object obj = trackType; string text = TimelineHelpers.GetTrackCategoryName(trackType); if (!string.IsNullOrEmpty(text)) { text += "/"; } menu.AddItem(new GUIContent("Add " + text + TimelineHelpers.GetTrackMenuName(trackType)), false, menuFunction, obj); } } }
private static TrackAsset GetTrack(TreeViewItem item) { TimelineTrackBaseGUI baseGui = item as TimelineTrackBaseGUI; if (baseGui == null) { return(null); } return(baseGui.track); }
public override bool CanStartDrag(TreeViewItem targetItem, List <int> draggedItemIDs, Vector2 mouseDownPosition) { bool result; if (Event.get_current().get_modifiers() != null) { result = false; } else if (this.m_Window.state.isDragging) { result = false; } else { TimelineTrackBaseGUI timelineTrackBaseGUI = targetItem as TimelineTrackBaseGUI; result = (timelineTrackBaseGUI != null && !(timelineTrackBaseGUI.track == null) && !timelineTrackBaseGUI.track.locked && (Event.get_current().get_type() != 3 || Mathf.Abs(Event.get_current().get_delta().y) >= (float)this.kDragSensitivity)); } return(result); }
protected float GetChildrenHeight(TreeViewItem item) { float num = 0f; TimelineTrackBaseGUI timelineTrackBaseGUI = item as TimelineTrackBaseGUI; bool flag = timelineTrackBaseGUI != null && timelineTrackBaseGUI.track.GetCollapsed(); if (item.get_children() != null && !flag) { IList <TreeViewItem> rows = this.treeView.get_data().GetRows(); for (int num2 = 0; num2 != item.get_children().Count; num2++) { TreeViewItem treeViewItem = item.get_children()[num2]; if (this.treeView.get_data().IsRevealed(treeViewItem.get_id())) { int num3 = rows.IndexOf(treeViewItem); if (num3 >= 0) { num += this.m_TreeViewGUI.GetRowRect(num3).get_height(); TimelineGroupGUI timelineGroupGUI = treeViewItem as TimelineGroupGUI; if (timelineGroupGUI != null) { if (timelineGroupGUI.track != null) { TrackAsset trackAsset = timelineGroupGUI.track.parent as TrackAsset; if (trackAsset != null) { num += 3f; } } } } } num += this.GetChildrenHeight(treeViewItem); } } return(num); }
private static void AddVisibleTrackRecursive(ref List <TimelineTrackBaseGUI> list, TimelineTrackBaseGUI track) { if (track != null) { list.Add(track); if (track.isExpanded) { if (track.get_children() != null) { foreach (TreeViewItem current in track.get_children()) { TimelineTreeViewGUI.AddVisibleTrackRecursive(ref list, current as TimelineTrackBaseGUI); } } } } }