PO/Library/Artifacts/33/33bbb54398da44d0490520f9816...

410 lines
18 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>G<>2019.4.19f1<00><><EFBFBD><EFBFBD> <00><>f<EFBFBD><66>!<21>5<>9<EFBFBD>4Q<0E><>B<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> E<00> <00><00>#<00>.<00>,<00>5a<00> <00><00>#<00>.<00>,<00><00><00>r<00> <00><00># <00>.<00>,
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00><00><00>J<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>\<00><00><><EFBFBD><EFBFBD><EFBFBD><00>H<00>r<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>w<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#!<00>.<00>,"<00><00><><00><><EFBFBD><EFBFBD>#@1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$<00><00><00>%.<00>j<00>&<00><00><><00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD>+<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>,@<00><00><00>-Q<00>j<00>.y<00>
<00> /<00><00>#0<00>.<00>,1<00> <00><>2@<00><00><> 3@<00><00>#4<00>.<00>,5<00>H<00><><00><><EFBFBD><EFBFBD>6<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>7@<00><00><00>8Q<00>j<00>9H<00><><00><><EFBFBD><EFBFBD>:<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>;@<00><00><00><Q<00>j<00>=H<00><><00><><EFBFBD><EFBFBD>><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>?@<00><00><00>@Q<00>j<00>AMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>G<EFBFBD><47>܏Z56<35>:!@i<>J*<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00>E<00> <00><00><00>.<00><00>(a<00> <00><00><00>.<00><00><00><00>r<00> <00><00> <00>.<00>
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>=<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00><00>.<00><00>y<00>Q <00><00><00>.<00> <00><00><00>X!H<00>i<00><><EFBFBD><EFBFBD>"<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>#@<00><00><00>$Q<00>j<00>%H<00>u<00><><EFBFBD><EFBFBD>&<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>'@<00><00><00>(Q<00>j<00>)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\<00>y<EFBFBD>` 7<00>y<EFBFBD>TimelineKeyboardNavigation<00>6using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.IMGUI.Controls;
using UnityEngine.Timeline;
namespace UnityEditor.Timeline
{
static class KeyboardNavigation
{
public static void FrameTrackHeader(TreeViewItem treeItem = null)
{
if (TrackHeadActive())
treeItem = treeItem ?? SelectionManager.SelectedTrackGUI().Last();
else
{
var item = GetVisibleSelectedItems().LastOrDefault();
treeItem = TimelineWindow.instance.allTracks.FirstOrDefault(
x => item != null && x.track == item.parentTrack);
}
if (treeItem != null)
TimelineWindow.instance.treeView.FrameItem(treeItem);
}
public static bool TrackHeadActive()
{
return SelectionManager.SelectedTracks().Any(x => x.IsVisibleRecursive()) && !ClipAreaActive();
}
public static bool ClipAreaActive()
{
return GetVisibleSelectedItems().Any();
}
public static IEnumerable<ITimelineItem> GetVisibleSelectedItems()
{
return SelectionManager.SelectedItems().Where(x => x.parentTrack.IsVisibleRecursive());
}
public static IEnumerable<TimelineTrackBaseGUI> GetVisibleTracks()
{
return TimelineWindow.instance.allTracks.Where(x => x.track.IsVisibleRecursive());
}
static TrackAsset PreviousTrack(this TrackAsset track)
{
var uiOrderTracks = GetVisibleTracks().Select(t => t.track).ToList();
var selIdx = uiOrderTracks.IndexOf(track);
return selIdx > 0 ? uiOrderTracks[selIdx - 1] : null;
}
static TrackAsset NextTrack(this TrackAsset track)
{
var uiOrderTracks = GetVisibleTracks().Select(t => t.track).ToList();
var selIdx = uiOrderTracks.IndexOf(track);
return selIdx < uiOrderTracks.Count - 1 && selIdx != -1 ? uiOrderTracks[selIdx + 1] : null;
}
static ITimelineItem PreviousItem(this ITimelineItem item, bool clipOnly)
{
var items = item.parentTrack.GetItems().ToArray();
if (clipOnly)
{
items = items.Where(x => x is ClipItem).ToArray();
}
else
{
items = items.Where(x => x is MarkerItem).ToArray();
}
var idx = Array.IndexOf(items, item);
return idx > 0 ? items[idx - 1] : null;
}
static ITimelineItem NextItem(this ITimelineItem item, bool clipOnly)
{
var items = item.parentTrack.GetItems().ToArray();
if (clipOnly)
{
items = items.Where(x => x is ClipItem).ToArray();
}
else
{
items = items.Where(x => x is MarkerItem).ToArray();
}
var idx = Array.IndexOf(items, item);
return idx < items.Length - 1 ? items[idx + 1] : null;
}
static bool FilterItems(ref List<ITimelineItem> items)
{
var clipOnly = false;
if (items.Any(x => x is ClipItem))
{
items = items.Where(x => x is ClipItem).ToList();
clipOnly = true;
}
return clipOnly;
}
static ITimelineItem GetClosestItem(TrackAsset track, ITimelineItem refItem)
{
var start = refItem.start;
var end = refItem.end;
var items = track.GetItems().ToList();
if (refItem is ClipItem)
{
items = items.Where(x => x is ClipItem).ToList();
}
else
{
items = items.Where(x => x is MarkerItem).ToList();
}
if (!items.Any())
return null;
ITimelineItem ret = null;
var scoreToBeat = double.NegativeInfinity;
foreach (var item in items)
{
// test for overlap
var low = Math.Max(item.start, start);
var high = Math.Min(item.end, end);
if (low <= high)
{
var score = high - low;
if (score >= scoreToBeat)
{
scoreToBeat = score;
ret = item;
}
}
}
return ret;
}
public static bool FocusFirstVisibleItem(IEnumerable<TrackAsset> focusTracks = null)
{
var timeRange = TimelineEditor.visibleTimeRange;
var tracks = focusTracks ?? TimelineWindow.instance.treeView.visibleTracks.Where(x => x.IsVisibleRecursive() && x.GetItems().Any());
var items = tracks.SelectMany(t => t.GetItems().OfType<ClipItem>().Where(x => x.end >= timeRange.x && x.end <= timeRange.y ||
x.start >= timeRange.x && x.start <= timeRange.y)).ToList();
var itemFullyInView = items.Where(x => x.end >= timeRange.x && x.end <= timeRange.y &&
x.start >= timeRange.x && x.start <= timeRange.y);
var itemToSelect = itemFullyInView.FirstOrDefault() ?? items.FirstOrDefault();
if (itemToSelect != null && !itemToSelect.parentTrack.lockedInHierarchy)
{
SelectionManager.SelectOnly(itemToSelect);
return true;
}
return false;
}
public static bool CollapseGroup(IEnumerable<TrackAsset> tracks)
{
if (!TrackHeadActive())
return false;
var didCollapse = false;
foreach (TrackAsset track in tracks)
{
if (!track.GetChildTracks().Any())
continue;
if (!track.GetCollapsed())
{
didCollapse = true;
track.SetCollapsed(true);
}
}
if (didCollapse)
{
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
return true;
}
return SelectAndShowParentTrack(tracks.LastOrDefault());
}
static bool SelectAndShowParentTrack(TrackAsset track)
{
TrackAsset parent = track != null ? track.parent as TrackAsset : null;
if (parent)
{
SelectionManager.SelectOnly(parent);
FrameTrackHeader(GetVisibleTracks().First(x => x.track == parent));
return true;
}
return false;
}
public static bool SelectLeftItem(bool shift = false)
{
if (ClipAreaActive())
{
var items = SelectionManager.SelectedItems().ToList();
var clipOnly = FilterItems(ref items);
var item = items.Last();
var prev = item.PreviousItem(clipOnly);
if (prev != null && !prev.parentTrack.lockedInHierarchy)
{
if (shift)
{
if (SelectionManager.Contains(prev))
SelectionManager.Remove(item);
SelectionManager.Add(prev);
}
else
SelectionManager.SelectOnly(prev);
TimelineHelpers.FrameItems(new[] {prev});
}
else if (item != null && !shift && item.parentTrack != TimelineEditor.inspectedAsset.markerTrack)
SelectionManager.SelectOnly(item.parentTrack);
return true;
}
return false;
}
public static bool SelectRightItem(bool shift = false)
{
if (ClipAreaActive())
{
var items = SelectionManager.SelectedItems().ToList();
var clipOnly = FilterItems(ref items);
var item = items.Last();
var next = item.NextItem(clipOnly);
if (next != null && !next.parentTrack.lockedInHierarchy)
{
if (shift)
{
if (SelectionManager.Contains(next))
SelectionManager.Remove(item);
SelectionManager.Add(next);
}
else
SelectionManager.SelectOnly(next);
TimelineHelpers.FrameItems(new[] {next});
return true;
}
}
return false;
}
public static bool UnCollapseGroup(IEnumerable<TrackAsset> tracks)
{
if (!TrackHeadActive())
return false;
var didUncollapse = false;
foreach (TrackAsset track in tracks)
{
if (!track.GetChildTracks().Any())
continue;
if (track.GetCollapsed())
{
didUncollapse = true;
track.SetCollapsed(false);
}
}
if (didUncollapse)
{
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
return true;
}
return SelectFirstClipStartingFrom(tracks.Last());
}
static bool SelectFirstClipStartingFrom(TrackAsset track)
{
List<TrackAsset> visibleTracks = GetVisibleTracks().Select(x => x.track).ToList();
int idx = visibleTracks.IndexOf(track);
ITimelineItem item = null;
for (int i = idx; i < visibleTracks.Count; ++i)
{
var items = visibleTracks[i].GetItems().OfType<ClipItem>();
if (!items.Any() || visibleTracks[i].lockedInHierarchy)
continue;
item = items.First();
break;
}
if (item != null)
{
SelectionManager.SelectOnly(item);
TimelineHelpers.FrameItems(new[] { item });
return true;
}
return false;
}
public static bool SelectUpTrack(bool shift = false)
{
if (TrackHeadActive())
{
var prevTrack = PreviousTrack(SelectionManager.SelectedTracks().Last());
if (prevTrack != null)
{
if (shift)
{
if (SelectionManager.Contains(prevTrack))
SelectionManager.Remove(SelectionManager.SelectedTracks().Last());
SelectionManager.Add(prevTrack);
}
else
SelectionManager.SelectOnly(prevTrack);
FrameTrackHeader(GetVisibleTracks().First(x => x.track == prevTrack));
}
return true;
}
return false;
}
public static bool SelectUpItem()
{
if (ClipAreaActive())
{
var refItem = SelectionManager.SelectedItems().Last();
var prevTrack = refItem.parentTrack.PreviousTrack();
while (prevTrack != null)
{
var selectionItem = GetClosestItem(prevTrack, refItem);
if (selectionItem == null || prevTrack.lockedInHierarchy)
{
prevTrack = prevTrack.PreviousTrack();
continue;
}
SelectionManager.SelectOnly(selectionItem);
TimelineHelpers.FrameItems(new[] {selectionItem});
FrameTrackHeader(GetVisibleTracks().First(x => x.track == selectionItem.parentTrack));
break;
}
return true;
}
return false;
}
public static bool SelectDownTrack(bool shift = false)
{
if (TrackHeadActive())
{
var nextTrack = SelectionManager.SelectedTracks().Last().NextTrack();
if (nextTrack != null)
{
if (shift)
{
if (SelectionManager.Contains(nextTrack))
SelectionManager.Remove(SelectionManager.SelectedTracks().Last());
SelectionManager.Add(nextTrack);
}
else
SelectionManager.SelectOnly(nextTrack);
FrameTrackHeader(GetVisibleTracks().First(x => x.track == nextTrack));
}
return true;
}
return false;
}
public static bool SelectDownItem()
{
if (ClipAreaActive())
{
var refItem = SelectionManager.SelectedItems().Last();
var nextTrack = refItem.parentTrack.NextTrack();
while (nextTrack != null)
{
var selectionItem = GetClosestItem(nextTrack, refItem);
if (selectionItem == null || nextTrack.lockedInHierarchy)
{
nextTrack = nextTrack.NextTrack();
continue;
}
SelectionManager.SelectOnly(selectionItem);
TimelineHelpers.FrameItems(new[] {selectionItem});
FrameTrackHeader(GetVisibleTracks().First(x => x.track == selectionItem.parentTrack));
break;
}
return true;
}
return false;
}
}
}
TimelineKeyboardNavigation