Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +20 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionContext.cs +63 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionContext.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionManager.cs +306 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionManager.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipAction.cs +36 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipAction.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipsActions.cs +392 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipsActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IAction.cs +123 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IAction.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuChecked.cs +9 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuChecked.cs.meta +3 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuName.cs +9 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuName.cs.meta +3 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Invoker.cs +101 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Invoker.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerAction.cs +35 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerAction.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerActions.cs +20 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Menus.meta +8 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineAction.cs +34 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineAction.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineActions.cs +918 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackAction.cs +36 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackAction.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackActions.cs +451 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackEditor.cs +56 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackEditor.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackInspector.cs +43 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackInspector.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Analytics/TimelineAnalytics.cs +170 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Analytics/TimelineAnalytics.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipActions.cs +101 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipCurveCache.cs +427 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipCurveCache.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipExtensions.cs +34 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipExtensions.cs.meta +3 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationOffsetMenu.cs +73 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationOffsetMenu.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationPlayableAssetEditor.cs +65 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationPlayableAssetEditor.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationTrackActions.cs +151 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationTrackActions.cs.meta +11 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/BindingSelector.cs +179 -0
- benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/BindingSelector.cs.meta +11 -0
.gitattributes
CHANGED
|
@@ -604,3 +604,23 @@ benchmark/iGeo/2025-WRT-Marking-Scheme.pdf filter=lfs diff=lfs merge=lfs -text
|
|
| 604 |
benchmark/iGeo/2025-WRT-Resource-Booklet.pdf filter=lfs diff=lfs merge=lfs -text
|
| 605 |
benchmark/iGeo/FWE-1A-QUESTION_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 606 |
benchmark/iGeo/FWE-1A_Map-A2_Large_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
benchmark/iGeo/2025-WRT-Resource-Booklet.pdf filter=lfs diff=lfs merge=lfs -text
|
| 605 |
benchmark/iGeo/FWE-1A-QUESTION_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 606 |
benchmark/iGeo/FWE-1A_Map-A2_Large_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 607 |
+
benchmark/iGeo/FWE-1B_QUESTION_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 608 |
+
benchmark/iGeo/FWE-1_Student-booklet_2024iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 609 |
+
benchmark/iGeo/FWE-2_Map-C2_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 610 |
+
benchmark/iGeo/FWE-2_QUESTION_2018iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 611 |
+
benchmark/iGeo/FWE-2_Student-booklet_2024iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 612 |
+
benchmark/iGeo/FWE_Briefing-v1_2019iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 613 |
+
benchmark/iGeo/FWE_Information-Booklet_2024iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 614 |
+
benchmark/iGeo/FWE_Instructions_2019iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 615 |
+
benchmark/iGeo/FWE_Mark-Scheme_2024iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 616 |
+
benchmark/iGeo/FWE_Task1_QP_2019iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 617 |
+
benchmark/iGeo/FWE_Task2_QP_2019iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 618 |
+
benchmark/iGeo/FWE_Task_maps_2019iGeo_20190722.pdf filter=lfs diff=lfs merge=lfs -text
|
| 619 |
+
benchmark/iGeo/FWE_Test_QP_2019iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 620 |
+
benchmark/iGeo/MMT-Sample-Questions.pdf filter=lfs diff=lfs merge=lfs -text
|
| 621 |
+
benchmark/iGeo/WRT-2022-Question-and-Resource-Booklet.pdf filter=lfs diff=lfs merge=lfs -text
|
| 622 |
+
benchmark/iGeo/WRT-2024-Question-and-Answer-Booklet.pdf filter=lfs diff=lfs merge=lfs -text
|
| 623 |
+
benchmark/iGeo/WRT_Marking-Scheme_2018iGeo_final_version.pdf filter=lfs diff=lfs merge=lfs -text
|
| 624 |
+
benchmark/iGeo/WRT_Marking-Scheme_2024iGeo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 625 |
+
benchmark/iGeo/WRT_Marking_Scheme_2019-iGeo_Hong-Kong.pdf filter=lfs diff=lfs merge=lfs -text
|
| 626 |
+
benchmark/iGeo/WRT_QA-Booklet_iGeo-2019.pdf filter=lfs diff=lfs merge=lfs -text
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionContext.cs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using System.Linq;
|
| 3 |
+
using UnityEngine;
|
| 4 |
+
using UnityEngine.Playables;
|
| 5 |
+
using UnityEngine.Timeline;
|
| 6 |
+
|
| 7 |
+
namespace UnityEditor.Timeline.Actions
|
| 8 |
+
{
|
| 9 |
+
/// <summary>
|
| 10 |
+
/// Action context to be used by actions.
|
| 11 |
+
/// </summary>
|
| 12 |
+
/// <seealso cref="Invoker"/>
|
| 13 |
+
/// <seealso cref="TimelineAction"/>
|
| 14 |
+
public struct ActionContext
|
| 15 |
+
{
|
| 16 |
+
IEnumerable<TrackAsset> m_Tracks;
|
| 17 |
+
IEnumerable<TimelineClip> m_Clips;
|
| 18 |
+
IEnumerable<IMarker> m_Markers;
|
| 19 |
+
|
| 20 |
+
/// <summary>
|
| 21 |
+
/// The Timeline asset that is currently opened in the Timeline window.
|
| 22 |
+
/// </summary>
|
| 23 |
+
public TimelineAsset timeline;
|
| 24 |
+
|
| 25 |
+
/// <summary>
|
| 26 |
+
/// The PlayableDirector that is used to play the current Timeline asset.
|
| 27 |
+
/// </summary>
|
| 28 |
+
public PlayableDirector director;
|
| 29 |
+
|
| 30 |
+
/// <summary>
|
| 31 |
+
/// Time based on the position of the cursor on the timeline (in seconds).
|
| 32 |
+
/// null if the time is not available (in case of a shortcut for example).
|
| 33 |
+
/// </summary>
|
| 34 |
+
public double? invocationTime;
|
| 35 |
+
|
| 36 |
+
/// <summary>
|
| 37 |
+
/// Tracks that will be used by the actions.
|
| 38 |
+
/// </summary>
|
| 39 |
+
public IEnumerable<TrackAsset> tracks
|
| 40 |
+
{
|
| 41 |
+
get => m_Tracks ?? Enumerable.Empty<TrackAsset>();
|
| 42 |
+
set => m_Tracks = value;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/// <summary>
|
| 46 |
+
/// Clips that will be used by the actions.
|
| 47 |
+
/// </summary>
|
| 48 |
+
public IEnumerable<TimelineClip> clips
|
| 49 |
+
{
|
| 50 |
+
get => m_Clips ?? Enumerable.Empty<TimelineClip>();
|
| 51 |
+
set => m_Clips = value;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/// <summary>
|
| 55 |
+
/// Markers that will be used by the actions.
|
| 56 |
+
/// </summary>
|
| 57 |
+
public IEnumerable<IMarker> markers
|
| 58 |
+
{
|
| 59 |
+
get => m_Markers ?? Enumerable.Empty<IMarker>();
|
| 60 |
+
set => m_Markers = value;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionContext.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 5e79d50dea5c9c74d9297cce6cd6d053
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionManager.cs
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using System.Reflection;
|
| 5 |
+
using UnityEngine;
|
| 6 |
+
using UnityEngine.Timeline;
|
| 7 |
+
|
| 8 |
+
namespace UnityEditor.Timeline.Actions
|
| 9 |
+
{
|
| 10 |
+
static class ActionManager
|
| 11 |
+
{
|
| 12 |
+
static bool s_ShowActionTriggeredByShortcut = false;
|
| 13 |
+
|
| 14 |
+
public static readonly IReadOnlyList<TimelineAction> TimelineActions = InstantiateClassesOfType<TimelineAction>();
|
| 15 |
+
public static readonly IReadOnlyList<ClipAction> ClipActions = InstantiateClassesOfType<ClipAction>();
|
| 16 |
+
public static readonly IReadOnlyList<TrackAction> TrackActions = InstantiateClassesOfType<TrackAction>();
|
| 17 |
+
public static readonly IReadOnlyList<MarkerAction> MarkerActions = InstantiateClassesOfType<MarkerAction>();
|
| 18 |
+
|
| 19 |
+
public static readonly IReadOnlyList<TimelineAction> TimelineActionsWithShortcuts = ActionsWithShortCuts(TimelineActions);
|
| 20 |
+
public static readonly IReadOnlyList<ClipAction> ClipActionsWithShortcuts = ActionsWithShortCuts(ClipActions);
|
| 21 |
+
public static readonly IReadOnlyList<TrackAction> TrackActionsWithShortcuts = ActionsWithShortCuts(TrackActions);
|
| 22 |
+
public static readonly IReadOnlyList<MarkerAction> MarkerActionsWithShortcuts = ActionsWithShortCuts(MarkerActions);
|
| 23 |
+
|
| 24 |
+
public static readonly HashSet<Type> ActionsWithAutoUndo = TypesWithAttribute<ApplyDefaultUndoAttribute>();
|
| 25 |
+
|
| 26 |
+
public static TU GetCachedAction<T, TU>(this IReadOnlyList<TU> list) where T : TU
|
| 27 |
+
{
|
| 28 |
+
return list.FirstOrDefault(x => x.GetType() == typeof(T));
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public static void GetMenuEntries(IReadOnlyList<TimelineAction> actions, Vector2? mousePos, List<MenuActionItem> menuItems, MenuFilter filter = MenuFilter.Default)
|
| 32 |
+
{
|
| 33 |
+
var globalContext = TimelineEditor.CurrentContext(mousePos);
|
| 34 |
+
foreach (var action in actions)
|
| 35 |
+
{
|
| 36 |
+
try
|
| 37 |
+
{
|
| 38 |
+
BuildMenu(action, globalContext, menuItems, filter);
|
| 39 |
+
}
|
| 40 |
+
catch (Exception e)
|
| 41 |
+
{
|
| 42 |
+
Debug.LogException(e);
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
public static void GetMenuEntries(IReadOnlyList<TrackAction> actions, List<MenuActionItem> menuItems, MenuFilter filter = MenuFilter.Track)
|
| 48 |
+
{
|
| 49 |
+
var tracks = SelectionManager.SelectedTracks();
|
| 50 |
+
if (!tracks.Any())
|
| 51 |
+
return;
|
| 52 |
+
|
| 53 |
+
foreach (var action in actions)
|
| 54 |
+
{
|
| 55 |
+
try
|
| 56 |
+
{
|
| 57 |
+
BuildMenu(action, tracks, menuItems, filter);
|
| 58 |
+
}
|
| 59 |
+
catch (Exception e)
|
| 60 |
+
{
|
| 61 |
+
Debug.LogException(e);
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
public static void GetMenuEntries(IReadOnlyList<ClipAction> actions, List<MenuActionItem> menuItems, MenuFilter filter = MenuFilter.Item)
|
| 67 |
+
{
|
| 68 |
+
var clips = SelectionManager.SelectedClips();
|
| 69 |
+
bool any = clips.Any();
|
| 70 |
+
if (!clips.Any())
|
| 71 |
+
return;
|
| 72 |
+
|
| 73 |
+
foreach (var action in actions)
|
| 74 |
+
{
|
| 75 |
+
try
|
| 76 |
+
{
|
| 77 |
+
if (action is EditSubTimeline editSubTimelineAction)
|
| 78 |
+
editSubTimelineAction.AddMenuItem(menuItems);
|
| 79 |
+
else if (any)
|
| 80 |
+
BuildMenu(action, clips, menuItems, filter);
|
| 81 |
+
}
|
| 82 |
+
catch (Exception e)
|
| 83 |
+
{
|
| 84 |
+
Debug.LogException(e);
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
public static void GetMenuEntries(IReadOnlyList<MarkerAction> actions, List<MenuActionItem> menuItems, MenuFilter filter = MenuFilter.Item)
|
| 90 |
+
{
|
| 91 |
+
var markers = SelectionManager.SelectedMarkers();
|
| 92 |
+
if (!markers.Any())
|
| 93 |
+
return;
|
| 94 |
+
|
| 95 |
+
foreach (var action in actions)
|
| 96 |
+
{
|
| 97 |
+
try
|
| 98 |
+
{
|
| 99 |
+
BuildMenu(action, markers, menuItems, filter);
|
| 100 |
+
}
|
| 101 |
+
catch (Exception e)
|
| 102 |
+
{
|
| 103 |
+
Debug.LogException(e);
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
static void BuildMenu(TimelineAction action, ActionContext context, List<MenuActionItem> menuItems, MenuFilter filter)
|
| 109 |
+
{
|
| 110 |
+
BuildMenu(action, action.Validate(context), () => ExecuteTimelineAction(action, context), menuItems, filter);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
static void BuildMenu(TrackAction action, IEnumerable<TrackAsset> tracks, List<MenuActionItem> menuItems, MenuFilter filter)
|
| 114 |
+
{
|
| 115 |
+
BuildMenu(action, action.Validate(tracks), () => ExecuteTrackAction(action, tracks), menuItems, filter);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
static void BuildMenu(ClipAction action, IEnumerable<TimelineClip> clips, List<MenuActionItem> menuItems, MenuFilter filter)
|
| 119 |
+
{
|
| 120 |
+
BuildMenu(action, action.Validate(clips), () => ExecuteClipAction(action, clips), menuItems, filter);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
static void BuildMenu(MarkerAction action, IEnumerable<IMarker> markers, List<MenuActionItem> menuItems, MenuFilter filter)
|
| 124 |
+
{
|
| 125 |
+
BuildMenu(action, action.Validate(markers), () => ExecuteMarkerAction(action, markers), menuItems, filter);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
static void BuildMenu(IAction action, ActionValidity validity, GenericMenu.MenuFunction executeFunction, List<MenuActionItem> menuItems, MenuFilter filter, bool isChecked = false)
|
| 129 |
+
{
|
| 130 |
+
var menuAttribute = action.GetType().GetCustomAttribute<MenuEntryAttribute>(false);
|
| 131 |
+
if (menuAttribute == null || filter.ShouldFilterOut(menuAttribute))
|
| 132 |
+
return;
|
| 133 |
+
|
| 134 |
+
if (validity == ActionValidity.NotApplicable)
|
| 135 |
+
return;
|
| 136 |
+
|
| 137 |
+
var menuActionItem = new MenuActionItem
|
| 138 |
+
{
|
| 139 |
+
state = validity,
|
| 140 |
+
entryName = action.GetMenuEntryName(),
|
| 141 |
+
priority = menuAttribute.priority,
|
| 142 |
+
category = menuAttribute.subMenuPath,
|
| 143 |
+
isActiveInMode = action.IsActionActiveInMode(TimelineWindow.instance.currentMode.mode),
|
| 144 |
+
shortCut = action.GetShortcut(),
|
| 145 |
+
callback = executeFunction,
|
| 146 |
+
isChecked = action.IsChecked()
|
| 147 |
+
};
|
| 148 |
+
menuItems.Add(menuActionItem);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
internal static void BuildMenu(GenericMenu menu, List<MenuActionItem> items)
|
| 152 |
+
{
|
| 153 |
+
// sorted the outer menu by priority, then sort the innermenu by priority
|
| 154 |
+
var sortedItems =
|
| 155 |
+
items.GroupBy(x => string.IsNullOrEmpty(x.category) ? x.entryName : x.category).OrderBy(x => x.Min(y => y.priority)).SelectMany(x => x.OrderBy(z => z.priority));
|
| 156 |
+
|
| 157 |
+
int lastPriority = Int32.MinValue;
|
| 158 |
+
string lastCategory = string.Empty;
|
| 159 |
+
|
| 160 |
+
foreach (var s in sortedItems)
|
| 161 |
+
{
|
| 162 |
+
if (s.state == ActionValidity.NotApplicable)
|
| 163 |
+
continue;
|
| 164 |
+
|
| 165 |
+
var priority = s.priority;
|
| 166 |
+
if (lastPriority != int.MinValue && priority / MenuPriority.separatorAt > lastPriority / MenuPriority.separatorAt)
|
| 167 |
+
{
|
| 168 |
+
string path = string.Empty;
|
| 169 |
+
if (lastCategory == s.category)
|
| 170 |
+
path = s.category;
|
| 171 |
+
menu.AddSeparator(path);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
lastPriority = priority;
|
| 175 |
+
lastCategory = s.category;
|
| 176 |
+
|
| 177 |
+
string entry = s.category + s.entryName;
|
| 178 |
+
if (!string.IsNullOrEmpty(s.shortCut))
|
| 179 |
+
entry += " " + s.shortCut;
|
| 180 |
+
|
| 181 |
+
if (s.state == ActionValidity.Valid && s.isActiveInMode)
|
| 182 |
+
menu.AddItem(new GUIContent(entry), s.isChecked, s.callback);
|
| 183 |
+
else
|
| 184 |
+
menu.AddDisabledItem(new GUIContent(entry), s.isChecked);
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
public static bool HandleShortcut(Event evt)
|
| 189 |
+
{
|
| 190 |
+
if (EditorGUI.IsEditingTextField())
|
| 191 |
+
return false;
|
| 192 |
+
|
| 193 |
+
return HandleShortcut(evt, TimelineActionsWithShortcuts, (x) => ExecuteTimelineAction(x, TimelineEditor.CurrentContext())) ||
|
| 194 |
+
HandleShortcut(evt, ClipActionsWithShortcuts, (x => ExecuteClipAction(x, SelectionManager.SelectedClips()))) ||
|
| 195 |
+
HandleShortcut(evt, TrackActionsWithShortcuts, (x => ExecuteTrackAction(x, SelectionManager.SelectedTracks()))) ||
|
| 196 |
+
HandleShortcut(evt, MarkerActionsWithShortcuts, (x => ExecuteMarkerAction(x, SelectionManager.SelectedMarkers())));
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
public static bool HandleShortcut<T>(Event evt, IReadOnlyList<T> actions, Func<T, bool> invoke) where T : class, IAction
|
| 200 |
+
{
|
| 201 |
+
for (int i = 0; i < actions.Count; i++)
|
| 202 |
+
{
|
| 203 |
+
var action = actions[i];
|
| 204 |
+
var attr = action.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true);
|
| 205 |
+
|
| 206 |
+
foreach (ShortcutAttribute shortcut in attr)
|
| 207 |
+
{
|
| 208 |
+
if (shortcut.MatchesEvent(evt))
|
| 209 |
+
{
|
| 210 |
+
if (s_ShowActionTriggeredByShortcut)
|
| 211 |
+
Debug.Log(action.GetType().Name);
|
| 212 |
+
|
| 213 |
+
if (!action.IsActionActiveInMode(TimelineWindow.instance.currentMode.mode))
|
| 214 |
+
continue;
|
| 215 |
+
|
| 216 |
+
if (invoke(action))
|
| 217 |
+
return true;
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
return false;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
public static bool ExecuteTimelineAction(TimelineAction timelineAction, ActionContext context)
|
| 226 |
+
{
|
| 227 |
+
if (timelineAction.Validate(context) == ActionValidity.Valid)
|
| 228 |
+
{
|
| 229 |
+
if (timelineAction.HasAutoUndo())
|
| 230 |
+
UndoExtensions.RegisterContext(context, timelineAction.GetUndoName());
|
| 231 |
+
return timelineAction.Execute(context);
|
| 232 |
+
}
|
| 233 |
+
return false;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
public static bool ExecuteTrackAction(TrackAction trackAction, IEnumerable<TrackAsset> tracks)
|
| 237 |
+
{
|
| 238 |
+
if (tracks != null && tracks.Any() && trackAction.Validate(tracks) == ActionValidity.Valid)
|
| 239 |
+
{
|
| 240 |
+
if (trackAction.HasAutoUndo())
|
| 241 |
+
UndoExtensions.RegisterTracks(tracks, trackAction.GetUndoName());
|
| 242 |
+
return trackAction.Execute(tracks);
|
| 243 |
+
}
|
| 244 |
+
return false;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
public static bool ExecuteClipAction(ClipAction clipAction, IEnumerable<TimelineClip> clips)
|
| 248 |
+
{
|
| 249 |
+
if (clips != null && clips.Any() && clipAction.Validate(clips) == ActionValidity.Valid)
|
| 250 |
+
{
|
| 251 |
+
if (clipAction.HasAutoUndo())
|
| 252 |
+
UndoExtensions.RegisterClips(clips, clipAction.GetUndoName());
|
| 253 |
+
return clipAction.Execute(clips);
|
| 254 |
+
}
|
| 255 |
+
return false;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
public static bool ExecuteMarkerAction(MarkerAction markerAction, IEnumerable<IMarker> markers)
|
| 259 |
+
{
|
| 260 |
+
if (markers != null && markers.Any() && markerAction.Validate(markers) == ActionValidity.Valid)
|
| 261 |
+
{
|
| 262 |
+
if (markerAction.HasAutoUndo())
|
| 263 |
+
UndoExtensions.RegisterMarkers(markers, markerAction.GetUndoName());
|
| 264 |
+
return markerAction.Execute(markers);
|
| 265 |
+
}
|
| 266 |
+
return false;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
static List<T> InstantiateClassesOfType<T>() where T : class
|
| 270 |
+
{
|
| 271 |
+
var typeCollection = TypeCache.GetTypesDerivedFrom(typeof(T));
|
| 272 |
+
var list = new List<T>(typeCollection.Count);
|
| 273 |
+
for (int i = 0; i < typeCollection.Count; i++)
|
| 274 |
+
{
|
| 275 |
+
if (typeCollection[i].IsAbstract || typeCollection[i].IsGenericType)
|
| 276 |
+
continue;
|
| 277 |
+
|
| 278 |
+
if (typeCollection[i].GetConstructor(Type.EmptyTypes) == null)
|
| 279 |
+
{
|
| 280 |
+
Debug.LogWarning($"{typeCollection[i].FullName} requires a default constructor to be automatically instantiated by Timeline");
|
| 281 |
+
continue;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
list.Add((T)Activator.CreateInstance(typeCollection[i]));
|
| 285 |
+
}
|
| 286 |
+
return list;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
static List<T> ActionsWithShortCuts<T>(IReadOnlyList<T> list)
|
| 290 |
+
{
|
| 291 |
+
return list.Where(x => x.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true).Length > 0).ToList();
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
static HashSet<System.Type> TypesWithAttribute<T>() where T : Attribute
|
| 295 |
+
{
|
| 296 |
+
var hashSet = new HashSet<System.Type>();
|
| 297 |
+
var typeCollection = TypeCache.GetTypesWithAttribute(typeof(T));
|
| 298 |
+
for (int i = 0; i < typeCollection.Count; i++)
|
| 299 |
+
{
|
| 300 |
+
hashSet.Add(typeCollection[i]);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
return hashSet;
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ActionManager.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: b185b14d428805c46aceb7c663825b2d
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipAction.cs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using UnityEngine.Timeline;
|
| 3 |
+
|
| 4 |
+
namespace UnityEditor.Timeline.Actions
|
| 5 |
+
{
|
| 6 |
+
/// <summary>
|
| 7 |
+
/// Base class for a clip action.
|
| 8 |
+
/// Inherit from this class to make an action that would react on selected clips after a menu click and/or a key shortcut.
|
| 9 |
+
/// </summary>
|
| 10 |
+
/// <example>
|
| 11 |
+
/// Simple Clip Action example (with context menu and shortcut support).
|
| 12 |
+
/// <code source="../../DocCodeExamples/ActionExamples.cs" region="declare-sampleClipAction" title="SampleClipAction"/>
|
| 13 |
+
/// </example>
|
| 14 |
+
/// <remarks>
|
| 15 |
+
/// To add an action as a menu item in the Timeline context menu, add <see cref="MenuEntryAttribute"/> on the action class.
|
| 16 |
+
/// To make an action to react to a shortcut, use the Shortcut Manager API with <see cref="TimelineShortcutAttribute"/>.
|
| 17 |
+
/// <seealso cref="UnityEditor.ShortcutManagement.ShortcutAttribute"/>
|
| 18 |
+
/// </remarks>
|
| 19 |
+
[ActiveInMode(TimelineModes.Default)]
|
| 20 |
+
public abstract class ClipAction : IAction
|
| 21 |
+
{
|
| 22 |
+
/// <summary>
|
| 23 |
+
/// Execute the action based on clips.
|
| 24 |
+
/// </summary>
|
| 25 |
+
/// <param name="clips">clips that the action will act on.</param>
|
| 26 |
+
/// <returns>Returns true if the action has been correctly executed, false otherwise.</returns>
|
| 27 |
+
public abstract bool Execute(IEnumerable<TimelineClip> clips);
|
| 28 |
+
|
| 29 |
+
/// <summary>
|
| 30 |
+
/// Defines the validity of an Action for a given set of clips.
|
| 31 |
+
/// </summary>
|
| 32 |
+
/// <param name="clips">The clips that the action will act on.</param>
|
| 33 |
+
/// <returns>The validity of the set of clips.</returns>
|
| 34 |
+
public abstract ActionValidity Validate(IEnumerable<TimelineClip> clips);
|
| 35 |
+
}
|
| 36 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipAction.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: fa130a47ff26ad84f867961fc32334af
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipsActions.cs
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using System.Linq;
|
| 3 |
+
using JetBrains.Annotations;
|
| 4 |
+
using UnityEditor.Timeline.Actions;
|
| 5 |
+
using UnityEngine;
|
| 6 |
+
using UnityEngine.Timeline;
|
| 7 |
+
using UnityEngine.Playables;
|
| 8 |
+
|
| 9 |
+
namespace UnityEditor.Timeline
|
| 10 |
+
{
|
| 11 |
+
[MenuEntry("Edit in Animation Window", MenuPriority.ClipEditActionSection.editInAnimationWindow), UsedImplicitly]
|
| 12 |
+
class EditClipInAnimationWindow : ClipAction
|
| 13 |
+
{
|
| 14 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 15 |
+
{
|
| 16 |
+
if (!GetEditableClip(clips, out _, out _))
|
| 17 |
+
return ActionValidity.NotApplicable;
|
| 18 |
+
return ActionValidity.Valid;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 22 |
+
{
|
| 23 |
+
TimelineClip clip;
|
| 24 |
+
AnimationClip clipToEdit;
|
| 25 |
+
if (!GetEditableClip(clips, out clip, out clipToEdit))
|
| 26 |
+
return false;
|
| 27 |
+
|
| 28 |
+
GameObject gameObject = null;
|
| 29 |
+
if (TimelineEditor.inspectedDirector != null)
|
| 30 |
+
gameObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.parentTrack);
|
| 31 |
+
|
| 32 |
+
var timeController = TimelineAnimationUtilities.CreateTimeController(clip);
|
| 33 |
+
TimelineAnimationUtilities.EditAnimationClipWithTimeController(
|
| 34 |
+
clipToEdit, timeController, clip.animationClip != null ? gameObject : null);
|
| 35 |
+
|
| 36 |
+
return true;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
private static bool GetEditableClip(IEnumerable<TimelineClip> clips, out TimelineClip clip, out AnimationClip animClip)
|
| 40 |
+
{
|
| 41 |
+
clip = null;
|
| 42 |
+
animClip = null;
|
| 43 |
+
|
| 44 |
+
if (clips.Count() != 1)
|
| 45 |
+
return false;
|
| 46 |
+
|
| 47 |
+
clip = clips.FirstOrDefault();
|
| 48 |
+
if (clip == null)
|
| 49 |
+
return false;
|
| 50 |
+
|
| 51 |
+
if (clip.animationClip != null)
|
| 52 |
+
animClip = clip.animationClip;
|
| 53 |
+
else if (clip.curves != null && !clip.curves.empty)
|
| 54 |
+
animClip = clip.curves;
|
| 55 |
+
|
| 56 |
+
return animClip != null;
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
[MenuEntry("Edit Sub-Timeline", MenuPriority.ClipEditActionSection.editSubTimeline), UsedImplicitly]
|
| 61 |
+
class EditSubTimeline : ClipAction
|
| 62 |
+
{
|
| 63 |
+
private static readonly string MultiItemPrefix = "Edit Sub-Timelines/";
|
| 64 |
+
private static readonly string SingleItemPrefix = "Edit ";
|
| 65 |
+
|
| 66 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 67 |
+
{
|
| 68 |
+
if (clips == null || clips.Count() != 1 || TimelineEditor.inspectedDirector == null)
|
| 69 |
+
return ActionValidity.NotApplicable;
|
| 70 |
+
|
| 71 |
+
var clip = clips.First();
|
| 72 |
+
var directors = TimelineUtility.GetSubTimelines(clip, TimelineEditor.inspectedDirector);
|
| 73 |
+
return directors.Any(x => x != null) ? ActionValidity.Valid : ActionValidity.NotApplicable;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 77 |
+
{
|
| 78 |
+
if (Validate(clips) != ActionValidity.Valid) return false;
|
| 79 |
+
|
| 80 |
+
var clip = clips.First();
|
| 81 |
+
|
| 82 |
+
var directors = TimelineUtility.GetSubTimelines(clip, TimelineEditor.inspectedDirector);
|
| 83 |
+
ExecuteInternal(directors, 0, clip);
|
| 84 |
+
|
| 85 |
+
return true;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
static void ExecuteInternal(IList<PlayableDirector> directors, int directorIndex, TimelineClip clip)
|
| 89 |
+
{
|
| 90 |
+
SelectionManager.Clear();
|
| 91 |
+
TimelineWindow.instance.SetCurrentTimeline(directors[directorIndex], clip);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
internal void AddMenuItem(List<MenuActionItem> menuItems)
|
| 95 |
+
{
|
| 96 |
+
var clips = TimelineEditor.selectedClips;
|
| 97 |
+
if (clips == null || clips.Length != 1)
|
| 98 |
+
return;
|
| 99 |
+
|
| 100 |
+
var mode = TimelineWindow.instance.currentMode.mode;
|
| 101 |
+
MenuEntryAttribute menuAttribute = GetType().GetCustomAttributes(typeof(MenuEntryAttribute), false).OfType<MenuEntryAttribute>().FirstOrDefault();
|
| 102 |
+
var menuItem = new MenuActionItem()
|
| 103 |
+
{
|
| 104 |
+
category = menuAttribute.subMenuPath ?? string.Empty,
|
| 105 |
+
entryName = menuAttribute.name,
|
| 106 |
+
isActiveInMode = this.IsActionActiveInMode(mode),
|
| 107 |
+
priority = menuAttribute.priority,
|
| 108 |
+
state = Validate(clips),
|
| 109 |
+
callback = null
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
var subDirectors = TimelineUtility.GetSubTimelines(clips[0], TimelineEditor.inspectedDirector);
|
| 113 |
+
if (subDirectors.Count == 1)
|
| 114 |
+
{
|
| 115 |
+
menuItem.entryName = SingleItemPrefix + DisplayNameHelper.GetDisplayName(subDirectors[0]);
|
| 116 |
+
menuItem.callback = () =>
|
| 117 |
+
{
|
| 118 |
+
Execute(clips);
|
| 119 |
+
};
|
| 120 |
+
menuItems.Add(menuItem);
|
| 121 |
+
}
|
| 122 |
+
else
|
| 123 |
+
{
|
| 124 |
+
for (int i = 0; i < subDirectors.Count; i++)
|
| 125 |
+
{
|
| 126 |
+
var index = i;
|
| 127 |
+
menuItem.category = MultiItemPrefix;
|
| 128 |
+
menuItem.entryName = DisplayNameHelper.GetDisplayName(subDirectors[i]);
|
| 129 |
+
menuItem.callback = () =>
|
| 130 |
+
{
|
| 131 |
+
ExecuteInternal(subDirectors, index, clips[0]);
|
| 132 |
+
};
|
| 133 |
+
menuItems.Add(menuItem);
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
[MenuEntry("Editing/Trim Start", MenuPriority.ClipActionSection.trimStart)]
|
| 140 |
+
[Shortcut(Shortcuts.Clip.trimStart), UsedImplicitly]
|
| 141 |
+
class TrimStart : ClipAction
|
| 142 |
+
{
|
| 143 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 144 |
+
{
|
| 145 |
+
return clips.All(x => TimelineEditor.inspectedSequenceTime <= x.start || TimelineEditor.inspectedSequenceTime >= x.start + x.duration) ? ActionValidity.Invalid : ActionValidity.Valid;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 149 |
+
{
|
| 150 |
+
return ClipModifier.TrimStart(clips, TimelineEditor.inspectedSequenceTime);
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
[MenuEntry("Editing/Trim End", MenuPriority.ClipActionSection.trimEnd), UsedImplicitly]
|
| 155 |
+
[Shortcut(Shortcuts.Clip.trimEnd)]
|
| 156 |
+
class TrimEnd : ClipAction
|
| 157 |
+
{
|
| 158 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 159 |
+
{
|
| 160 |
+
return clips.All(x => TimelineEditor.inspectedSequenceTime <= x.start || TimelineEditor.inspectedSequenceTime >= x.start + x.duration) ? ActionValidity.Invalid : ActionValidity.Valid;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 164 |
+
{
|
| 165 |
+
return ClipModifier.TrimEnd(clips, TimelineEditor.inspectedSequenceTime);
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
[Shortcut(Shortcuts.Clip.split)]
|
| 170 |
+
[MenuEntry("Editing/Split", MenuPriority.ClipActionSection.split), UsedImplicitly]
|
| 171 |
+
class Split : ClipAction
|
| 172 |
+
{
|
| 173 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 174 |
+
{
|
| 175 |
+
return clips.All(x => TimelineEditor.inspectedSequenceTime <= x.start || TimelineEditor.inspectedSequenceTime >= x.start + x.duration) ? ActionValidity.Invalid : ActionValidity.Valid;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 179 |
+
{
|
| 180 |
+
bool success = ClipModifier.Split(clips, TimelineEditor.inspectedSequenceTime, TimelineEditor.inspectedDirector);
|
| 181 |
+
if (success)
|
| 182 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 183 |
+
return success;
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
[MenuEntry("Editing/Complete Last Loop", MenuPriority.ClipActionSection.completeLastLoop), UsedImplicitly]
|
| 188 |
+
class CompleteLastLoop : ClipAction
|
| 189 |
+
{
|
| 190 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 191 |
+
{
|
| 192 |
+
bool canDisplay = clips.Any(TimelineHelpers.HasUsableAssetDuration);
|
| 193 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 197 |
+
{
|
| 198 |
+
return ClipModifier.CompleteLastLoop(clips);
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
[MenuEntry("Editing/Trim Last Loop", MenuPriority.ClipActionSection.trimLastLoop), UsedImplicitly]
|
| 203 |
+
class TrimLastLoop : ClipAction
|
| 204 |
+
{
|
| 205 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 206 |
+
{
|
| 207 |
+
bool canDisplay = clips.Any(TimelineHelpers.HasUsableAssetDuration);
|
| 208 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 212 |
+
{
|
| 213 |
+
return ClipModifier.TrimLastLoop(clips);
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
[MenuEntry("Editing/Match Duration", MenuPriority.ClipActionSection.matchDuration), UsedImplicitly]
|
| 218 |
+
class MatchDuration : ClipAction
|
| 219 |
+
{
|
| 220 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 221 |
+
{
|
| 222 |
+
return clips.Count() > 1 ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 226 |
+
{
|
| 227 |
+
return ClipModifier.MatchDuration(clips);
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
[MenuEntry("Editing/Double Speed", MenuPriority.ClipActionSection.doubleSpeed), UsedImplicitly]
|
| 232 |
+
class DoubleSpeed : ClipAction
|
| 233 |
+
{
|
| 234 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 235 |
+
{
|
| 236 |
+
bool canDisplay = clips.All(x => x.SupportsSpeedMultiplier());
|
| 237 |
+
|
| 238 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 242 |
+
{
|
| 243 |
+
return ClipModifier.DoubleSpeed(clips);
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
[MenuEntry("Editing/Half Speed", MenuPriority.ClipActionSection.halfSpeed), UsedImplicitly]
|
| 248 |
+
class HalfSpeed : ClipAction
|
| 249 |
+
{
|
| 250 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 251 |
+
{
|
| 252 |
+
bool canDisplay = clips.All(x => x.SupportsSpeedMultiplier());
|
| 253 |
+
|
| 254 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 258 |
+
{
|
| 259 |
+
return ClipModifier.HalfSpeed(clips);
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
[MenuEntry("Editing/Reset Duration", MenuPriority.ClipActionSection.resetDuration), UsedImplicitly]
|
| 264 |
+
class ResetDuration : ClipAction
|
| 265 |
+
{
|
| 266 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 267 |
+
{
|
| 268 |
+
bool canDisplay = clips.Any(TimelineHelpers.HasUsableAssetDuration);
|
| 269 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 273 |
+
{
|
| 274 |
+
return ClipModifier.ResetEditing(clips);
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
[MenuEntry("Editing/Reset Speed", MenuPriority.ClipActionSection.resetSpeed), UsedImplicitly]
|
| 279 |
+
class ResetSpeed : ClipAction
|
| 280 |
+
{
|
| 281 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 282 |
+
{
|
| 283 |
+
bool canDisplay = clips.All(x => x.SupportsSpeedMultiplier());
|
| 284 |
+
|
| 285 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 289 |
+
{
|
| 290 |
+
return ClipModifier.ResetSpeed(clips);
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
[MenuEntry("Editing/Reset All", MenuPriority.ClipActionSection.resetAll), UsedImplicitly]
|
| 295 |
+
class ResetAll : ClipAction
|
| 296 |
+
{
|
| 297 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 298 |
+
{
|
| 299 |
+
bool canDisplay = clips.Any(TimelineHelpers.HasUsableAssetDuration) || clips.All(x => x.SupportsSpeedMultiplier());
|
| 300 |
+
|
| 301 |
+
return canDisplay ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 305 |
+
{
|
| 306 |
+
var speedResult = ClipModifier.ResetSpeed(clips);
|
| 307 |
+
var editResult = ClipModifier.ResetEditing(clips);
|
| 308 |
+
return speedResult || editResult;
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
[MenuEntry("Tile", MenuPriority.ClipActionSection.tile), UsedImplicitly]
|
| 313 |
+
class Tile : ClipAction
|
| 314 |
+
{
|
| 315 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 316 |
+
{
|
| 317 |
+
return clips.Count() > 1 ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 321 |
+
{
|
| 322 |
+
return ClipModifier.Tile(clips);
|
| 323 |
+
}
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
[MenuEntry("Find Source Asset", MenuPriority.ClipActionSection.findSourceAsset), UsedImplicitly]
|
| 327 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 328 |
+
class FindSourceAsset : ClipAction
|
| 329 |
+
{
|
| 330 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 331 |
+
{
|
| 332 |
+
if (clips.Count() > 1)
|
| 333 |
+
return ActionValidity.Invalid;
|
| 334 |
+
|
| 335 |
+
if (GetUnderlyingAsset(clips.First()) == null)
|
| 336 |
+
return ActionValidity.Invalid;
|
| 337 |
+
|
| 338 |
+
return ActionValidity.Valid;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 342 |
+
{
|
| 343 |
+
EditorGUIUtility.PingObject(GetUnderlyingAsset(clips.First()));
|
| 344 |
+
return true;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
private static UnityEngine.Object GetExternalPlayableAsset(TimelineClip clip)
|
| 348 |
+
{
|
| 349 |
+
if (clip.asset == null)
|
| 350 |
+
return null;
|
| 351 |
+
|
| 352 |
+
if ((clip.asset.hideFlags & HideFlags.HideInHierarchy) != 0)
|
| 353 |
+
return null;
|
| 354 |
+
|
| 355 |
+
return clip.asset;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
private static UnityEngine.Object GetUnderlyingAsset(TimelineClip clip)
|
| 359 |
+
{
|
| 360 |
+
var asset = clip.asset as ScriptableObject;
|
| 361 |
+
if (asset == null)
|
| 362 |
+
return null;
|
| 363 |
+
|
| 364 |
+
var fields = ObjectReferenceField.FindObjectReferences(asset.GetType());
|
| 365 |
+
if (fields.Length == 0)
|
| 366 |
+
return GetExternalPlayableAsset(clip);
|
| 367 |
+
|
| 368 |
+
// Find the first non-null field
|
| 369 |
+
foreach (var field in fields)
|
| 370 |
+
{
|
| 371 |
+
// skip scene refs in asset mode
|
| 372 |
+
if (TimelineEditor.inspectedDirector == null && field.isSceneReference)
|
| 373 |
+
continue;
|
| 374 |
+
var obj = field.Find(asset, TimelineEditor.inspectedDirector);
|
| 375 |
+
if (obj != null)
|
| 376 |
+
return obj;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
return GetExternalPlayableAsset(clip);
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
class CopyClipsToClipboard : ClipAction
|
| 384 |
+
{
|
| 385 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips) => ActionValidity.Valid;
|
| 386 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 387 |
+
{
|
| 388 |
+
TimelineEditor.clipboard.CopyItems(clips.ToItems());
|
| 389 |
+
return true;
|
| 390 |
+
}
|
| 391 |
+
}
|
| 392 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/ClipsActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 4b721099b5d509d4093e516f59ad9ad6
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IAction.cs
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.ComponentModel;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using System.Reflection;
|
| 5 |
+
using UnityEditor.ShortcutManagement;
|
| 6 |
+
using UnityEngine;
|
| 7 |
+
|
| 8 |
+
namespace UnityEditor.Timeline.Actions
|
| 9 |
+
{
|
| 10 |
+
/// interface indicating an Action class
|
| 11 |
+
interface IAction {}
|
| 12 |
+
|
| 13 |
+
/// extension methods for IActions
|
| 14 |
+
static class ActionExtensions
|
| 15 |
+
{
|
| 16 |
+
const string kActionPostFix = "Action";
|
| 17 |
+
|
| 18 |
+
public static string GetUndoName(this IAction action)
|
| 19 |
+
{
|
| 20 |
+
if (action == null)
|
| 21 |
+
throw new ArgumentNullException(nameof(action));
|
| 22 |
+
|
| 23 |
+
var attr = action.GetType().GetCustomAttribute<ApplyDefaultUndoAttribute>(false);
|
| 24 |
+
if (attr != null && !string.IsNullOrWhiteSpace(attr.UndoTitle))
|
| 25 |
+
return attr.UndoTitle;
|
| 26 |
+
|
| 27 |
+
return action.GetDisplayName();
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public static string GetMenuEntryName(this IAction action)
|
| 31 |
+
{
|
| 32 |
+
var menuAction = action as IMenuName;
|
| 33 |
+
if (menuAction != null && !string.IsNullOrWhiteSpace(menuAction.menuName))
|
| 34 |
+
return menuAction.menuName;
|
| 35 |
+
|
| 36 |
+
var attr = action.GetType().GetCustomAttribute<MenuEntryAttribute>(false);
|
| 37 |
+
if (attr != null && !string.IsNullOrWhiteSpace(attr.name))
|
| 38 |
+
return attr.name;
|
| 39 |
+
|
| 40 |
+
return action.GetDisplayName();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
public static string GetDisplayName(this IAction action)
|
| 44 |
+
{
|
| 45 |
+
if (action == null)
|
| 46 |
+
throw new ArgumentNullException(nameof(action));
|
| 47 |
+
|
| 48 |
+
var attr = action.GetType().GetCustomAttribute<DisplayNameAttribute>(false);
|
| 49 |
+
if (attr != null && !string.IsNullOrEmpty(attr.DisplayName))
|
| 50 |
+
return attr.DisplayName;
|
| 51 |
+
|
| 52 |
+
var name = action.GetType().Name;
|
| 53 |
+
if (name.EndsWith(kActionPostFix))
|
| 54 |
+
return ObjectNames.NicifyVariableName(name.Substring(0, name.Length - kActionPostFix.Length));
|
| 55 |
+
|
| 56 |
+
return ObjectNames.NicifyVariableName(name);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
public static bool HasAutoUndo(this IAction action)
|
| 60 |
+
{
|
| 61 |
+
return action != null && ActionManager.ActionsWithAutoUndo.Contains(action.GetType());
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
public static bool IsChecked(this IAction action)
|
| 65 |
+
{
|
| 66 |
+
return (action is IMenuChecked menuAction) && menuAction.isChecked;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
public static bool IsActionActiveInMode(this IAction action, TimelineModes mode)
|
| 70 |
+
{
|
| 71 |
+
var attr = action.GetType().GetCustomAttribute<ActiveInModeAttribute>(true);
|
| 72 |
+
return attr != null && (attr.modes & mode) != 0;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
public static string GetShortcut(this IAction action)
|
| 76 |
+
{
|
| 77 |
+
if (action == null)
|
| 78 |
+
throw new ArgumentNullException(nameof(action));
|
| 79 |
+
|
| 80 |
+
var shortcutAttribute = GetShortcutAttributeForAction(action);
|
| 81 |
+
var shortCut = shortcutAttribute == null ? string.Empty : shortcutAttribute.GetMenuShortcut();
|
| 82 |
+
if (string.IsNullOrWhiteSpace(shortCut))
|
| 83 |
+
{
|
| 84 |
+
//Check if there is a static method with attribute
|
| 85 |
+
var customShortcutMethod = action.GetType().GetMethods().FirstOrDefault(m => m.GetCustomAttribute<TimelineShortcutAttribute>(true) != null);
|
| 86 |
+
if (customShortcutMethod != null)
|
| 87 |
+
{
|
| 88 |
+
var shortcutId = customShortcutMethod.GetCustomAttribute<TimelineShortcutAttribute>(true).identifier;
|
| 89 |
+
var shortcut = ShortcutIntegration.instance.directory.FindShortcutEntry(shortcutId);
|
| 90 |
+
if (shortcut != null && shortcut.combinations.Any())
|
| 91 |
+
shortCut = KeyCombination.SequenceToMenuString(shortcut.combinations);
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return shortCut;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
static ShortcutAttribute GetShortcutAttributeForAction(this IAction action)
|
| 99 |
+
{
|
| 100 |
+
if (action == null)
|
| 101 |
+
throw new ArgumentNullException(nameof(action));
|
| 102 |
+
|
| 103 |
+
var shortcutAttributes = action.GetType()
|
| 104 |
+
.GetCustomAttributes(typeof(ShortcutAttribute), true)
|
| 105 |
+
.Cast<ShortcutAttribute>();
|
| 106 |
+
|
| 107 |
+
foreach (var shortcutAttribute in shortcutAttributes)
|
| 108 |
+
{
|
| 109 |
+
if (shortcutAttribute is ShortcutPlatformOverrideAttribute shortcutOverride)
|
| 110 |
+
{
|
| 111 |
+
if (shortcutOverride.MatchesCurrentPlatform())
|
| 112 |
+
return shortcutOverride;
|
| 113 |
+
}
|
| 114 |
+
else
|
| 115 |
+
{
|
| 116 |
+
return shortcutAttribute;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
return null;
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IAction.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: de11c48878ba1b44b8b641af54dba8c1
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuChecked.cs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
|
| 3 |
+
namespace UnityEditor.Timeline
|
| 4 |
+
{
|
| 5 |
+
interface IMenuChecked
|
| 6 |
+
{
|
| 7 |
+
bool isChecked { get; }
|
| 8 |
+
}
|
| 9 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuChecked.cs.meta
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 0939c83f40ef46e584340aa87b3cadfe
|
| 3 |
+
timeCreated: 1591130283
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuName.cs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
|
| 3 |
+
namespace UnityEditor.Timeline
|
| 4 |
+
{
|
| 5 |
+
interface IMenuName
|
| 6 |
+
{
|
| 7 |
+
string menuName { get; }
|
| 8 |
+
}
|
| 9 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/IMenuName.cs.meta
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 512ac45650d443f3be59379c2ecbf068
|
| 3 |
+
timeCreated: 1591130274
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Invoker.cs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using UnityEngine;
|
| 4 |
+
using UnityEngine.Timeline;
|
| 5 |
+
|
| 6 |
+
namespace UnityEditor.Timeline.Actions
|
| 7 |
+
{
|
| 8 |
+
/// <summary>
|
| 9 |
+
/// Class containing methods to invoke actions.
|
| 10 |
+
/// </summary>
|
| 11 |
+
public static class Invoker
|
| 12 |
+
{
|
| 13 |
+
/// <summary>
|
| 14 |
+
/// Execute a given action with a context parameter.
|
| 15 |
+
/// </summary>
|
| 16 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 17 |
+
/// <param name="context">Context for the action.</param>
|
| 18 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 19 |
+
public static bool Invoke<T>(this ActionContext context) where T : TimelineAction
|
| 20 |
+
{
|
| 21 |
+
var action = ActionManager.TimelineActions.GetCachedAction<T, TimelineAction>();
|
| 22 |
+
return ActionManager.ExecuteTimelineAction(action, context);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/// <summary>
|
| 26 |
+
/// Execute a given action with tracks
|
| 27 |
+
/// </summary>
|
| 28 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 29 |
+
/// <param name="tracks">Tracks that the action will act on.</param>
|
| 30 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 31 |
+
public static bool Invoke<T>(this IEnumerable<TrackAsset> tracks) where T : TrackAction
|
| 32 |
+
{
|
| 33 |
+
var action = ActionManager.TrackActions.GetCachedAction<T, TrackAction>();
|
| 34 |
+
return ActionManager.ExecuteTrackAction(action, tracks);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/// <summary>
|
| 38 |
+
/// Execute a given action with clips
|
| 39 |
+
/// </summary>
|
| 40 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 41 |
+
/// <param name="clips">Clips that the action will act on.</param>
|
| 42 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 43 |
+
public static bool Invoke<T>(this IEnumerable<TimelineClip> clips) where T : ClipAction
|
| 44 |
+
{
|
| 45 |
+
var action = ActionManager.ClipActions.GetCachedAction<T, ClipAction>();
|
| 46 |
+
return ActionManager.ExecuteClipAction(action, clips);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/// <summary>
|
| 50 |
+
/// Execute a given action with markers
|
| 51 |
+
/// </summary>
|
| 52 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 53 |
+
/// <param name="markers">Markers that the action will act on.</param>
|
| 54 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 55 |
+
public static bool Invoke<T>(this IEnumerable<IMarker> markers) where T : MarkerAction
|
| 56 |
+
{
|
| 57 |
+
var action = ActionManager.MarkerActions.GetCachedAction<T, MarkerAction>();
|
| 58 |
+
return ActionManager.ExecuteMarkerAction(action, markers);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/// <summary>
|
| 62 |
+
/// Execute a given timeline action with the selected clips, tracks and markers.
|
| 63 |
+
/// </summary>
|
| 64 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 65 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 66 |
+
public static bool InvokeWithSelected<T>() where T : TimelineAction
|
| 67 |
+
{
|
| 68 |
+
return Invoke<T>(TimelineEditor.CurrentContext());
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/// <summary>
|
| 72 |
+
/// Execute a given clip action with the selected clips.
|
| 73 |
+
/// </summary>
|
| 74 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 75 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 76 |
+
public static bool InvokeWithSelectedClips<T>() where T : ClipAction
|
| 77 |
+
{
|
| 78 |
+
return Invoke<T>(SelectionManager.SelectedClips());
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/// <summary>
|
| 82 |
+
/// Execute a given track action with the selected tracks.
|
| 83 |
+
/// </summary>
|
| 84 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 85 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 86 |
+
public static bool InvokeWithSelectedTracks<T>() where T : TrackAction
|
| 87 |
+
{
|
| 88 |
+
return Invoke<T>(SelectionManager.SelectedTracks());
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/// <summary>
|
| 92 |
+
/// Execute a given marker action with the selected markers.
|
| 93 |
+
/// </summary>
|
| 94 |
+
/// <typeparam name="T">Action type to execute.</typeparam>
|
| 95 |
+
/// <returns>True if the action has been executed, false otherwise.</returns>
|
| 96 |
+
public static bool InvokeWithSelectedMarkers<T>() where T : MarkerAction
|
| 97 |
+
{
|
| 98 |
+
return Invoke<T>(SelectionManager.SelectedMarkers());
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Invoker.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 0c379d496c819c14b8b5377d7830a59a
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerAction.cs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using UnityEngine.Timeline;
|
| 3 |
+
|
| 4 |
+
namespace UnityEditor.Timeline.Actions
|
| 5 |
+
{
|
| 6 |
+
/// <summary>
|
| 7 |
+
/// Base class for a marker action.
|
| 8 |
+
/// Inherit from this class to make an action that would react on selected markers after a menu click and/or a key shortcut.
|
| 9 |
+
/// </summary>
|
| 10 |
+
/// <example>
|
| 11 |
+
/// Simple track Action example (with context menu and shortcut support).
|
| 12 |
+
/// <code source="../../DocCodeExamples/ActionExamples.cs" region="declare-sampleMarkerAction" title="SampleMarkerAction"/>
|
| 13 |
+
/// </example>
|
| 14 |
+
/// <remarks>
|
| 15 |
+
/// To add an action as a menu item in the Timeline context menu, add <see cref="MenuEntryAttribute"/> on the action class.
|
| 16 |
+
/// To make an action to react to a shortcut, use the Shortcut Manager API with <see cref="TimelineShortcutAttribute"/>.
|
| 17 |
+
/// <seealso cref="UnityEditor.ShortcutManagement.ShortcutAttribute"/>
|
| 18 |
+
/// </remarks>
|
| 19 |
+
[ActiveInMode(TimelineModes.Default)]
|
| 20 |
+
public abstract class MarkerAction : IAction
|
| 21 |
+
{
|
| 22 |
+
/// <summary>
|
| 23 |
+
/// Execute the action.
|
| 24 |
+
/// </summary>
|
| 25 |
+
/// <param name="markers">Markers that will be used for the action. </param>
|
| 26 |
+
/// <returns>true if the action has been executed. false otherwise</returns>
|
| 27 |
+
public abstract bool Execute(IEnumerable<IMarker> markers);
|
| 28 |
+
/// <summary>
|
| 29 |
+
/// Defines the validity of an Action for a given set of markers.
|
| 30 |
+
/// </summary>
|
| 31 |
+
/// <param name="markers">Markers that will be used for the action. </param>
|
| 32 |
+
/// <returns>The validity of the set of markers.</returns>
|
| 33 |
+
public abstract ActionValidity Validate(IEnumerable<IMarker> markers);
|
| 34 |
+
}
|
| 35 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerAction.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 03d19e545aea1b446b1c56530a4438ae
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerActions.cs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using JetBrains.Annotations;
|
| 3 |
+
using UnityEditor.Timeline.Actions;
|
| 4 |
+
using UnityEngine;
|
| 5 |
+
using UnityEngine.Timeline;
|
| 6 |
+
|
| 7 |
+
namespace UnityEditor.Timeline
|
| 8 |
+
{
|
| 9 |
+
[UsedImplicitly]
|
| 10 |
+
class CopyMarkersToClipboard : MarkerAction
|
| 11 |
+
{
|
| 12 |
+
public override ActionValidity Validate(IEnumerable<IMarker> markers) => ActionValidity.Valid;
|
| 13 |
+
|
| 14 |
+
public override bool Execute(IEnumerable<IMarker> markers)
|
| 15 |
+
{
|
| 16 |
+
TimelineEditor.clipboard.CopyItems(markers.ToItems());
|
| 17 |
+
return true;
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/MarkerActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 5da77d4d078922b4c8466e9e35fb3f5e
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/Menus.meta
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 985eed4bc2fbee941b761b8816d9055d
|
| 3 |
+
folderAsset: yes
|
| 4 |
+
DefaultImporter:
|
| 5 |
+
externalObjects: {}
|
| 6 |
+
userData:
|
| 7 |
+
assetBundleName:
|
| 8 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineAction.cs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
namespace UnityEditor.Timeline.Actions
|
| 2 |
+
{
|
| 3 |
+
/// <summary>
|
| 4 |
+
/// Base class for a timeline action.
|
| 5 |
+
/// Inherit from this class to make an action on a timeline after a menu click and/or a key shortcut.
|
| 6 |
+
/// </summary>
|
| 7 |
+
/// <remarks>
|
| 8 |
+
/// To add an action as a menu item in the Timeline context menu, add <see cref="MenuEntryAttribute"/> on the action class.
|
| 9 |
+
/// To make an action to react to a shortcut, use the Shortcut Manager API with <see cref="TimelineShortcutAttribute"/>.
|
| 10 |
+
/// <seealso cref="UnityEditor.ShortcutManagement.ShortcutAttribute"/>
|
| 11 |
+
/// <seealso cref="ActiveInModeAttribute"/>
|
| 12 |
+
/// </remarks>
|
| 13 |
+
/// <example>
|
| 14 |
+
/// Simple Timeline Action example (with context menu and shortcut support).
|
| 15 |
+
/// <code source="../../DocCodeExamples/ActionExamples.cs" region="declare-sampleTimelineAction" title="SampleTimelineAction"/>
|
| 16 |
+
/// </example>
|
| 17 |
+
[ActiveInMode(TimelineModes.Default)]
|
| 18 |
+
public abstract class TimelineAction : IAction
|
| 19 |
+
{
|
| 20 |
+
/// <summary>
|
| 21 |
+
/// Execute the action.
|
| 22 |
+
/// </summary>
|
| 23 |
+
/// <param name="context">Context for the action.</param>
|
| 24 |
+
/// <returns>true if the action has been executed. false otherwise</returns>
|
| 25 |
+
public abstract bool Execute(ActionContext context);
|
| 26 |
+
|
| 27 |
+
/// <summary>
|
| 28 |
+
/// Defines the validity of an Action based on the context.
|
| 29 |
+
/// </summary>
|
| 30 |
+
/// <param name="context">Context for the action.</param>
|
| 31 |
+
/// <returns>Visual state of the menu for the action.</returns>
|
| 32 |
+
public abstract ActionValidity Validate(ActionContext context);
|
| 33 |
+
}
|
| 34 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineAction.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 38eaad816666dfb428c3f123a09413c6
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineActions.cs
ADDED
|
@@ -0,0 +1,918 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using UnityEditor.ShortcutManagement;
|
| 5 |
+
using UnityEditor.Timeline.Actions;
|
| 6 |
+
using UnityEngine;
|
| 7 |
+
using UnityEngine.Timeline;
|
| 8 |
+
|
| 9 |
+
namespace UnityEditor.Timeline
|
| 10 |
+
{
|
| 11 |
+
[MenuEntry("Copy", MenuPriority.TimelineActionSection.copy)]
|
| 12 |
+
[Shortcut("Main Menu/Edit/Copy", EventCommandNames.Copy)]
|
| 13 |
+
class CopyAction : TimelineAction
|
| 14 |
+
{
|
| 15 |
+
public override ActionValidity Validate(ActionContext context)
|
| 16 |
+
{
|
| 17 |
+
return SelectionManager.Count() > 0 ? ActionValidity.Valid : ActionValidity.NotApplicable;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public override bool Execute(ActionContext context)
|
| 21 |
+
{
|
| 22 |
+
TimelineEditor.clipboard.Clear();
|
| 23 |
+
|
| 24 |
+
var clips = context.clips;
|
| 25 |
+
if (clips.Any())
|
| 26 |
+
{
|
| 27 |
+
clips.Invoke<CopyClipsToClipboard>();
|
| 28 |
+
}
|
| 29 |
+
var markers = context.markers;
|
| 30 |
+
if (markers.Any())
|
| 31 |
+
{
|
| 32 |
+
markers.Invoke<CopyMarkersToClipboard>();
|
| 33 |
+
}
|
| 34 |
+
var tracks = context.tracks;
|
| 35 |
+
if (tracks.Any())
|
| 36 |
+
{
|
| 37 |
+
CopyTracksToClipboard.Do(tracks.ToArray());
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return true;
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
[MenuEntry("Paste", MenuPriority.TimelineActionSection.paste, MenuFilter.Default | MenuFilter.MarkerHeader)]
|
| 45 |
+
[Shortcut("Main Menu/Edit/Paste", EventCommandNames.Paste)]
|
| 46 |
+
class PasteAction : TimelineAction
|
| 47 |
+
{
|
| 48 |
+
public override ActionValidity Validate(ActionContext context)
|
| 49 |
+
{
|
| 50 |
+
return CanPaste(context.invocationTime) ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
public override bool Execute(ActionContext context)
|
| 54 |
+
{
|
| 55 |
+
if (!CanPaste(context.invocationTime))
|
| 56 |
+
return false;
|
| 57 |
+
|
| 58 |
+
PasteItems(context.invocationTime);
|
| 59 |
+
PasteTracks();
|
| 60 |
+
|
| 61 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 62 |
+
return true;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
static bool CanPaste(double? invocationTime)
|
| 66 |
+
{
|
| 67 |
+
var copiedItems = TimelineEditor.clipboard.GetCopiedItems().ToList();
|
| 68 |
+
|
| 69 |
+
if (!copiedItems.Any())
|
| 70 |
+
return TimelineEditor.clipboard.GetTracks().Any();
|
| 71 |
+
|
| 72 |
+
return CanPasteItems(copiedItems, invocationTime);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
static bool CanPasteItems(ICollection<ItemsPerTrack> itemsGroups, double? invocationTime)
|
| 76 |
+
{
|
| 77 |
+
var hasItemsCopiedFromMultipleTracks = itemsGroups.Count > 1;
|
| 78 |
+
var allItemsCopiedFromCurrentAsset = itemsGroups.All(x => x.targetTrack.timelineAsset == TimelineEditor.inspectedAsset);
|
| 79 |
+
var hasUsedShortcut = invocationTime == null;
|
| 80 |
+
var anySourceLocked = itemsGroups.Any(x => x.targetTrack != null && x.targetTrack.lockedInHierarchy);
|
| 81 |
+
|
| 82 |
+
var targetTrack = GetPickedTrack();
|
| 83 |
+
if (targetTrack == null)
|
| 84 |
+
targetTrack = SelectionManager.SelectedTracks().FirstOrDefault();
|
| 85 |
+
|
| 86 |
+
//do not paste if the user copied items from another timeline
|
| 87 |
+
//if the copied items comes from > 1 track (since we do not know where to paste the copied items)
|
| 88 |
+
//or if a keyboard shortcut was used (since the user will not see the paste result)
|
| 89 |
+
if (!allItemsCopiedFromCurrentAsset)
|
| 90 |
+
{
|
| 91 |
+
var isSelectedTrackInCurrentAsset = targetTrack != null && targetTrack.timelineAsset == TimelineEditor.inspectedAsset;
|
| 92 |
+
if (hasItemsCopiedFromMultipleTracks || (hasUsedShortcut && !isSelectedTrackInCurrentAsset))
|
| 93 |
+
return false;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
// pasting to items to their source track, if items from multiple tracks are selected
|
| 97 |
+
// and no track is in the selection items will each be pasted to their respective track.
|
| 98 |
+
if (targetTrack==null || itemsGroups.All(x => x.targetTrack == targetTrack))
|
| 99 |
+
return !anySourceLocked;
|
| 100 |
+
|
| 101 |
+
if (hasItemsCopiedFromMultipleTracks)
|
| 102 |
+
{
|
| 103 |
+
//do not paste if the track which received the paste action does not contain a copied clip
|
| 104 |
+
return !anySourceLocked && itemsGroups.Select(x => x.targetTrack).Contains(targetTrack);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
var copiedItems = itemsGroups.SelectMany(i => i.items);
|
| 108 |
+
return IsTrackValidForItems(targetTrack, copiedItems);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
static void PasteItems(double? invocationTime)
|
| 112 |
+
{
|
| 113 |
+
var copiedItems = TimelineEditor.clipboard.GetCopiedItems().ToList();
|
| 114 |
+
var numberOfUniqueParentsInClipboard = copiedItems.Count();
|
| 115 |
+
|
| 116 |
+
if (numberOfUniqueParentsInClipboard == 0) return;
|
| 117 |
+
List<ITimelineItem> newItems;
|
| 118 |
+
|
| 119 |
+
//if the copied items were on a single parent, then use the mouse position to get the parent OR the original parent
|
| 120 |
+
if (numberOfUniqueParentsInClipboard == 1)
|
| 121 |
+
{
|
| 122 |
+
var itemsGroup = copiedItems.First();
|
| 123 |
+
TrackAsset target = null;
|
| 124 |
+
if (invocationTime.HasValue)
|
| 125 |
+
target = GetPickedTrack();
|
| 126 |
+
if (target == null)
|
| 127 |
+
target = FindSuitableParentForSingleTrackPasteWithoutMouse(itemsGroup);
|
| 128 |
+
|
| 129 |
+
var candidateTime = invocationTime ?? TimelineHelpers.GetCandidateTime(null, target);
|
| 130 |
+
newItems = TimelineHelpers.DuplicateItemsUsingCurrentEditMode(TimelineEditor.clipboard.exposedPropertyTable, TimelineEditor.inspectedDirector, itemsGroup, target, candidateTime, "Paste Items").ToList();
|
| 131 |
+
}
|
| 132 |
+
//if copied items were on multiple parents, then the destination parents are the same as the original parents
|
| 133 |
+
else
|
| 134 |
+
{
|
| 135 |
+
var time = invocationTime ?? TimelineHelpers.GetCandidateTime(null, copiedItems.Select(c => c.targetTrack).ToArray());
|
| 136 |
+
newItems = TimelineHelpers.DuplicateItemsUsingCurrentEditMode(TimelineEditor.clipboard.exposedPropertyTable, TimelineEditor.inspectedDirector, copiedItems, time, "Paste Items").ToList();
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
TimelineHelpers.FrameItems(newItems);
|
| 140 |
+
SelectionManager.RemoveTimelineSelection();
|
| 141 |
+
foreach (var item in newItems)
|
| 142 |
+
{
|
| 143 |
+
SelectionManager.Add(item);
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
static TrackAsset FindSuitableParentForSingleTrackPasteWithoutMouse(ItemsPerTrack itemsGroup)
|
| 148 |
+
{
|
| 149 |
+
var groupParent = itemsGroup.targetTrack; //set a main parent in the clipboard
|
| 150 |
+
var selectedTracks = SelectionManager.SelectedTracks();
|
| 151 |
+
|
| 152 |
+
if (selectedTracks.Contains(groupParent))
|
| 153 |
+
{
|
| 154 |
+
return groupParent;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
//find a selected track suitable for all items
|
| 158 |
+
var itemsToPaste = itemsGroup.items;
|
| 159 |
+
var compatibleTrack = selectedTracks.FirstOrDefault(t => IsTrackValidForItems(t, itemsToPaste));
|
| 160 |
+
return compatibleTrack != null ? compatibleTrack : groupParent;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
static bool IsTrackValidForItems(TrackAsset track, IEnumerable<ITimelineItem> items)
|
| 164 |
+
{
|
| 165 |
+
if (track == null || track.lockedInHierarchy) return false;
|
| 166 |
+
return items.All(i => i.IsCompatibleWithTrack(track));
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
static TrackAsset GetPickedTrack()
|
| 170 |
+
{
|
| 171 |
+
if (PickerUtils.pickedElements == null)
|
| 172 |
+
return null;
|
| 173 |
+
|
| 174 |
+
var rowGUI = PickerUtils.pickedElements.OfType<IRowGUI>().FirstOrDefault();
|
| 175 |
+
if (rowGUI != null)
|
| 176 |
+
return rowGUI.asset;
|
| 177 |
+
|
| 178 |
+
return null;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
static void PasteTracks()
|
| 182 |
+
{
|
| 183 |
+
var trackData = TimelineEditor.clipboard.GetTracks().ToList();
|
| 184 |
+
if (trackData.Any())
|
| 185 |
+
{
|
| 186 |
+
SelectionManager.RemoveTimelineSelection();
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
foreach (var track in trackData)
|
| 190 |
+
{
|
| 191 |
+
var newTrack = track.item.Duplicate(TimelineEditor.clipboard.exposedPropertyTable, TimelineEditor.inspectedDirector, TimelineEditor.inspectedAsset);
|
| 192 |
+
if (track.binding != null)
|
| 193 |
+
{
|
| 194 |
+
TimelineHelpers.Bind(newTrack, track.binding, TimelineEditor.inspectedDirector);
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
SelectionManager.Add(newTrack);
|
| 198 |
+
foreach (var childTrack in newTrack.GetFlattenedChildTracks())
|
| 199 |
+
{
|
| 200 |
+
SelectionManager.Add(childTrack);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
if (track.parent != null && track.parent.timelineAsset == TimelineEditor.inspectedAsset)
|
| 204 |
+
{
|
| 205 |
+
TrackExtensions.ReparentTracks(new List<TrackAsset> { newTrack }, track.parent, track.item);
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
[MenuEntry("Duplicate", MenuPriority.TimelineActionSection.duplicate)]
|
| 212 |
+
[Shortcut("Main Menu/Edit/Duplicate", EventCommandNames.Duplicate)]
|
| 213 |
+
class DuplicateAction : TimelineAction
|
| 214 |
+
{
|
| 215 |
+
public override ActionValidity Validate(ActionContext context)
|
| 216 |
+
{
|
| 217 |
+
return context.clips.Any() || context.tracks.Any() || context.markers.Any() ? ActionValidity.Valid : ActionValidity.NotApplicable;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
public bool Execute(Func<ITimelineItem, ITimelineItem, double> gapBetweenItems)
|
| 221 |
+
{
|
| 222 |
+
return Execute(TimelineEditor.CurrentContext(), gapBetweenItems);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
public override bool Execute(ActionContext context)
|
| 226 |
+
{
|
| 227 |
+
return Execute(context, (item1, item2) => ItemsUtils.TimeGapBetweenItems(item1, item2));
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
internal bool Execute(ActionContext context, Func<ITimelineItem, ITimelineItem, double> gapBetweenItems)
|
| 231 |
+
{
|
| 232 |
+
List<ITimelineItem> items = new List<ITimelineItem>();
|
| 233 |
+
items.AddRange(context.clips.Select(p => p.ToItem()));
|
| 234 |
+
items.AddRange(context.markers.Select(p => p.ToItem()));
|
| 235 |
+
List<ItemsPerTrack> selectedItems = items.ToItemsPerTrack().ToList();
|
| 236 |
+
if (selectedItems.Any())
|
| 237 |
+
{
|
| 238 |
+
var requestedTime = CalculateDuplicateTime(selectedItems, gapBetweenItems);
|
| 239 |
+
var duplicatedItems = TimelineHelpers.DuplicateItemsUsingCurrentEditMode(TimelineEditor.inspectedDirector, TimelineEditor.inspectedDirector, selectedItems, requestedTime, "Duplicate Items");
|
| 240 |
+
|
| 241 |
+
TimelineHelpers.FrameItems(duplicatedItems);
|
| 242 |
+
SelectionManager.RemoveTimelineSelection();
|
| 243 |
+
foreach (var item in duplicatedItems)
|
| 244 |
+
SelectionManager.Add(item);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
var tracks = context.tracks.ToArray();
|
| 248 |
+
if (tracks.Length > 0)
|
| 249 |
+
tracks.Invoke<DuplicateTracks>();
|
| 250 |
+
|
| 251 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 252 |
+
return true;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
static double CalculateDuplicateTime(IEnumerable<ItemsPerTrack> duplicatedItems, Func<ITimelineItem, ITimelineItem, double> gapBetweenItems)
|
| 256 |
+
{
|
| 257 |
+
//Find the end time of the rightmost item
|
| 258 |
+
var itemsOnTracks = duplicatedItems.SelectMany(i => i.targetTrack.GetItems()).ToList();
|
| 259 |
+
var time = itemsOnTracks.Max(i => i.end);
|
| 260 |
+
|
| 261 |
+
//From all the duplicated items, select the leftmost items
|
| 262 |
+
var firstDuplicatedItems = duplicatedItems.Select(i => i.leftMostItem);
|
| 263 |
+
var leftMostDuplicatedItems = firstDuplicatedItems.OrderBy(i => i.start).GroupBy(i => i.start).FirstOrDefault();
|
| 264 |
+
if (leftMostDuplicatedItems == null) return 0.0;
|
| 265 |
+
|
| 266 |
+
foreach (var leftMostItem in leftMostDuplicatedItems)
|
| 267 |
+
{
|
| 268 |
+
var siblings = leftMostItem.parentTrack.GetItems();
|
| 269 |
+
var rightMostSiblings = siblings.OrderByDescending(i => i.end).GroupBy(i => i.end).FirstOrDefault();
|
| 270 |
+
if (rightMostSiblings == null) continue;
|
| 271 |
+
|
| 272 |
+
foreach (var sibling in rightMostSiblings)
|
| 273 |
+
time = Math.Max(time, sibling.end + gapBetweenItems(leftMostItem, sibling));
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
return time;
|
| 277 |
+
}
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
[MenuEntry("Delete", MenuPriority.TimelineActionSection.delete)]
|
| 281 |
+
[Shortcut("Main Menu/Edit/Delete", EventCommandNames.Delete)]
|
| 282 |
+
[ShortcutPlatformOverride(RuntimePlatform.OSXEditor, KeyCode.Backspace, ShortcutModifiers.Action)]
|
| 283 |
+
[ActiveInMode(TimelineModes.Default)]
|
| 284 |
+
class DeleteAction : TimelineAction
|
| 285 |
+
{
|
| 286 |
+
public override ActionValidity Validate(ActionContext context)
|
| 287 |
+
{
|
| 288 |
+
return CanDelete(context) ? ActionValidity.Valid : ActionValidity.Invalid;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
static bool CanDelete(ActionContext context)
|
| 292 |
+
{
|
| 293 |
+
if (TimelineWindow.instance.state.editSequence.isReadOnly)
|
| 294 |
+
return false;
|
| 295 |
+
// All() returns true when empty
|
| 296 |
+
return context.tracks.All(x => !x.lockedInHierarchy) &&
|
| 297 |
+
context.clips.All(x => x.parentTrack == null || !x.parentTrack.lockedInHierarchy) &&
|
| 298 |
+
context.markers.All(x => x.parent == null || !x.parent.lockedInHierarchy);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
public override bool Execute(ActionContext context)
|
| 302 |
+
{
|
| 303 |
+
if (!CanDelete(context))
|
| 304 |
+
return false;
|
| 305 |
+
|
| 306 |
+
var selectedItems = context.clips.Select(p => p.ToItem()).ToList();
|
| 307 |
+
selectedItems.AddRange(context.markers.Select(p => p.ToItem()));
|
| 308 |
+
DeleteItems(selectedItems);
|
| 309 |
+
|
| 310 |
+
if (context.tracks.Any() && SelectionManager.GetCurrentInlineEditorCurve() == null)
|
| 311 |
+
context.tracks.Invoke<DeleteTracks>();
|
| 312 |
+
|
| 313 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 314 |
+
return selectedItems.Any() || context.tracks.Any();
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
internal static void DeleteItems(IEnumerable<ITimelineItem> items)
|
| 318 |
+
{
|
| 319 |
+
var tracks = items.GroupBy(c => c.parentTrack);
|
| 320 |
+
|
| 321 |
+
foreach (var track in tracks)
|
| 322 |
+
TimelineUndo.PushUndo(track.Key, "Delete Items");
|
| 323 |
+
|
| 324 |
+
TimelineAnimationUtilities.UnlinkAnimationWindowFromClips(items.OfType<ClipItem>().Select(i => i.clip));
|
| 325 |
+
|
| 326 |
+
EditMode.PrepareItemsDelete(ItemsUtils.ToItemsPerTrack(items));
|
| 327 |
+
EditModeUtils.Delete(items);
|
| 328 |
+
|
| 329 |
+
SelectionManager.RemoveAllClips();
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
[MenuEntry("Match Content", MenuPriority.TimelineActionSection.matchContent)]
|
| 334 |
+
[Shortcut(Shortcuts.Timeline.matchContent)]
|
| 335 |
+
class MatchContent : TimelineAction
|
| 336 |
+
{
|
| 337 |
+
public override ActionValidity Validate(ActionContext actionContext)
|
| 338 |
+
{
|
| 339 |
+
var clips = actionContext.clips;
|
| 340 |
+
|
| 341 |
+
if (!clips.Any())
|
| 342 |
+
return ActionValidity.NotApplicable;
|
| 343 |
+
|
| 344 |
+
return clips.Any(TimelineHelpers.HasUsableAssetDuration)
|
| 345 |
+
? ActionValidity.Valid
|
| 346 |
+
: ActionValidity.Invalid;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
public override bool Execute(ActionContext actionContext)
|
| 350 |
+
{
|
| 351 |
+
var clips = actionContext.clips;
|
| 352 |
+
return clips.Any() && ClipModifier.MatchContent(clips);
|
| 353 |
+
}
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
[Shortcut(Shortcuts.Timeline.play)]
|
| 357 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 358 |
+
class PlayTimelineAction : TimelineAction
|
| 359 |
+
{
|
| 360 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 361 |
+
|
| 362 |
+
public override bool Execute(ActionContext actionContext)
|
| 363 |
+
{
|
| 364 |
+
var currentState = TimelineEditor.state.playing;
|
| 365 |
+
TimelineEditor.state.SetPlaying(!currentState);
|
| 366 |
+
return true;
|
| 367 |
+
}
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 371 |
+
class SelectAllAction : TimelineAction
|
| 372 |
+
{
|
| 373 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 374 |
+
|
| 375 |
+
public override bool Execute(ActionContext actionContext)
|
| 376 |
+
{
|
| 377 |
+
// otherwise select all tracks.
|
| 378 |
+
SelectionManager.Clear();
|
| 379 |
+
TimelineWindow.instance.allTracks.ForEach(x => SelectionManager.Add(x.track));
|
| 380 |
+
return true;
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
[Shortcut(Shortcuts.Timeline.previousFrame)]
|
| 385 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 386 |
+
class PreviousFrameAction : TimelineAction
|
| 387 |
+
{
|
| 388 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 389 |
+
|
| 390 |
+
public override bool Execute(ActionContext actionContext)
|
| 391 |
+
{
|
| 392 |
+
if (TimelineEditor.inspectedAsset == null)
|
| 393 |
+
return false;
|
| 394 |
+
var inspectedFrame = TimeUtility.ToFrames(TimelineEditor.inspectedSequenceTime, TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 395 |
+
inspectedFrame = Mathf.Max(0, inspectedFrame - 1);
|
| 396 |
+
TimelineEditor.inspectedSequenceTime = TimeUtility.FromFrames(inspectedFrame, TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 397 |
+
return true;
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
[Shortcut(Shortcuts.Timeline.nextFrame)]
|
| 402 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 403 |
+
class NextFrameAction : TimelineAction
|
| 404 |
+
{
|
| 405 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 406 |
+
|
| 407 |
+
public override bool Execute(ActionContext actionContext)
|
| 408 |
+
{
|
| 409 |
+
if (TimelineEditor.inspectedAsset == null)
|
| 410 |
+
return false;
|
| 411 |
+
var inspectedFrame = TimeUtility.ToFrames(TimelineEditor.inspectedSequenceTime, TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 412 |
+
inspectedFrame++;
|
| 413 |
+
TimelineEditor.inspectedSequenceTime = TimeUtility.FromFrames(inspectedFrame, TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 414 |
+
return true;
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
[Shortcut(Shortcuts.Timeline.frameAll)]
|
| 419 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 420 |
+
class FrameAllAction : TimelineAction
|
| 421 |
+
{
|
| 422 |
+
public override ActionValidity Validate(ActionContext context)
|
| 423 |
+
{
|
| 424 |
+
if (context.timeline != null && !context.timeline.flattenedTracks.Any())
|
| 425 |
+
return ActionValidity.NotApplicable;
|
| 426 |
+
|
| 427 |
+
return ActionValidity.Valid;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
public override bool Execute(ActionContext actionContext)
|
| 431 |
+
{
|
| 432 |
+
var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();
|
| 433 |
+
if (FrameSelectedAction.ShouldHandleInlineCurve(inlineCurveEditor))
|
| 434 |
+
{
|
| 435 |
+
FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, false);
|
| 436 |
+
return true;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
if (TimelineWindow.instance.state.IsCurrentEditingASequencerTextField())
|
| 440 |
+
return false;
|
| 441 |
+
|
| 442 |
+
var visibleTracks = TimelineWindow.instance.treeView.visibleTracks.ToList();
|
| 443 |
+
|
| 444 |
+
if (TimelineEditor.inspectedAsset != null && TimelineEditor.inspectedAsset.markerTrack != null)
|
| 445 |
+
visibleTracks.Add(TimelineEditor.inspectedAsset.markerTrack);
|
| 446 |
+
|
| 447 |
+
if (visibleTracks.Count == 0)
|
| 448 |
+
return false;
|
| 449 |
+
|
| 450 |
+
var startTime = float.MaxValue;
|
| 451 |
+
var endTime = float.MinValue;
|
| 452 |
+
|
| 453 |
+
foreach (var t in visibleTracks)
|
| 454 |
+
{
|
| 455 |
+
if (t == null)
|
| 456 |
+
continue;
|
| 457 |
+
|
| 458 |
+
// time range based on track's curves and clips.
|
| 459 |
+
double trackStart, trackEnd, trackDuration;
|
| 460 |
+
t.GetSequenceTime(out trackStart, out trackDuration);
|
| 461 |
+
trackEnd = trackStart + trackDuration;
|
| 462 |
+
|
| 463 |
+
// take track's markers into account
|
| 464 |
+
double itemsStart, itemsEnd;
|
| 465 |
+
ItemsUtils.GetItemRange(t, out itemsStart, out itemsEnd);
|
| 466 |
+
|
| 467 |
+
startTime = Mathf.Min(startTime, (float)trackStart, (float)itemsStart);
|
| 468 |
+
endTime = Mathf.Max(endTime, (float)(trackEnd), (float)itemsEnd);
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
FrameSelectedAction.FrameRange(startTime, endTime);
|
| 472 |
+
return true;
|
| 473 |
+
}
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 477 |
+
class FrameSelectedAction : TimelineAction
|
| 478 |
+
{
|
| 479 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 480 |
+
|
| 481 |
+
public static void FrameRange(float startTime, float endTime)
|
| 482 |
+
{
|
| 483 |
+
if (startTime > endTime)
|
| 484 |
+
{
|
| 485 |
+
return;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
var halfDuration = endTime - Math.Max(0.0f, startTime);
|
| 489 |
+
|
| 490 |
+
if (halfDuration > 0.0f)
|
| 491 |
+
{
|
| 492 |
+
TimelineEditor.visibleTimeRange = new Vector2(Mathf.Max(0.0f, startTime - (halfDuration * 0.1f)), endTime + (halfDuration * 0.1f));
|
| 493 |
+
}
|
| 494 |
+
else
|
| 495 |
+
{
|
| 496 |
+
// start == end
|
| 497 |
+
// keep the zoom level constant, only pan the time area to center the item
|
| 498 |
+
var currentRange = TimelineEditor.visibleTimeRange.y - TimelineEditor.visibleTimeRange.x;
|
| 499 |
+
TimelineEditor.visibleTimeRange = new Vector2(startTime - currentRange / 2, startTime + currentRange / 2);
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
TimelineZoomManipulator.InvalidateWheelZoom();
|
| 503 |
+
TimelineEditor.Refresh(RefreshReason.SceneNeedsUpdate);
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
public override bool Execute(ActionContext actionContext)
|
| 507 |
+
{
|
| 508 |
+
var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();
|
| 509 |
+
if (ShouldHandleInlineCurve(inlineCurveEditor))
|
| 510 |
+
{
|
| 511 |
+
FrameInlineCurves(inlineCurveEditor, true);
|
| 512 |
+
return true;
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
if (TimelineWindow.instance.state.IsCurrentEditingASequencerTextField())
|
| 516 |
+
return false;
|
| 517 |
+
|
| 518 |
+
if (SelectionManager.Count() == 0)
|
| 519 |
+
{
|
| 520 |
+
actionContext.Invoke<FrameAllAction>();
|
| 521 |
+
return true;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
var startTime = float.MaxValue;
|
| 525 |
+
var endTime = float.MinValue;
|
| 526 |
+
|
| 527 |
+
var clips = actionContext.clips.Select(ItemToItemGui.GetGuiForClip);
|
| 528 |
+
var markers = actionContext.markers;
|
| 529 |
+
if (!clips.Any() && !markers.Any())
|
| 530 |
+
return false;
|
| 531 |
+
|
| 532 |
+
foreach (var c in clips)
|
| 533 |
+
{
|
| 534 |
+
startTime = Mathf.Min(startTime, (float)c.clip.start);
|
| 535 |
+
endTime = Mathf.Max(endTime, (float)c.clip.end);
|
| 536 |
+
if (c.clipCurveEditor != null)
|
| 537 |
+
{
|
| 538 |
+
c.clipCurveEditor.FrameClip();
|
| 539 |
+
}
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
foreach (var marker in markers)
|
| 543 |
+
{
|
| 544 |
+
startTime = Mathf.Min(startTime, (float)marker.time);
|
| 545 |
+
endTime = Mathf.Max(endTime, (float)marker.time);
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
FrameRange(startTime, endTime);
|
| 549 |
+
|
| 550 |
+
return true;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
public static bool ShouldHandleInlineCurve(IClipCurveEditorOwner curveEditorOwner)
|
| 554 |
+
{
|
| 555 |
+
return curveEditorOwner?.clipCurveEditor != null &&
|
| 556 |
+
curveEditorOwner.inlineCurvesSelected &&
|
| 557 |
+
curveEditorOwner.owner != null &&
|
| 558 |
+
curveEditorOwner.owner.GetShowInlineCurves();
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
public static void FrameInlineCurves(IClipCurveEditorOwner curveEditorOwner, bool selectionOnly)
|
| 562 |
+
{
|
| 563 |
+
var curveEditor = curveEditorOwner.clipCurveEditor.curveEditor;
|
| 564 |
+
var frameBounds = selectionOnly ? curveEditor.GetSelectionBounds() : curveEditor.GetClipBounds();
|
| 565 |
+
|
| 566 |
+
var clipGUI = curveEditorOwner as TimelineClipGUI;
|
| 567 |
+
var areaOffset = 0.0f;
|
| 568 |
+
|
| 569 |
+
if (clipGUI != null)
|
| 570 |
+
{
|
| 571 |
+
areaOffset = (float)Math.Max(0.0, clipGUI.clip.FromLocalTimeUnbound(0.0));
|
| 572 |
+
|
| 573 |
+
var timeScale = (float)clipGUI.clip.timeScale; // Note: The getter for clip.timeScale is guaranteed to never be zero.
|
| 574 |
+
|
| 575 |
+
// Apply scaling
|
| 576 |
+
var newMin = frameBounds.min.x / timeScale;
|
| 577 |
+
var newMax = (frameBounds.max.x - frameBounds.min.x) / timeScale + newMin;
|
| 578 |
+
|
| 579 |
+
frameBounds.SetMinMax(
|
| 580 |
+
new Vector3(newMin, frameBounds.min.y, frameBounds.min.z),
|
| 581 |
+
new Vector3(newMax, frameBounds.max.y, frameBounds.max.z));
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
curveEditor.Frame(frameBounds, true, true);
|
| 585 |
+
|
| 586 |
+
var area = curveEditor.shownAreaInsideMargins;
|
| 587 |
+
area.x += areaOffset;
|
| 588 |
+
|
| 589 |
+
var curveStart = curveEditorOwner.clipCurveEditor.dataSource.start;
|
| 590 |
+
FrameRange(curveStart + frameBounds.min.x, curveStart + frameBounds.max.x);
|
| 591 |
+
}
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
[Shortcut(Shortcuts.Timeline.previousKey)]
|
| 595 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 596 |
+
class PrevKeyAction : TimelineAction
|
| 597 |
+
{
|
| 598 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 599 |
+
|
| 600 |
+
public override bool Execute(ActionContext actionContext)
|
| 601 |
+
{
|
| 602 |
+
if (TimelineEditor.inspectedAsset == null)
|
| 603 |
+
return false;
|
| 604 |
+
var keyTraverser = new Utilities.KeyTraverser(TimelineEditor.inspectedAsset, 0.01f / TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 605 |
+
var time = keyTraverser.GetPrevKey((float)TimelineEditor.inspectedSequenceTime, TimelineWindow.instance.state.dirtyStamp);
|
| 606 |
+
if (time != TimelineEditor.inspectedSequenceTime)
|
| 607 |
+
{
|
| 608 |
+
TimelineEditor.inspectedSequenceTime = time;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
return true;
|
| 612 |
+
}
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
[Shortcut(Shortcuts.Timeline.nextKey)]
|
| 616 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 617 |
+
class NextKeyAction : TimelineAction
|
| 618 |
+
{
|
| 619 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 620 |
+
|
| 621 |
+
public override bool Execute(ActionContext actionContext)
|
| 622 |
+
{
|
| 623 |
+
if (TimelineEditor.inspectedAsset == null)
|
| 624 |
+
return false;
|
| 625 |
+
var keyTraverser = new Utilities.KeyTraverser(TimelineEditor.inspectedAsset, 0.01f / TimelineEditor.inspectedAsset.editorSettings.fps);
|
| 626 |
+
var time = keyTraverser.GetNextKey((float)TimelineEditor.inspectedSequenceTime, TimelineWindow.instance.state.dirtyStamp);
|
| 627 |
+
if (time != TimelineEditor.inspectedSequenceTime)
|
| 628 |
+
{
|
| 629 |
+
TimelineEditor.inspectedSequenceTime = time;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
return true;
|
| 633 |
+
}
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
[Shortcut(Shortcuts.Timeline.goToStart)]
|
| 637 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 638 |
+
class GotoStartAction : TimelineAction
|
| 639 |
+
{
|
| 640 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 641 |
+
|
| 642 |
+
public override bool Execute(ActionContext actionContext)
|
| 643 |
+
{
|
| 644 |
+
TimelineEditor.inspectedSequenceTime = 0.0f;
|
| 645 |
+
TimelineWindow.instance.state.EnsurePlayHeadIsVisible();
|
| 646 |
+
|
| 647 |
+
return true;
|
| 648 |
+
}
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
[Shortcut(Shortcuts.Timeline.goToEnd)]
|
| 652 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 653 |
+
class GotoEndAction : TimelineAction
|
| 654 |
+
{
|
| 655 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 656 |
+
|
| 657 |
+
public override bool Execute(ActionContext actionContext)
|
| 658 |
+
{
|
| 659 |
+
TimelineEditor.inspectedSequenceTime = TimelineWindow.instance.state.editSequence.duration;
|
| 660 |
+
TimelineWindow.instance.state.EnsurePlayHeadIsVisible();
|
| 661 |
+
|
| 662 |
+
return true;
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
[Shortcut(Shortcuts.Timeline.zoomIn)]
|
| 667 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 668 |
+
class ZoomIn : TimelineAction
|
| 669 |
+
{
|
| 670 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 671 |
+
|
| 672 |
+
public override bool Execute(ActionContext actionContext)
|
| 673 |
+
{
|
| 674 |
+
TimelineZoomManipulator.Instance.DoZoom(1.15f);
|
| 675 |
+
return true;
|
| 676 |
+
}
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
[Shortcut(Shortcuts.Timeline.zoomOut)]
|
| 680 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 681 |
+
class ZoomOut : TimelineAction
|
| 682 |
+
{
|
| 683 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 684 |
+
|
| 685 |
+
public override bool Execute(ActionContext actionContext)
|
| 686 |
+
{
|
| 687 |
+
TimelineZoomManipulator.Instance.DoZoom(0.85f);
|
| 688 |
+
return true;
|
| 689 |
+
}
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
[Shortcut(Shortcuts.Timeline.collapseGroup)]
|
| 693 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 694 |
+
class CollapseGroup : TimelineAction
|
| 695 |
+
{
|
| 696 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 697 |
+
|
| 698 |
+
public override bool Execute(ActionContext actionContext)
|
| 699 |
+
{
|
| 700 |
+
return KeyboardNavigation.CollapseGroup(actionContext.tracks);
|
| 701 |
+
}
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
[Shortcut(Shortcuts.Timeline.unCollapseGroup)]
|
| 705 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 706 |
+
class UnCollapseGroup : TimelineAction
|
| 707 |
+
{
|
| 708 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 709 |
+
|
| 710 |
+
public override bool Execute(ActionContext actionContext)
|
| 711 |
+
{
|
| 712 |
+
return KeyboardNavigation.UnCollapseGroup(actionContext.tracks);
|
| 713 |
+
}
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
[Shortcut(Shortcuts.Timeline.selectLeftItem)]
|
| 717 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 718 |
+
class SelectLeftClip : TimelineAction
|
| 719 |
+
{
|
| 720 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 721 |
+
|
| 722 |
+
public override bool Execute(ActionContext actionContext)
|
| 723 |
+
{
|
| 724 |
+
// Switches to track header if no left track exists
|
| 725 |
+
return KeyboardNavigation.SelectLeftItem();
|
| 726 |
+
}
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
[Shortcut(Shortcuts.Timeline.selectRightItem)]
|
| 730 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 731 |
+
class SelectRightClip : TimelineAction
|
| 732 |
+
{
|
| 733 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 734 |
+
|
| 735 |
+
public override bool Execute(ActionContext actionContext)
|
| 736 |
+
{
|
| 737 |
+
return KeyboardNavigation.SelectRightItem();
|
| 738 |
+
}
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
[Shortcut(Shortcuts.Timeline.selectUpItem)]
|
| 742 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 743 |
+
class SelectUpClip : TimelineAction
|
| 744 |
+
{
|
| 745 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 746 |
+
|
| 747 |
+
public override bool Execute(ActionContext actionContext)
|
| 748 |
+
{
|
| 749 |
+
return KeyboardNavigation.SelectUpItem();
|
| 750 |
+
}
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
[Shortcut(Shortcuts.Timeline.selectUpTrack)]
|
| 754 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 755 |
+
class SelectUpTrack : TimelineAction
|
| 756 |
+
{
|
| 757 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 758 |
+
|
| 759 |
+
public override bool Execute(ActionContext actionContext)
|
| 760 |
+
{
|
| 761 |
+
return KeyboardNavigation.SelectUpTrack();
|
| 762 |
+
}
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
[Shortcut(Shortcuts.Timeline.selectDownItem)]
|
| 766 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 767 |
+
class SelectDownClip : TimelineAction
|
| 768 |
+
{
|
| 769 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 770 |
+
|
| 771 |
+
public override bool Execute(ActionContext actionContext)
|
| 772 |
+
{
|
| 773 |
+
return KeyboardNavigation.SelectDownItem();
|
| 774 |
+
}
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
[Shortcut(Shortcuts.Timeline.selectDownTrack)]
|
| 778 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 779 |
+
class SelectDownTrack : TimelineAction
|
| 780 |
+
{
|
| 781 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 782 |
+
|
| 783 |
+
public override bool Execute(ActionContext actionContext)
|
| 784 |
+
{
|
| 785 |
+
if (!KeyboardNavigation.ClipAreaActive() && !KeyboardNavigation.TrackHeadActive())
|
| 786 |
+
return KeyboardNavigation.FocusFirstVisibleItem();
|
| 787 |
+
else
|
| 788 |
+
return KeyboardNavigation.SelectDownTrack();
|
| 789 |
+
}
|
| 790 |
+
}
|
| 791 |
+
|
| 792 |
+
[Shortcut(Shortcuts.Timeline.multiSelectLeft)]
|
| 793 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 794 |
+
class MultiselectLeftClip : TimelineAction
|
| 795 |
+
{
|
| 796 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 797 |
+
|
| 798 |
+
public override bool Execute(ActionContext actionContext)
|
| 799 |
+
{
|
| 800 |
+
return KeyboardNavigation.SelectLeftItem(true);
|
| 801 |
+
}
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
[Shortcut(Shortcuts.Timeline.multiSelectRight)]
|
| 805 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 806 |
+
class MultiselectRightClip : TimelineAction
|
| 807 |
+
{
|
| 808 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 809 |
+
|
| 810 |
+
public override bool Execute(ActionContext actionContext)
|
| 811 |
+
{
|
| 812 |
+
return KeyboardNavigation.SelectRightItem(true);
|
| 813 |
+
}
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
[Shortcut(Shortcuts.Timeline.multiSelectUp)]
|
| 817 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 818 |
+
class MultiselectUpTrack : TimelineAction
|
| 819 |
+
{
|
| 820 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 821 |
+
|
| 822 |
+
public override bool Execute(ActionContext actionContext)
|
| 823 |
+
{
|
| 824 |
+
return KeyboardNavigation.SelectUpTrack(true);
|
| 825 |
+
}
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
[Shortcut(Shortcuts.Timeline.multiSelectDown)]
|
| 829 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 830 |
+
class MultiselectDownTrack : TimelineAction
|
| 831 |
+
{
|
| 832 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 833 |
+
|
| 834 |
+
public override bool Execute(ActionContext actionContext)
|
| 835 |
+
{
|
| 836 |
+
return KeyboardNavigation.SelectDownTrack(true);
|
| 837 |
+
}
|
| 838 |
+
}
|
| 839 |
+
|
| 840 |
+
[Shortcut(Shortcuts.Timeline.toggleClipTrackArea)]
|
| 841 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 842 |
+
class ToggleClipTrackArea : TimelineAction
|
| 843 |
+
{
|
| 844 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 845 |
+
|
| 846 |
+
|
| 847 |
+
public override bool Execute(ActionContext actionContext)
|
| 848 |
+
{
|
| 849 |
+
if (KeyboardNavigation.TrackHeadActive())
|
| 850 |
+
return KeyboardNavigation.FocusFirstVisibleItem(actionContext.tracks);
|
| 851 |
+
|
| 852 |
+
if (!KeyboardNavigation.ClipAreaActive())
|
| 853 |
+
return KeyboardNavigation.FocusFirstVisibleItem();
|
| 854 |
+
|
| 855 |
+
var item = KeyboardNavigation.GetVisibleSelectedItems().LastOrDefault();
|
| 856 |
+
if (item != null)
|
| 857 |
+
SelectionManager.SelectOnly(item.parentTrack);
|
| 858 |
+
return true;
|
| 859 |
+
}
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
[MenuEntry("Mute Timeline Markers", MenuPriority.TrackActionSection.mute, MenuFilter.MarkerHeader)]
|
| 863 |
+
class ToggleMuteMarkersOnTimeline : TimelineAction, IMenuChecked
|
| 864 |
+
{
|
| 865 |
+
public bool isChecked
|
| 866 |
+
{
|
| 867 |
+
get => IsMarkerTrackValid() && TimelineEditor.inspectedAsset.markerTrack.muted;
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 871 |
+
|
| 872 |
+
|
| 873 |
+
public override bool Execute(ActionContext actionContext)
|
| 874 |
+
{
|
| 875 |
+
if (TimelineEditor.state.showMarkerHeader)
|
| 876 |
+
ToggleMute();
|
| 877 |
+
return true;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
static void ToggleMute()
|
| 881 |
+
{
|
| 882 |
+
var timeline = TimelineEditor.inspectedAsset;
|
| 883 |
+
timeline.CreateMarkerTrack();
|
| 884 |
+
|
| 885 |
+
TimelineUndo.PushUndo(timeline.markerTrack, "Toggle Mute");
|
| 886 |
+
timeline.markerTrack.muted = !timeline.markerTrack.muted;
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
static bool IsMarkerTrackValid()
|
| 890 |
+
{
|
| 891 |
+
var timeline = TimelineEditor.inspectedAsset;
|
| 892 |
+
return timeline != null && timeline.markerTrack != null;
|
| 893 |
+
}
|
| 894 |
+
}
|
| 895 |
+
|
| 896 |
+
[MenuEntry("Show Timeline Markers", MenuPriority.TrackActionSection.showHideMarkers, MenuFilter.MarkerHeader)]
|
| 897 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 898 |
+
class ToggleShowMarkersOnTimeline : TimelineAction, IMenuChecked
|
| 899 |
+
{
|
| 900 |
+
public bool isChecked
|
| 901 |
+
{
|
| 902 |
+
get => TimelineEditor.state.showMarkerHeader;
|
| 903 |
+
}
|
| 904 |
+
|
| 905 |
+
public override ActionValidity Validate(ActionContext context) => ActionValidity.Valid;
|
| 906 |
+
|
| 907 |
+
public override bool Execute(ActionContext context)
|
| 908 |
+
{
|
| 909 |
+
ToggleShow();
|
| 910 |
+
return true;
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
static void ToggleShow()
|
| 914 |
+
{
|
| 915 |
+
TimelineEditor.state.showMarkerHeader = !TimelineEditor.state.showMarkerHeader;
|
| 916 |
+
}
|
| 917 |
+
}
|
| 918 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TimelineActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: b1c789407b55e3a4c9cc86135a714e33
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackAction.cs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using UnityEngine.Timeline;
|
| 3 |
+
|
| 4 |
+
namespace UnityEditor.Timeline.Actions
|
| 5 |
+
{
|
| 6 |
+
/// <summary>
|
| 7 |
+
/// Base class for a track action.
|
| 8 |
+
/// Inherit from this class to make an action that would react on selected tracks after a menu click and/or a key shortcut.
|
| 9 |
+
/// </summary>
|
| 10 |
+
/// <example>
|
| 11 |
+
/// Simple track Action example (with context menu and shortcut support).
|
| 12 |
+
/// <code source="../../DocCodeExamples/ActionExamples.cs" region="declare-sampleTrackAction" title="SampleTrackAction"/>
|
| 13 |
+
/// </example>
|
| 14 |
+
/// <remarks>
|
| 15 |
+
/// To add an action as a menu item in the Timeline context menu, add <see cref="MenuEntryAttribute"/> on the action class.
|
| 16 |
+
/// To make an action to react to a shortcut, use the Shortcut Manager API with <see cref="TimelineShortcutAttribute"/>.
|
| 17 |
+
/// <seealso cref="UnityEditor.ShortcutManagement.ShortcutAttribute"/>
|
| 18 |
+
/// </remarks>
|
| 19 |
+
[ActiveInMode(TimelineModes.Default)]
|
| 20 |
+
public abstract class TrackAction : IAction
|
| 21 |
+
{
|
| 22 |
+
/// <summary>
|
| 23 |
+
/// Execute the action.
|
| 24 |
+
/// </summary>
|
| 25 |
+
/// <param name="tracks">Tracks that will be used for the action. </param>
|
| 26 |
+
/// <returns>true if the action has been executed. false otherwise</returns>
|
| 27 |
+
public abstract bool Execute(IEnumerable<TrackAsset> tracks);
|
| 28 |
+
|
| 29 |
+
/// <summary>
|
| 30 |
+
/// Defines the validity of an Action for a given set of tracks.
|
| 31 |
+
/// </summary>
|
| 32 |
+
/// <param name="tracks">tracks that the action would act on.</param>
|
| 33 |
+
/// <returns>The validity of the set of tracks.</returns>
|
| 34 |
+
public abstract ActionValidity Validate(IEnumerable<TrackAsset> tracks);
|
| 35 |
+
}
|
| 36 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackAction.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: bcac94f4ceb0c8049bf47480708ca7e2
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackActions.cs
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using JetBrains.Annotations;
|
| 5 |
+
using UnityEditor.Timeline.Actions;
|
| 6 |
+
using UnityEngine;
|
| 7 |
+
using UnityEngine.Timeline;
|
| 8 |
+
|
| 9 |
+
namespace UnityEditor.Timeline
|
| 10 |
+
{
|
| 11 |
+
[MenuEntry("Edit in Animation Window", MenuPriority.TrackActionSection.editInAnimationWindow)]
|
| 12 |
+
class EditTrackInAnimationWindow : TrackAction
|
| 13 |
+
{
|
| 14 |
+
public static bool Do(TrackAsset track)
|
| 15 |
+
{
|
| 16 |
+
AnimationClip clipToEdit = null;
|
| 17 |
+
|
| 18 |
+
AnimationTrack animationTrack = track as AnimationTrack;
|
| 19 |
+
if (animationTrack != null)
|
| 20 |
+
{
|
| 21 |
+
if (!animationTrack.CanConvertToClipMode())
|
| 22 |
+
return false;
|
| 23 |
+
|
| 24 |
+
clipToEdit = animationTrack.infiniteClip;
|
| 25 |
+
}
|
| 26 |
+
else if (track.hasCurves)
|
| 27 |
+
{
|
| 28 |
+
clipToEdit = track.curves;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (clipToEdit == null)
|
| 32 |
+
return false;
|
| 33 |
+
|
| 34 |
+
GameObject gameObject = null;
|
| 35 |
+
if (TimelineEditor.inspectedDirector != null)
|
| 36 |
+
gameObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, track);
|
| 37 |
+
|
| 38 |
+
var timeController = TimelineAnimationUtilities.CreateTimeController(CreateTimeControlClipData(track));
|
| 39 |
+
TimelineAnimationUtilities.EditAnimationClipWithTimeController(clipToEdit, timeController, gameObject);
|
| 40 |
+
|
| 41 |
+
return true;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 45 |
+
{
|
| 46 |
+
if (!tracks.Any())
|
| 47 |
+
return ActionValidity.Invalid;
|
| 48 |
+
|
| 49 |
+
var firstTrack = tracks.First();
|
| 50 |
+
if (firstTrack is AnimationTrack)
|
| 51 |
+
{
|
| 52 |
+
var animTrack = firstTrack as AnimationTrack;
|
| 53 |
+
if (animTrack.CanConvertToClipMode())
|
| 54 |
+
return ActionValidity.Valid;
|
| 55 |
+
}
|
| 56 |
+
else if (firstTrack.hasCurves)
|
| 57 |
+
{
|
| 58 |
+
return ActionValidity.Valid;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
return ActionValidity.NotApplicable;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 65 |
+
{
|
| 66 |
+
return Do(tracks.First());
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
static TimelineWindowTimeControl.ClipData CreateTimeControlClipData(TrackAsset track)
|
| 70 |
+
{
|
| 71 |
+
var data = new TimelineWindowTimeControl.ClipData();
|
| 72 |
+
data.track = track;
|
| 73 |
+
data.start = track.start;
|
| 74 |
+
data.duration = track.duration;
|
| 75 |
+
return data;
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
[MenuEntry("Lock selected track only", MenuPriority.TrackActionSection.lockSelected)]
|
| 80 |
+
class LockSelectedTrack : TrackAction, IMenuName
|
| 81 |
+
{
|
| 82 |
+
public static readonly string LockSelectedTrackOnlyText = L10n.Tr("Lock selected track only");
|
| 83 |
+
public static readonly string UnlockSelectedTrackOnlyText = L10n.Tr("Unlock selected track only");
|
| 84 |
+
|
| 85 |
+
public string menuName { get; private set; }
|
| 86 |
+
|
| 87 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 88 |
+
{
|
| 89 |
+
UpdateMenuName(tracks);
|
| 90 |
+
if (tracks.Any(track => TimelineUtility.IsLockedFromGroup(track) || track is GroupTrack || !track.subTracksObjects.Any()))
|
| 91 |
+
return ActionValidity.NotApplicable;
|
| 92 |
+
return ActionValidity.Valid;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 96 |
+
{
|
| 97 |
+
if (!tracks.Any()) return false;
|
| 98 |
+
|
| 99 |
+
var hasUnlockedTracks = tracks.Any(x => !x.locked);
|
| 100 |
+
Lock(tracks.Where(p => !(p is GroupTrack)).ToArray(), hasUnlockedTracks);
|
| 101 |
+
return true;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
void UpdateMenuName(IEnumerable<TrackAsset> tracks)
|
| 105 |
+
{
|
| 106 |
+
menuName = tracks.All(t => t.locked) ? UnlockSelectedTrackOnlyText : LockSelectedTrackOnlyText;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
public static void Lock(TrackAsset[] tracks, bool shouldlock)
|
| 110 |
+
{
|
| 111 |
+
if (tracks.Length == 0)
|
| 112 |
+
return;
|
| 113 |
+
|
| 114 |
+
foreach (var track in tracks.Where(t => !TimelineUtility.IsLockedFromGroup(t)))
|
| 115 |
+
{
|
| 116 |
+
TimelineUndo.PushUndo(track, "Lock Tracks");
|
| 117 |
+
track.locked = shouldlock;
|
| 118 |
+
}
|
| 119 |
+
TimelineEditor.Refresh(RefreshReason.WindowNeedsRedraw);
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
[MenuEntry("Lock", MenuPriority.TrackActionSection.lockTrack)]
|
| 124 |
+
[Shortcut(Shortcuts.Timeline.toggleLock)]
|
| 125 |
+
class LockTrack : TrackAction, IMenuName
|
| 126 |
+
{
|
| 127 |
+
static readonly string k_LockText = L10n.Tr("Lock");
|
| 128 |
+
static readonly string k_UnlockText = L10n.Tr("Unlock");
|
| 129 |
+
|
| 130 |
+
public string menuName { get; private set; }
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
void UpdateMenuName(IEnumerable<TrackAsset> tracks)
|
| 134 |
+
{
|
| 135 |
+
menuName = tracks.Any(x => !x.locked) ? k_LockText : k_UnlockText;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 139 |
+
{
|
| 140 |
+
if (!tracks.Any()) return false;
|
| 141 |
+
|
| 142 |
+
var hasUnlockedTracks = tracks.Any(x => !x.locked);
|
| 143 |
+
SetLockState(tracks, hasUnlockedTracks);
|
| 144 |
+
return true;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 148 |
+
{
|
| 149 |
+
UpdateMenuName(tracks);
|
| 150 |
+
if (tracks.Any(TimelineUtility.IsLockedFromGroup))
|
| 151 |
+
return ActionValidity.Invalid;
|
| 152 |
+
return ActionValidity.Valid;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
public static void SetLockState(IEnumerable<TrackAsset> tracks, bool shouldLock)
|
| 156 |
+
{
|
| 157 |
+
if (!tracks.Any())
|
| 158 |
+
return;
|
| 159 |
+
|
| 160 |
+
foreach (var track in tracks)
|
| 161 |
+
{
|
| 162 |
+
if (TimelineUtility.IsLockedFromGroup(track))
|
| 163 |
+
continue;
|
| 164 |
+
|
| 165 |
+
if (track as GroupTrack == null)
|
| 166 |
+
SetLockState(track.GetChildTracks().ToArray(), shouldLock);
|
| 167 |
+
|
| 168 |
+
TimelineUndo.PushUndo(track, "Lock Tracks");
|
| 169 |
+
track.locked = shouldLock;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
// find the tracks we've locked. unselect anything locked and remove recording.
|
| 173 |
+
foreach (var track in tracks)
|
| 174 |
+
{
|
| 175 |
+
if (TimelineUtility.IsLockedFromGroup(track) || !track.locked)
|
| 176 |
+
continue;
|
| 177 |
+
|
| 178 |
+
var flattenedChildTracks = track.GetFlattenedChildTracks();
|
| 179 |
+
foreach (var i in track.clips)
|
| 180 |
+
SelectionManager.Remove(i);
|
| 181 |
+
track.UnarmForRecord();
|
| 182 |
+
foreach (var child in flattenedChildTracks)
|
| 183 |
+
{
|
| 184 |
+
SelectionManager.Remove(child);
|
| 185 |
+
child.UnarmForRecord();
|
| 186 |
+
foreach (var clip in child.GetClips())
|
| 187 |
+
SelectionManager.Remove(clip);
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
// no need to rebuild, just repaint (including inspectors)
|
| 192 |
+
InspectorWindow.RepaintAllInspectors();
|
| 193 |
+
TimelineEditor.Refresh(RefreshReason.WindowNeedsRedraw);
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
[UsedImplicitly]
|
| 198 |
+
[MenuEntry("Show Markers", MenuPriority.TrackActionSection.showHideMarkers)]
|
| 199 |
+
[ActiveInMode(TimelineModes.Default | TimelineModes.ReadOnly)]
|
| 200 |
+
class ShowHideMarkers : TrackAction, IMenuChecked
|
| 201 |
+
{
|
| 202 |
+
public bool isChecked { get; private set; }
|
| 203 |
+
|
| 204 |
+
void UpdateCheckedStatus(IEnumerable<TrackAsset> tracks)
|
| 205 |
+
{
|
| 206 |
+
isChecked = tracks.All(x => x.GetShowMarkers());
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 210 |
+
{
|
| 211 |
+
UpdateCheckedStatus(tracks);
|
| 212 |
+
if (tracks.Any(x => x is GroupTrack) || tracks.Any(t => t.GetMarkerCount() == 0))
|
| 213 |
+
return ActionValidity.NotApplicable;
|
| 214 |
+
|
| 215 |
+
if (tracks.Any(t => t.lockedInHierarchy))
|
| 216 |
+
{
|
| 217 |
+
return ActionValidity.Invalid;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
return ActionValidity.Valid;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 224 |
+
{
|
| 225 |
+
if (!tracks.Any()) return false;
|
| 226 |
+
|
| 227 |
+
var hasUnlockedTracks = tracks.Any(x => !x.GetShowMarkers());
|
| 228 |
+
ShowHide(tracks, hasUnlockedTracks);
|
| 229 |
+
return true;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
static void ShowHide(IEnumerable<TrackAsset> tracks, bool shouldLock)
|
| 233 |
+
{
|
| 234 |
+
if (!tracks.Any())
|
| 235 |
+
return;
|
| 236 |
+
|
| 237 |
+
foreach (var track in tracks)
|
| 238 |
+
track.SetShowTrackMarkers(shouldLock);
|
| 239 |
+
|
| 240 |
+
TimelineEditor.Refresh(RefreshReason.WindowNeedsRedraw);
|
| 241 |
+
}
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
[MenuEntry("Mute selected track only", MenuPriority.TrackActionSection.muteSelected), UsedImplicitly]
|
| 245 |
+
class MuteSelectedTrack : TrackAction, IMenuName
|
| 246 |
+
{
|
| 247 |
+
public static readonly string MuteSelectedText = L10n.Tr("Mute selected track only");
|
| 248 |
+
public static readonly string UnmuteSelectedText = L10n.Tr("Unmute selected track only");
|
| 249 |
+
|
| 250 |
+
public string menuName { get; private set; }
|
| 251 |
+
|
| 252 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 253 |
+
{
|
| 254 |
+
UpdateMenuName(tracks);
|
| 255 |
+
if (tracks.Any(track => TimelineUtility.IsParentMuted(track) || track is GroupTrack || !track.subTracksObjects.Any()))
|
| 256 |
+
return ActionValidity.NotApplicable;
|
| 257 |
+
return ActionValidity.Valid;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 261 |
+
{
|
| 262 |
+
if (!tracks.Any())
|
| 263 |
+
return false;
|
| 264 |
+
|
| 265 |
+
var hasUnmutedTracks = tracks.Any(x => !x.muted);
|
| 266 |
+
Mute(tracks.Where(p => !(p is GroupTrack)).ToArray(), hasUnmutedTracks);
|
| 267 |
+
return true;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
void UpdateMenuName(IEnumerable<TrackAsset> tracks)
|
| 271 |
+
{
|
| 272 |
+
menuName = tracks.All(t => t.muted) ? UnmuteSelectedText : MuteSelectedText;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
public static void Mute(TrackAsset[] tracks, bool shouldMute)
|
| 276 |
+
{
|
| 277 |
+
if (tracks.Length == 0)
|
| 278 |
+
return;
|
| 279 |
+
|
| 280 |
+
foreach (var track in tracks.Where(t => !TimelineUtility.IsParentMuted(t)))
|
| 281 |
+
{
|
| 282 |
+
TimelineUndo.PushUndo(track, "Mute Tracks");
|
| 283 |
+
track.muted = shouldMute;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
[MenuEntry("Mute", MenuPriority.TrackActionSection.mute)]
|
| 291 |
+
[Shortcut(Shortcuts.Timeline.toggleMute)]
|
| 292 |
+
class MuteTrack : TrackAction, IMenuName
|
| 293 |
+
{
|
| 294 |
+
static readonly string k_MuteText = L10n.Tr("Mute");
|
| 295 |
+
static readonly string k_UnMuteText = L10n.Tr("Unmute");
|
| 296 |
+
|
| 297 |
+
public string menuName { get; private set; }
|
| 298 |
+
|
| 299 |
+
void UpdateMenuName(IEnumerable<TrackAsset> tracks)
|
| 300 |
+
{
|
| 301 |
+
menuName = tracks.Any(x => !x.muted) ? k_MuteText : k_UnMuteText;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 305 |
+
{
|
| 306 |
+
if (!tracks.Any() || tracks.Any(TimelineUtility.IsParentMuted))
|
| 307 |
+
return false;
|
| 308 |
+
|
| 309 |
+
var hasUnmutedTracks = tracks.Any(x => !x.muted);
|
| 310 |
+
Mute(tracks, hasUnmutedTracks);
|
| 311 |
+
return true;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 315 |
+
{
|
| 316 |
+
UpdateMenuName(tracks);
|
| 317 |
+
if (tracks.Any(TimelineUtility.IsLockedFromGroup))
|
| 318 |
+
return ActionValidity.Invalid;
|
| 319 |
+
return ActionValidity.Valid;
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
public static void Mute(IEnumerable<TrackAsset> tracks, bool shouldMute)
|
| 323 |
+
{
|
| 324 |
+
if (!tracks.Any())
|
| 325 |
+
return;
|
| 326 |
+
|
| 327 |
+
foreach (var track in tracks)
|
| 328 |
+
{
|
| 329 |
+
if (track as GroupTrack == null)
|
| 330 |
+
Mute(track.GetChildTracks().ToArray(), shouldMute);
|
| 331 |
+
TimelineUndo.PushUndo(track, "Mute Tracks");
|
| 332 |
+
track.muted = shouldMute;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
class DeleteTracks : TrackAction
|
| 340 |
+
{
|
| 341 |
+
public static void Do(TimelineAsset timeline, TrackAsset track)
|
| 342 |
+
{
|
| 343 |
+
SelectionManager.Remove(track);
|
| 344 |
+
TrackModifier.DeleteTrack(timeline, track);
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks) => ActionValidity.Valid;
|
| 348 |
+
|
| 349 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 350 |
+
{
|
| 351 |
+
// disable preview mode so deleted tracks revert to default state
|
| 352 |
+
// Case 956129: Disable preview mode _before_ deleting the tracks, since clip data is still needed
|
| 353 |
+
TimelineEditor.state.previewMode = false;
|
| 354 |
+
|
| 355 |
+
TimelineAnimationUtilities.UnlinkAnimationWindowFromTracks(tracks);
|
| 356 |
+
|
| 357 |
+
foreach (var track in tracks)
|
| 358 |
+
Do(TimelineEditor.inspectedAsset, track);
|
| 359 |
+
|
| 360 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 361 |
+
|
| 362 |
+
return true;
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
class CopyTracksToClipboard : TrackAction
|
| 367 |
+
{
|
| 368 |
+
public static bool Do(TrackAsset[] tracks)
|
| 369 |
+
{
|
| 370 |
+
var action = new CopyTracksToClipboard();
|
| 371 |
+
return action.Execute(tracks);
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks) => ActionValidity.Valid;
|
| 375 |
+
|
| 376 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 377 |
+
{
|
| 378 |
+
TimelineEditor.clipboard.CopyTracks(tracks);
|
| 379 |
+
|
| 380 |
+
return true;
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
class DuplicateTracks : TrackAction
|
| 385 |
+
{
|
| 386 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks) => ActionValidity.Valid;
|
| 387 |
+
|
| 388 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 389 |
+
{
|
| 390 |
+
if (tracks.Any())
|
| 391 |
+
{
|
| 392 |
+
SelectionManager.RemoveTimelineSelection();
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
foreach (var track in TrackExtensions.FilterTracks(tracks))
|
| 396 |
+
{
|
| 397 |
+
var newTrack = track.Duplicate(TimelineEditor.inspectedDirector, TimelineEditor.inspectedDirector);
|
| 398 |
+
SelectionManager.Add(newTrack);
|
| 399 |
+
foreach (var childTrack in newTrack.GetFlattenedChildTracks())
|
| 400 |
+
{
|
| 401 |
+
SelectionManager.Add(childTrack);
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
if (TimelineEditor.inspectedDirector != null)
|
| 405 |
+
{
|
| 406 |
+
var binding = TimelineEditor.inspectedDirector.GetGenericBinding(track);
|
| 407 |
+
if (binding != null)
|
| 408 |
+
{
|
| 409 |
+
TimelineUndo.PushUndo(TimelineEditor.inspectedDirector, "Duplicate");
|
| 410 |
+
TimelineEditor.inspectedDirector.SetGenericBinding(newTrack, binding);
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 416 |
+
|
| 417 |
+
return true;
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
[MenuEntry("Remove Invalid Markers", MenuPriority.TrackActionSection.removeInvalidMarkers), UsedImplicitly]
|
| 422 |
+
class RemoveInvalidMarkersAction : TrackAction
|
| 423 |
+
{
|
| 424 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 425 |
+
{
|
| 426 |
+
if (tracks.Any(target => target != null && target.GetMarkerCount() != target.GetMarkersRaw().Count()))
|
| 427 |
+
return ActionValidity.Valid;
|
| 428 |
+
|
| 429 |
+
return ActionValidity.NotApplicable;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 433 |
+
{
|
| 434 |
+
bool anyRemoved = false;
|
| 435 |
+
foreach (var target in tracks)
|
| 436 |
+
{
|
| 437 |
+
var invalids = target.GetMarkersRaw().Where(x => !(x is IMarker)).ToList();
|
| 438 |
+
foreach (var m in invalids)
|
| 439 |
+
{
|
| 440 |
+
anyRemoved = true;
|
| 441 |
+
target.DeleteMarkerRaw(m);
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
if (anyRemoved)
|
| 446 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 447 |
+
|
| 448 |
+
return anyRemoved;
|
| 449 |
+
}
|
| 450 |
+
}
|
| 451 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Actions/TrackActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: fda82b5ca7a4c5f40b497c4f5f4bd950
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackEditor.cs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using JetBrains.Annotations;
|
| 2 |
+
using UnityEngine;
|
| 3 |
+
using UnityEngine.Timeline;
|
| 4 |
+
using UnityEngine.Playables;
|
| 5 |
+
|
| 6 |
+
namespace UnityEditor.Timeline
|
| 7 |
+
{
|
| 8 |
+
[UsedImplicitly]
|
| 9 |
+
[CustomTimelineEditor(typeof(ActivationTrack))]
|
| 10 |
+
class ActivationTrackEditor : TrackEditor
|
| 11 |
+
{
|
| 12 |
+
static readonly string ClipText = L10n.Tr("Active");
|
| 13 |
+
|
| 14 |
+
static readonly string k_ErrorParentString = L10n.Tr("The bound GameObject is a parent of the PlayableDirector.");
|
| 15 |
+
static readonly string k_ErrorString = L10n.Tr("The bound GameObject contains the PlayableDirector.");
|
| 16 |
+
|
| 17 |
+
public override TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
|
| 18 |
+
{
|
| 19 |
+
var options = base.GetTrackOptions(track, binding);
|
| 20 |
+
options.errorText = GetErrorText(track, binding);
|
| 21 |
+
return options;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
string GetErrorText(TrackAsset track, Object binding)
|
| 25 |
+
{
|
| 26 |
+
var gameObject = binding as GameObject;
|
| 27 |
+
var currentDirector = TimelineEditor.inspectedDirector;
|
| 28 |
+
if (gameObject != null && currentDirector != null)
|
| 29 |
+
{
|
| 30 |
+
var director = gameObject.GetComponent<PlayableDirector>();
|
| 31 |
+
if (currentDirector == director)
|
| 32 |
+
{
|
| 33 |
+
return k_ErrorString;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (currentDirector.gameObject.transform.IsChildOf(gameObject.transform))
|
| 37 |
+
{
|
| 38 |
+
return k_ErrorParentString;
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return base.GetErrorText(track, binding, TrackBindingErrors.PrefabBound);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
|
| 46 |
+
{
|
| 47 |
+
// Add a default clip to the newly created track
|
| 48 |
+
if (copiedFrom == null)
|
| 49 |
+
{
|
| 50 |
+
var clip = track.CreateClip(0);
|
| 51 |
+
clip.displayName = ClipText;
|
| 52 |
+
clip.duration = System.Math.Max(clip.duration, track.timelineAsset.duration * 0.5f);
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackEditor.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 4fbcc9b1f6ace8c4f8724a88dccca5f8
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackInspector.cs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using UnityEngine;
|
| 2 |
+
using UnityEngine.Timeline;
|
| 3 |
+
|
| 4 |
+
namespace UnityEditor.Timeline
|
| 5 |
+
{
|
| 6 |
+
[CustomEditor(typeof(ActivationTrack))]
|
| 7 |
+
class ActivationTrackInspector : TrackAssetInspector
|
| 8 |
+
{
|
| 9 |
+
static class Styles
|
| 10 |
+
{
|
| 11 |
+
public static readonly GUIContent PostPlaybackStateText = EditorGUIUtility.TrTextContent("Post-playback state");
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
SerializedProperty m_PostPlaybackProperty;
|
| 15 |
+
|
| 16 |
+
public override void OnInspectorGUI()
|
| 17 |
+
{
|
| 18 |
+
using (new EditorGUI.DisabledScope(IsTrackLocked()))
|
| 19 |
+
{
|
| 20 |
+
serializedObject.Update();
|
| 21 |
+
|
| 22 |
+
EditorGUI.BeginChangeCheck();
|
| 23 |
+
|
| 24 |
+
if (m_PostPlaybackProperty != null)
|
| 25 |
+
EditorGUILayout.PropertyField(m_PostPlaybackProperty, Styles.PostPlaybackStateText);
|
| 26 |
+
|
| 27 |
+
if (EditorGUI.EndChangeCheck())
|
| 28 |
+
{
|
| 29 |
+
serializedObject.ApplyModifiedProperties();
|
| 30 |
+
var activationTrack = target as ActivationTrack;
|
| 31 |
+
if (activationTrack != null)
|
| 32 |
+
activationTrack.UpdateTrackMode();
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public override void OnEnable()
|
| 38 |
+
{
|
| 39 |
+
base.OnEnable();
|
| 40 |
+
m_PostPlaybackProperty = serializedObject.FindProperty("m_PostPlaybackState");
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Activation/ActivationTrackInspector.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: c46b007a3762fc84cb1ee7ca30060f0b
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Analytics/TimelineAnalytics.cs
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using UnityEditor.Build;
|
| 5 |
+
using UnityEditor.Build.Reporting;
|
| 6 |
+
using UnityEngine.Playables;
|
| 7 |
+
using UnityEngine.SceneManagement;
|
| 8 |
+
using UnityEngine.Timeline;
|
| 9 |
+
|
| 10 |
+
namespace UnityEditor.Timeline.Analytics
|
| 11 |
+
{
|
| 12 |
+
class TimelineSceneInfo
|
| 13 |
+
{
|
| 14 |
+
public Dictionary<string, int> trackCount = new Dictionary<string, int>
|
| 15 |
+
{
|
| 16 |
+
{"ActivationTrack", 0},
|
| 17 |
+
{"AnimationTrack", 0},
|
| 18 |
+
{"AudioTrack", 0},
|
| 19 |
+
{"ControlTrack", 0},
|
| 20 |
+
{"PlayableTrack", 0},
|
| 21 |
+
{"UserType", 0},
|
| 22 |
+
{"Other", 0}
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
public Dictionary<string, int> userTrackTypesCount = new Dictionary<string, int>();
|
| 26 |
+
public HashSet<TimelineAsset> uniqueDirectors = new HashSet<TimelineAsset>();
|
| 27 |
+
public int numTracks = 0;
|
| 28 |
+
public int minDuration = int.MaxValue;
|
| 29 |
+
public int maxDuration = int.MinValue;
|
| 30 |
+
public int minNumTracks = int.MaxValue;
|
| 31 |
+
public int maxNumTracks = int.MinValue;
|
| 32 |
+
public int numRecorded = 0;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
[Serializable]
|
| 36 |
+
struct TrackInfo
|
| 37 |
+
{
|
| 38 |
+
public string name;
|
| 39 |
+
public double percent;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
[Serializable]
|
| 43 |
+
class TimelineEventInfo
|
| 44 |
+
{
|
| 45 |
+
public int num_timelines;
|
| 46 |
+
public int min_duration, max_duration;
|
| 47 |
+
public int min_num_tracks, max_num_tracks;
|
| 48 |
+
public double recorded_percent;
|
| 49 |
+
public List<TrackInfo> track_info = new List<TrackInfo>();
|
| 50 |
+
public string most_popular_user_track = string.Empty;
|
| 51 |
+
|
| 52 |
+
public TimelineEventInfo(TimelineSceneInfo sceneInfo)
|
| 53 |
+
{
|
| 54 |
+
num_timelines = sceneInfo.uniqueDirectors.Count;
|
| 55 |
+
min_duration = sceneInfo.minDuration;
|
| 56 |
+
max_duration = sceneInfo.maxDuration;
|
| 57 |
+
min_num_tracks = sceneInfo.minNumTracks;
|
| 58 |
+
max_num_tracks = sceneInfo.maxNumTracks;
|
| 59 |
+
recorded_percent = Math.Round(100.0 * sceneInfo.numRecorded / sceneInfo.numTracks, 1);
|
| 60 |
+
|
| 61 |
+
foreach (KeyValuePair<string, int> kv in sceneInfo.trackCount.Where(x => x.Value > 0))
|
| 62 |
+
{
|
| 63 |
+
track_info.Add(new TrackInfo()
|
| 64 |
+
{
|
| 65 |
+
name = kv.Key,
|
| 66 |
+
percent = Math.Round(100.0 * kv.Value / sceneInfo.numTracks, 1)
|
| 67 |
+
});
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
if (sceneInfo.userTrackTypesCount.Any())
|
| 71 |
+
{
|
| 72 |
+
most_popular_user_track = sceneInfo.userTrackTypesCount
|
| 73 |
+
.First(x => x.Value == sceneInfo.userTrackTypesCount.Values.Max()).Key;
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
public static bool IsUserType(Type t)
|
| 78 |
+
{
|
| 79 |
+
string nameSpace = t.Namespace;
|
| 80 |
+
return string.IsNullOrEmpty(nameSpace) || !nameSpace.StartsWith("UnityEngine.Timeline");
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
static class TimelineAnalytics
|
| 86 |
+
{
|
| 87 |
+
static TimelineSceneInfo _timelineSceneInfo = new TimelineSceneInfo();
|
| 88 |
+
|
| 89 |
+
class TimelineAnalyticsPreProcess : IPreprocessBuildWithReport
|
| 90 |
+
{
|
| 91 |
+
public int callbackOrder { get { return 0; } }
|
| 92 |
+
public void OnPreprocessBuild(BuildReport report)
|
| 93 |
+
{
|
| 94 |
+
_timelineSceneInfo = new TimelineSceneInfo();
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
class TimelineAnalyticsProcess : IProcessSceneWithReport
|
| 99 |
+
{
|
| 100 |
+
public int callbackOrder
|
| 101 |
+
{
|
| 102 |
+
get { return 0; }
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
public void OnProcessScene(Scene scene, BuildReport report)
|
| 106 |
+
{
|
| 107 |
+
var timelines = UnityEngine.Object.FindObjectsOfType<PlayableDirector>().Select(pd => pd.playableAsset).OfType<TimelineAsset>().Distinct();
|
| 108 |
+
|
| 109 |
+
foreach (var timeline in timelines)
|
| 110 |
+
{
|
| 111 |
+
if (_timelineSceneInfo.uniqueDirectors.Add(timeline))
|
| 112 |
+
{
|
| 113 |
+
_timelineSceneInfo.numTracks += timeline.flattenedTracks.Count();
|
| 114 |
+
_timelineSceneInfo.minDuration = Math.Min(_timelineSceneInfo.minDuration, (int)(timeline.duration * 1000));
|
| 115 |
+
_timelineSceneInfo.maxDuration = Math.Max(_timelineSceneInfo.maxDuration, (int)(timeline.duration * 1000));
|
| 116 |
+
_timelineSceneInfo.minNumTracks = Math.Min(_timelineSceneInfo.minNumTracks, timeline.flattenedTracks.Count());
|
| 117 |
+
_timelineSceneInfo.maxNumTracks = Math.Max(_timelineSceneInfo.maxNumTracks, timeline.flattenedTracks.Count());
|
| 118 |
+
|
| 119 |
+
foreach (var track in timeline.flattenedTracks)
|
| 120 |
+
{
|
| 121 |
+
string key = track.GetType().Name;
|
| 122 |
+
if (_timelineSceneInfo.trackCount.ContainsKey(key))
|
| 123 |
+
{
|
| 124 |
+
_timelineSceneInfo.trackCount[key]++;
|
| 125 |
+
}
|
| 126 |
+
else
|
| 127 |
+
{
|
| 128 |
+
if (TimelineEventInfo.IsUserType(track.GetType()))
|
| 129 |
+
{
|
| 130 |
+
_timelineSceneInfo.trackCount["UserType"]++;
|
| 131 |
+
if (_timelineSceneInfo.userTrackTypesCount.ContainsKey(key))
|
| 132 |
+
_timelineSceneInfo.userTrackTypesCount[key]++;
|
| 133 |
+
else
|
| 134 |
+
_timelineSceneInfo.userTrackTypesCount[key] = 1;
|
| 135 |
+
}
|
| 136 |
+
else
|
| 137 |
+
_timelineSceneInfo.trackCount["Other"]++;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
if (track.clips.Any(x => x.recordable))
|
| 141 |
+
_timelineSceneInfo.numRecorded++;
|
| 142 |
+
else
|
| 143 |
+
{
|
| 144 |
+
var animationTrack = track as AnimationTrack;
|
| 145 |
+
if (animationTrack != null)
|
| 146 |
+
{
|
| 147 |
+
if (animationTrack.CanConvertToClipMode())
|
| 148 |
+
_timelineSceneInfo.numRecorded++;
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
class TimelineAnalyticsPostProcess : IPostprocessBuildWithReport
|
| 158 |
+
{
|
| 159 |
+
public int callbackOrder {get { return 0; }}
|
| 160 |
+
public void OnPostprocessBuild(BuildReport report)
|
| 161 |
+
{
|
| 162 |
+
if (_timelineSceneInfo.uniqueDirectors.Count > 0)
|
| 163 |
+
{
|
| 164 |
+
var timelineEvent = new TimelineEventInfo(_timelineSceneInfo);
|
| 165 |
+
EditorAnalytics.SendEventTimelineInfo(timelineEvent);
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Analytics/TimelineAnalytics.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 10ba9bc9317e315439b0223674162c52
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipActions.cs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using System.Linq;
|
| 3 |
+
using JetBrains.Annotations;
|
| 4 |
+
using UnityEditor.Timeline.Actions;
|
| 5 |
+
using UnityEngine;
|
| 6 |
+
using UnityEngine.Timeline;
|
| 7 |
+
using UnityEngine.Playables;
|
| 8 |
+
|
| 9 |
+
namespace UnityEditor.Timeline
|
| 10 |
+
{
|
| 11 |
+
[ApplyDefaultUndo("Match Offsets")]
|
| 12 |
+
[MenuEntry("Match Offsets To Previous Clip", MenuPriority.CustomClipActionSection.matchPrevious), UsedImplicitly]
|
| 13 |
+
class MatchOffsetsPreviousAction : ClipAction
|
| 14 |
+
{
|
| 15 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 16 |
+
{
|
| 17 |
+
if (clips == null || !clips.Any())
|
| 18 |
+
return false;
|
| 19 |
+
AnimationOffsetMenu.MatchClipsToPrevious(clips.Where(x => IsValidClip(x, TimelineEditor.inspectedDirector)).ToArray());
|
| 20 |
+
return true;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
static bool IsValidClip(TimelineClip clip, PlayableDirector director)
|
| 24 |
+
{
|
| 25 |
+
return clip != null &&
|
| 26 |
+
clip.parentTrack != null &&
|
| 27 |
+
(clip.asset as AnimationPlayableAsset) != null &&
|
| 28 |
+
clip.parentTrack.clips.Any(x => x.start < clip.start) &&
|
| 29 |
+
TimelineUtility.GetSceneGameObject(director, clip.parentTrack) != null;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 33 |
+
{
|
| 34 |
+
if (!clips.All(TimelineAnimationUtilities.IsAnimationClip))
|
| 35 |
+
return ActionValidity.NotApplicable;
|
| 36 |
+
|
| 37 |
+
var director = TimelineEditor.inspectedDirector;
|
| 38 |
+
if (TimelineEditor.inspectedDirector == null)
|
| 39 |
+
return ActionValidity.NotApplicable;
|
| 40 |
+
|
| 41 |
+
if (clips.Any(c => IsValidClip(c, director)))
|
| 42 |
+
return ActionValidity.Valid;
|
| 43 |
+
|
| 44 |
+
return ActionValidity.NotApplicable;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
[ApplyDefaultUndo("Match Offsets")]
|
| 49 |
+
[MenuEntry("Match Offsets To Next Clip", MenuPriority.CustomClipActionSection.matchNext), UsedImplicitly]
|
| 50 |
+
class MatchOffsetsNextAction : ClipAction
|
| 51 |
+
{
|
| 52 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 53 |
+
{
|
| 54 |
+
AnimationOffsetMenu.MatchClipsToNext(clips.Where(x => IsValidClip(x, TimelineEditor.inspectedDirector)).ToArray());
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
static bool IsValidClip(TimelineClip clip, PlayableDirector director)
|
| 59 |
+
{
|
| 60 |
+
return clip != null &&
|
| 61 |
+
clip.parentTrack != null &&
|
| 62 |
+
(clip.asset as AnimationPlayableAsset) != null &&
|
| 63 |
+
clip.parentTrack.clips.Any(x => x.start > clip.start) &&
|
| 64 |
+
TimelineUtility.GetSceneGameObject(director, clip.parentTrack) != null;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 68 |
+
{
|
| 69 |
+
if (!clips.All(TimelineAnimationUtilities.IsAnimationClip))
|
| 70 |
+
return ActionValidity.NotApplicable;
|
| 71 |
+
|
| 72 |
+
var director = TimelineEditor.inspectedDirector;
|
| 73 |
+
if (TimelineEditor.inspectedDirector == null)
|
| 74 |
+
return ActionValidity.NotApplicable;
|
| 75 |
+
|
| 76 |
+
if (clips.Any(c => IsValidClip(c, director)))
|
| 77 |
+
return ActionValidity.Valid;
|
| 78 |
+
|
| 79 |
+
return ActionValidity.NotApplicable;
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
[ApplyDefaultUndo]
|
| 84 |
+
[MenuEntry("Reset Offsets", MenuPriority.CustomClipActionSection.resetOffset), UsedImplicitly]
|
| 85 |
+
class ResetOffsets : ClipAction
|
| 86 |
+
{
|
| 87 |
+
public override bool Execute(IEnumerable<TimelineClip> clips)
|
| 88 |
+
{
|
| 89 |
+
AnimationOffsetMenu.ResetClipOffsets(clips.Where(TimelineAnimationUtilities.IsAnimationClip).ToArray());
|
| 90 |
+
return true;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
public override ActionValidity Validate(IEnumerable<TimelineClip> clips)
|
| 94 |
+
{
|
| 95 |
+
if (!clips.All(TimelineAnimationUtilities.IsAnimationClip))
|
| 96 |
+
return ActionValidity.NotApplicable;
|
| 97 |
+
|
| 98 |
+
return ActionValidity.Valid;
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: bf22284ca28e7ef4490033b61e9b52cd
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipCurveCache.cs
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using System.Linq;
|
| 3 |
+
using UnityEngine;
|
| 4 |
+
using UnityEditor;
|
| 5 |
+
using UnityEditorInternal;
|
| 6 |
+
|
| 7 |
+
namespace UnityEditor.Timeline
|
| 8 |
+
{
|
| 9 |
+
struct CurveBindingPair
|
| 10 |
+
{
|
| 11 |
+
public EditorCurveBinding binding;
|
| 12 |
+
public AnimationCurve curve;
|
| 13 |
+
public ObjectReferenceKeyframe[] objectCurve;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
class CurveBindingGroup
|
| 17 |
+
{
|
| 18 |
+
public CurveBindingPair[] curveBindingPairs { get; set; }
|
| 19 |
+
public Vector2 timeRange { get; set; }
|
| 20 |
+
public Vector2 valueRange { get; set; }
|
| 21 |
+
|
| 22 |
+
public bool isFloatCurve
|
| 23 |
+
{
|
| 24 |
+
get
|
| 25 |
+
{
|
| 26 |
+
return curveBindingPairs != null && curveBindingPairs.Length > 0 &&
|
| 27 |
+
curveBindingPairs[0].curve != null;
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public bool isObjectCurve
|
| 32 |
+
{
|
| 33 |
+
get
|
| 34 |
+
{
|
| 35 |
+
return curveBindingPairs != null && curveBindingPairs.Length > 0 &&
|
| 36 |
+
curveBindingPairs[0].objectCurve != null;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
public int count
|
| 41 |
+
{
|
| 42 |
+
get
|
| 43 |
+
{
|
| 44 |
+
if (curveBindingPairs == null)
|
| 45 |
+
return 0;
|
| 46 |
+
return curveBindingPairs.Length;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
class AnimationClipCurveInfo
|
| 52 |
+
{
|
| 53 |
+
bool m_CurveDirty = true;
|
| 54 |
+
bool m_KeysDirty = true;
|
| 55 |
+
|
| 56 |
+
public bool dirty
|
| 57 |
+
{
|
| 58 |
+
get { return m_CurveDirty; }
|
| 59 |
+
set
|
| 60 |
+
{
|
| 61 |
+
m_CurveDirty = value;
|
| 62 |
+
if (m_CurveDirty)
|
| 63 |
+
{
|
| 64 |
+
m_KeysDirty = true;
|
| 65 |
+
if (m_groupings != null)
|
| 66 |
+
m_groupings.Clear();
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
public AnimationCurve[] curves;
|
| 72 |
+
public EditorCurveBinding[] bindings;
|
| 73 |
+
|
| 74 |
+
public EditorCurveBinding[] objectBindings;
|
| 75 |
+
public List<ObjectReferenceKeyframe[]> objectCurves;
|
| 76 |
+
|
| 77 |
+
Dictionary<string, CurveBindingGroup> m_groupings;
|
| 78 |
+
|
| 79 |
+
// to tell whether the cache has changed
|
| 80 |
+
public int version { get; private set; }
|
| 81 |
+
|
| 82 |
+
float[] m_KeyTimes;
|
| 83 |
+
|
| 84 |
+
Dictionary<EditorCurveBinding, float[]> m_individualBindinsKey;
|
| 85 |
+
|
| 86 |
+
public float[] keyTimes
|
| 87 |
+
{
|
| 88 |
+
get
|
| 89 |
+
{
|
| 90 |
+
if (m_KeysDirty || m_KeyTimes == null)
|
| 91 |
+
{
|
| 92 |
+
RebuildKeyCache();
|
| 93 |
+
}
|
| 94 |
+
return m_KeyTimes;
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
public float[] GetCurveTimes(EditorCurveBinding curve)
|
| 99 |
+
{
|
| 100 |
+
return GetCurveTimes(new[] { curve });
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
public float[] GetCurveTimes(EditorCurveBinding[] curves)
|
| 104 |
+
{
|
| 105 |
+
if (m_KeysDirty || m_KeyTimes == null)
|
| 106 |
+
{
|
| 107 |
+
RebuildKeyCache();
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
var keyTimes = new List<float>();
|
| 111 |
+
for (int i = 0; i < curves.Length; i++)
|
| 112 |
+
{
|
| 113 |
+
var c = curves[i];
|
| 114 |
+
if (m_individualBindinsKey.ContainsKey(c))
|
| 115 |
+
{
|
| 116 |
+
keyTimes.AddRange(m_individualBindinsKey[c]);
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
return keyTimes.ToArray();
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
void RebuildKeyCache()
|
| 123 |
+
{
|
| 124 |
+
m_individualBindinsKey = new Dictionary<EditorCurveBinding, float[]>();
|
| 125 |
+
|
| 126 |
+
List<float> keys = curves.SelectMany(y => y.keys).Select(z => z.time).ToList();
|
| 127 |
+
for (int i = 0; i < objectCurves.Count; i++)
|
| 128 |
+
{
|
| 129 |
+
var kf = objectCurves[i];
|
| 130 |
+
keys.AddRange(kf.Select(x => x.time));
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
for (int b = 0; b < bindings.Count(); b++)
|
| 134 |
+
{
|
| 135 |
+
m_individualBindinsKey.Add(bindings[b], curves[b].keys.Select(k => k.time).Distinct().ToArray());
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
m_KeyTimes = keys.OrderBy(x => x).Distinct().ToArray();
|
| 139 |
+
m_KeysDirty = false;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
public void Update(AnimationClip clip)
|
| 143 |
+
{
|
| 144 |
+
List<EditorCurveBinding> postfilter = new List<EditorCurveBinding>();
|
| 145 |
+
var clipBindings = AnimationUtility.GetCurveBindings(clip);
|
| 146 |
+
for (int i = 0; i < clipBindings.Length; i++)
|
| 147 |
+
{
|
| 148 |
+
var bind = clipBindings[i];
|
| 149 |
+
if (!bind.propertyName.Contains("LocalRotation.w"))
|
| 150 |
+
postfilter.Add(RotationCurveInterpolation.RemapAnimationBindingForRotationCurves(bind, clip));
|
| 151 |
+
}
|
| 152 |
+
bindings = postfilter.ToArray();
|
| 153 |
+
|
| 154 |
+
curves = new AnimationCurve[bindings.Length];
|
| 155 |
+
for (int i = 0; i < bindings.Length; i++)
|
| 156 |
+
{
|
| 157 |
+
curves[i] = AnimationUtility.GetEditorCurve(clip, bindings[i]);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
objectBindings = AnimationUtility.GetObjectReferenceCurveBindings(clip);
|
| 161 |
+
objectCurves = new List<ObjectReferenceKeyframe[]>(objectBindings.Length);
|
| 162 |
+
for (int i = 0; i < objectBindings.Length; i++)
|
| 163 |
+
{
|
| 164 |
+
objectCurves.Add(AnimationUtility.GetObjectReferenceCurve(clip, objectBindings[i]));
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
m_CurveDirty = false;
|
| 168 |
+
m_KeysDirty = true;
|
| 169 |
+
|
| 170 |
+
version = version + 1;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
public bool GetBindingForCurve(AnimationCurve curve, ref EditorCurveBinding binding)
|
| 174 |
+
{
|
| 175 |
+
for (int i = 0; i < curves.Length; i++)
|
| 176 |
+
{
|
| 177 |
+
if (curve == curves[i])
|
| 178 |
+
{
|
| 179 |
+
binding = bindings[i];
|
| 180 |
+
return true;
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
return false;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
public AnimationCurve GetCurveForBinding(EditorCurveBinding binding)
|
| 187 |
+
{
|
| 188 |
+
for (int i = 0; i < curves.Length; i++)
|
| 189 |
+
{
|
| 190 |
+
if (binding.Equals(bindings[i]))
|
| 191 |
+
{
|
| 192 |
+
return curves[i];
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
return null;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
public ObjectReferenceKeyframe[] GetObjectCurveForBinding(EditorCurveBinding binding)
|
| 199 |
+
{
|
| 200 |
+
if (objectCurves == null)
|
| 201 |
+
return null;
|
| 202 |
+
|
| 203 |
+
for (int i = 0; i < objectCurves.Count; i++)
|
| 204 |
+
{
|
| 205 |
+
if (binding.Equals(objectBindings[i]))
|
| 206 |
+
{
|
| 207 |
+
return objectCurves[i];
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
return null;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// given a groupID, get the list of curve bindings
|
| 214 |
+
public CurveBindingGroup GetGroupBinding(string groupID)
|
| 215 |
+
{
|
| 216 |
+
if (m_groupings == null)
|
| 217 |
+
m_groupings = new Dictionary<string, CurveBindingGroup>();
|
| 218 |
+
|
| 219 |
+
CurveBindingGroup result = null;
|
| 220 |
+
if (!m_groupings.TryGetValue(groupID, out result))
|
| 221 |
+
{
|
| 222 |
+
result = new CurveBindingGroup();
|
| 223 |
+
result.timeRange = new Vector2(float.MaxValue, float.MinValue);
|
| 224 |
+
result.valueRange = new Vector2(float.MaxValue, float.MinValue);
|
| 225 |
+
List<CurveBindingPair> found = new List<CurveBindingPair>();
|
| 226 |
+
for (int i = 0; i < bindings.Length; i++)
|
| 227 |
+
{
|
| 228 |
+
if (bindings[i].GetGroupID() == groupID)
|
| 229 |
+
{
|
| 230 |
+
CurveBindingPair pair = new CurveBindingPair();
|
| 231 |
+
pair.binding = bindings[i];
|
| 232 |
+
pair.curve = curves[i];
|
| 233 |
+
found.Add(pair);
|
| 234 |
+
|
| 235 |
+
for (int k = 0; k < curves[i].keys.Length; k++)
|
| 236 |
+
{
|
| 237 |
+
var key = curves[i].keys[k];
|
| 238 |
+
result.timeRange = new Vector2(Mathf.Min(key.time, result.timeRange.x), Mathf.Max(key.time, result.timeRange.y));
|
| 239 |
+
result.valueRange = new Vector2(Mathf.Min(key.value, result.valueRange.x), Mathf.Max(key.value, result.valueRange.y));
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
}
|
| 243 |
+
for (int i = 0; i < objectBindings.Length; i++)
|
| 244 |
+
{
|
| 245 |
+
if (objectBindings[i].GetGroupID() == groupID)
|
| 246 |
+
{
|
| 247 |
+
CurveBindingPair pair = new CurveBindingPair();
|
| 248 |
+
pair.binding = objectBindings[i];
|
| 249 |
+
pair.objectCurve = objectCurves[i];
|
| 250 |
+
found.Add(pair);
|
| 251 |
+
|
| 252 |
+
for (int k = 0; k < objectCurves[i].Length; k++)
|
| 253 |
+
{
|
| 254 |
+
var key = objectCurves[i][k];
|
| 255 |
+
result.timeRange = new Vector2(Mathf.Min(key.time, result.timeRange.x), Mathf.Max(key.time, result.timeRange.y));
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
result.curveBindingPairs = found.OrderBy(x => AnimationWindowUtility.GetComponentIndex(x.binding.propertyName)).ToArray();
|
| 261 |
+
|
| 262 |
+
m_groupings.Add(groupID, result);
|
| 263 |
+
}
|
| 264 |
+
return result;
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
// Cache for storing the animation clip data
|
| 269 |
+
class AnimationClipCurveCache
|
| 270 |
+
{
|
| 271 |
+
static AnimationClipCurveCache s_Instance;
|
| 272 |
+
Dictionary<AnimationClip, AnimationClipCurveInfo> m_ClipCache = new Dictionary<AnimationClip, AnimationClipCurveInfo>();
|
| 273 |
+
bool m_IsEnabled;
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
public static AnimationClipCurveCache Instance
|
| 277 |
+
{
|
| 278 |
+
get
|
| 279 |
+
{
|
| 280 |
+
if (s_Instance == null)
|
| 281 |
+
{
|
| 282 |
+
s_Instance = new AnimationClipCurveCache();
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
return s_Instance;
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
public void OnEnable()
|
| 290 |
+
{
|
| 291 |
+
if (!m_IsEnabled)
|
| 292 |
+
{
|
| 293 |
+
AnimationUtility.onCurveWasModified += OnCurveWasModified;
|
| 294 |
+
m_IsEnabled = true;
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
public void OnDisable()
|
| 299 |
+
{
|
| 300 |
+
if (m_IsEnabled)
|
| 301 |
+
{
|
| 302 |
+
AnimationUtility.onCurveWasModified -= OnCurveWasModified;
|
| 303 |
+
m_IsEnabled = false;
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
// callback when a curve is edited. Force the cache to update next time it's accessed
|
| 308 |
+
void OnCurveWasModified(AnimationClip clip, EditorCurveBinding binding, AnimationUtility.CurveModifiedType modification)
|
| 309 |
+
{
|
| 310 |
+
AnimationClipCurveInfo data;
|
| 311 |
+
if (m_ClipCache.TryGetValue(clip, out data))
|
| 312 |
+
{
|
| 313 |
+
data.dirty = true;
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
public AnimationClipCurveInfo GetCurveInfo(AnimationClip clip)
|
| 318 |
+
{
|
| 319 |
+
AnimationClipCurveInfo data;
|
| 320 |
+
if (clip == null)
|
| 321 |
+
return null;
|
| 322 |
+
if (!m_ClipCache.TryGetValue(clip, out data))
|
| 323 |
+
{
|
| 324 |
+
data = new AnimationClipCurveInfo();
|
| 325 |
+
data.dirty = true;
|
| 326 |
+
m_ClipCache[clip] = data;
|
| 327 |
+
}
|
| 328 |
+
if (data.dirty)
|
| 329 |
+
{
|
| 330 |
+
data.Update(clip);
|
| 331 |
+
}
|
| 332 |
+
return data;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
public void ClearCachedProxyClips()
|
| 336 |
+
{
|
| 337 |
+
var toRemove = new List<AnimationClip>();
|
| 338 |
+
foreach (var entry in m_ClipCache)
|
| 339 |
+
{
|
| 340 |
+
var clip = entry.Key;
|
| 341 |
+
if (clip != null && (clip.hideFlags & HideFlags.HideAndDontSave) == HideFlags.HideAndDontSave)
|
| 342 |
+
toRemove.Add(clip);
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
foreach (var clip in toRemove)
|
| 346 |
+
{
|
| 347 |
+
m_ClipCache.Remove(clip);
|
| 348 |
+
Object.DestroyImmediate(clip, true);
|
| 349 |
+
}
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
public void Clear()
|
| 353 |
+
{
|
| 354 |
+
ClearCachedProxyClips();
|
| 355 |
+
m_ClipCache.Clear();
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
static class EditorCurveBindingExtension
|
| 360 |
+
{
|
| 361 |
+
// identifier to generate an id thats the same for all curves in the same group
|
| 362 |
+
public static string GetGroupID(this EditorCurveBinding binding)
|
| 363 |
+
{
|
| 364 |
+
return binding.type + AnimationWindowUtility.GetPropertyGroupName(binding.propertyName);
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
static class CurveBindingGroupExtensions
|
| 370 |
+
{
|
| 371 |
+
// Extentions to determine curve types
|
| 372 |
+
public static bool IsEnableGroup(this CurveBindingGroup curves)
|
| 373 |
+
{
|
| 374 |
+
return curves.isFloatCurve && curves.count == 1 && curves.curveBindingPairs[0].binding.propertyName == "m_Enabled";
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
public static bool IsVectorGroup(this CurveBindingGroup curves)
|
| 378 |
+
{
|
| 379 |
+
if (!curves.isFloatCurve)
|
| 380 |
+
return false;
|
| 381 |
+
if (curves.count <= 1 || curves.count > 4)
|
| 382 |
+
return false;
|
| 383 |
+
char l = curves.curveBindingPairs[0].binding.propertyName.Last();
|
| 384 |
+
return l == 'x' || l == 'y' || l == 'z' || l == 'w';
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
public static bool IsColorGroup(this CurveBindingGroup curves)
|
| 388 |
+
{
|
| 389 |
+
if (!curves.isFloatCurve)
|
| 390 |
+
return false;
|
| 391 |
+
if (curves.count != 3 && curves.count != 4)
|
| 392 |
+
return false;
|
| 393 |
+
char l = curves.curveBindingPairs[0].binding.propertyName.Last();
|
| 394 |
+
return l == 'r' || l == 'g' || l == 'b' || l == 'a';
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
public static string GetDescription(this CurveBindingGroup group, float t)
|
| 398 |
+
{
|
| 399 |
+
string result = string.Empty;
|
| 400 |
+
if (group.isFloatCurve)
|
| 401 |
+
{
|
| 402 |
+
if (group.count > 1)
|
| 403 |
+
{
|
| 404 |
+
result += "(" + group.curveBindingPairs[0].curve.Evaluate(t).ToString("0.##");
|
| 405 |
+
for (int j = 1; j < group.curveBindingPairs.Length; j++)
|
| 406 |
+
{
|
| 407 |
+
result += "," + group.curveBindingPairs[j].curve.Evaluate(t).ToString("0.##");
|
| 408 |
+
}
|
| 409 |
+
result += ")";
|
| 410 |
+
}
|
| 411 |
+
else
|
| 412 |
+
{
|
| 413 |
+
result = group.curveBindingPairs[0].curve.Evaluate(t).ToString("0.##");
|
| 414 |
+
}
|
| 415 |
+
}
|
| 416 |
+
else if (group.isObjectCurve)
|
| 417 |
+
{
|
| 418 |
+
Object obj = null;
|
| 419 |
+
if (group.curveBindingPairs[0].objectCurve.Length > 0)
|
| 420 |
+
obj = CurveEditUtility.Evaluate(group.curveBindingPairs[0].objectCurve, t);
|
| 421 |
+
result = (obj == null ? "None" : obj.name);
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
return result;
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipCurveCache.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 07a967d2fca95324f8922df8394a5655
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipExtensions.cs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using UnityEngine;
|
| 3 |
+
|
| 4 |
+
namespace UnityEditor.Timeline
|
| 5 |
+
{
|
| 6 |
+
static class AnimationClipExtensions
|
| 7 |
+
{
|
| 8 |
+
public static UInt64 ClipVersion(this AnimationClip clip)
|
| 9 |
+
{
|
| 10 |
+
if (clip == null)
|
| 11 |
+
return 0;
|
| 12 |
+
|
| 13 |
+
var info = AnimationClipCurveCache.Instance.GetCurveInfo(clip);
|
| 14 |
+
var version = (UInt32) info.version;
|
| 15 |
+
var count = (UInt32) info.curves.Length;
|
| 16 |
+
var result = (UInt64) version;
|
| 17 |
+
result |= ((UInt64) count) << 32;
|
| 18 |
+
return result;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public static CurveChangeType GetChangeType(this AnimationClip clip, ref UInt64 curveVersion)
|
| 22 |
+
{
|
| 23 |
+
var version = clip.ClipVersion();
|
| 24 |
+
var changeType = CurveChangeType.None;
|
| 25 |
+
if ((curveVersion >> 32) != (version >> 32))
|
| 26 |
+
changeType = CurveChangeType.CurveAddedOrRemoved;
|
| 27 |
+
else if (curveVersion != version)
|
| 28 |
+
changeType = CurveChangeType.CurveModified;
|
| 29 |
+
|
| 30 |
+
curveVersion = version;
|
| 31 |
+
return changeType;
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationClipExtensions.cs.meta
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: c3b87750f9f94e8c918b71ec7d369bd4
|
| 3 |
+
timeCreated: 1602859563
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationOffsetMenu.cs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Linq;
|
| 2 |
+
using UnityEngine;
|
| 3 |
+
using UnityEngine.Timeline;
|
| 4 |
+
|
| 5 |
+
namespace UnityEditor.Timeline
|
| 6 |
+
{
|
| 7 |
+
static class AnimationOffsetMenu
|
| 8 |
+
{
|
| 9 |
+
public static string MatchFieldsPrefix = "Match Offsets Fields/";
|
| 10 |
+
|
| 11 |
+
static bool EnforcePreviewMode()
|
| 12 |
+
{
|
| 13 |
+
TimelineEditor.state.previewMode = true; // try and set the preview mode
|
| 14 |
+
if (!TimelineEditor.state.previewMode)
|
| 15 |
+
{
|
| 16 |
+
Debug.LogError("Match clips cannot be completed because preview mode cannot be enabed");
|
| 17 |
+
return false;
|
| 18 |
+
}
|
| 19 |
+
return true;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
internal static void MatchClipsToPrevious(TimelineClip[] clips)
|
| 23 |
+
{
|
| 24 |
+
if (!EnforcePreviewMode())
|
| 25 |
+
return;
|
| 26 |
+
|
| 27 |
+
clips = clips.OrderBy(x => x.start).ToArray();
|
| 28 |
+
foreach (var clip in clips)
|
| 29 |
+
{
|
| 30 |
+
var sceneObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.parentTrack);
|
| 31 |
+
if (sceneObject != null)
|
| 32 |
+
{
|
| 33 |
+
TimelineAnimationUtilities.MatchPrevious(clip, sceneObject.transform, TimelineEditor.inspectedDirector);
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
InspectorWindow.RepaintAllInspectors();
|
| 38 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
internal static void MatchClipsToNext(TimelineClip[] clips)
|
| 42 |
+
{
|
| 43 |
+
if (!EnforcePreviewMode())
|
| 44 |
+
return;
|
| 45 |
+
|
| 46 |
+
clips = clips.OrderByDescending(x => x.start).ToArray();
|
| 47 |
+
foreach (var clip in clips)
|
| 48 |
+
{
|
| 49 |
+
var sceneObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.parentTrack);
|
| 50 |
+
if (sceneObject != null)
|
| 51 |
+
{
|
| 52 |
+
TimelineAnimationUtilities.MatchNext(clip, sceneObject.transform, TimelineEditor.inspectedDirector);
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
InspectorWindow.RepaintAllInspectors();
|
| 57 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
public static void ResetClipOffsets(TimelineClip[] clips)
|
| 61 |
+
{
|
| 62 |
+
foreach (var clip in clips)
|
| 63 |
+
{
|
| 64 |
+
var asset = clip.asset as AnimationPlayableAsset;
|
| 65 |
+
if (asset != null)
|
| 66 |
+
asset.ResetOffsets();
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
InspectorWindow.RepaintAllInspectors();
|
| 70 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationOffsetMenu.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: 9ace5095cc37ed849b52109d2ee305d4
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationPlayableAssetEditor.cs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using JetBrains.Annotations;
|
| 2 |
+
using UnityEngine;
|
| 3 |
+
using UnityEngine.Playables;
|
| 4 |
+
using UnityEngine.Timeline;
|
| 5 |
+
|
| 6 |
+
namespace UnityEditor.Timeline
|
| 7 |
+
{
|
| 8 |
+
[CustomTimelineEditor(typeof(AnimationPlayableAsset)), UsedImplicitly]
|
| 9 |
+
class AnimationPlayableAssetEditor : ClipEditor
|
| 10 |
+
{
|
| 11 |
+
public static readonly string k_NoClipAssignedError = L10n.Tr("No animation clip assigned");
|
| 12 |
+
public static readonly string k_LegacyClipError = L10n.Tr("Legacy animation clips are not supported");
|
| 13 |
+
static readonly string k_MotionCurveError = L10n.Tr("You are using motion curves without applyRootMotion enabled on the Animator. The root transform will not be animated");
|
| 14 |
+
static readonly string k_RootCurveError = L10n.Tr("You are using root curves without applyRootMotion enabled on the Animator. The root transform will not be animated");
|
| 15 |
+
|
| 16 |
+
/// <inheritdoc/>
|
| 17 |
+
public override ClipDrawOptions GetClipOptions(TimelineClip clip)
|
| 18 |
+
{
|
| 19 |
+
var clipOptions = base.GetClipOptions(clip);
|
| 20 |
+
var asset = clip.asset as AnimationPlayableAsset;
|
| 21 |
+
|
| 22 |
+
if (asset != null)
|
| 23 |
+
clipOptions.errorText = GetErrorText(asset, clip.parentTrack as AnimationTrack, clipOptions.errorText);
|
| 24 |
+
|
| 25 |
+
if (clip.recordable)
|
| 26 |
+
clipOptions.highlightColor = DirectorStyles.Instance.customSkin.colorAnimationRecorded;
|
| 27 |
+
|
| 28 |
+
return clipOptions;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/// <inheritdoc />
|
| 32 |
+
public override void OnCreate(TimelineClip clip, TrackAsset track, TimelineClip clonedFrom)
|
| 33 |
+
{
|
| 34 |
+
var asset = clip.asset as AnimationPlayableAsset;
|
| 35 |
+
if (asset != null && asset.clip != null && asset.clip.legacy)
|
| 36 |
+
{
|
| 37 |
+
asset.clip = null;
|
| 38 |
+
Debug.LogError("Legacy Animation Clips are not supported");
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
string GetErrorText(AnimationPlayableAsset animationAsset, AnimationTrack track, string defaultError)
|
| 43 |
+
{
|
| 44 |
+
if (animationAsset.clip == null)
|
| 45 |
+
return k_NoClipAssignedError;
|
| 46 |
+
if (animationAsset.clip.legacy)
|
| 47 |
+
return k_LegacyClipError;
|
| 48 |
+
if (animationAsset.clip.hasMotionCurves || animationAsset.clip.hasRootCurves)
|
| 49 |
+
{
|
| 50 |
+
if (track != null && track.trackOffset == TrackOffset.Auto)
|
| 51 |
+
{
|
| 52 |
+
var animator = track.GetBinding(TimelineEditor.inspectedDirector);
|
| 53 |
+
if (animator != null && !animator.applyRootMotion && !animationAsset.clip.hasGenericRootTransform)
|
| 54 |
+
{
|
| 55 |
+
if (animationAsset.clip.hasMotionCurves)
|
| 56 |
+
return k_MotionCurveError;
|
| 57 |
+
return k_RootCurveError;
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
return defaultError;
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationPlayableAssetEditor.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: f7fed0d9d0f7a7f41a8525aa79e790b1
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationTrackActions.cs
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System.Collections.Generic;
|
| 2 |
+
using System.Linq;
|
| 3 |
+
using JetBrains.Annotations;
|
| 4 |
+
using UnityEditor.Timeline.Actions;
|
| 5 |
+
using UnityEngine;
|
| 6 |
+
using UnityEngine.Timeline;
|
| 7 |
+
|
| 8 |
+
namespace UnityEditor.Timeline
|
| 9 |
+
{
|
| 10 |
+
[MenuEntry("Add Override Track", MenuPriority.CustomTrackActionSection.addOverrideTrack), UsedImplicitly]
|
| 11 |
+
class AddOverrideTrackAction : TrackAction
|
| 12 |
+
{
|
| 13 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 14 |
+
{
|
| 15 |
+
foreach (var animTrack in tracks.OfType<AnimationTrack>())
|
| 16 |
+
{
|
| 17 |
+
TimelineHelpers.CreateTrack(typeof(AnimationTrack), animTrack, "Override " + animTrack.GetChildTracks().Count());
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
return true;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 24 |
+
{
|
| 25 |
+
if (tracks.Any(t => t.isSubTrack || !t.GetType().IsAssignableFrom(typeof(AnimationTrack))))
|
| 26 |
+
return ActionValidity.NotApplicable;
|
| 27 |
+
|
| 28 |
+
if (tracks.Any(t => t.lockedInHierarchy))
|
| 29 |
+
return ActionValidity.Invalid;
|
| 30 |
+
|
| 31 |
+
return ActionValidity.Valid;
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
[MenuEntry("Convert To Clip Track", MenuPriority.CustomTrackActionSection.convertToClipMode), UsedImplicitly]
|
| 36 |
+
class ConvertToClipModeAction : TrackAction
|
| 37 |
+
{
|
| 38 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 39 |
+
{
|
| 40 |
+
foreach (var animTrack in tracks.OfType<AnimationTrack>())
|
| 41 |
+
animTrack.ConvertToClipMode();
|
| 42 |
+
|
| 43 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 44 |
+
|
| 45 |
+
return true;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 49 |
+
{
|
| 50 |
+
if (tracks.Any(t => !t.GetType().IsAssignableFrom(typeof(AnimationTrack))))
|
| 51 |
+
return ActionValidity.NotApplicable;
|
| 52 |
+
|
| 53 |
+
if (tracks.Any(t => t.lockedInHierarchy))
|
| 54 |
+
return ActionValidity.Invalid;
|
| 55 |
+
|
| 56 |
+
if (tracks.OfType<AnimationTrack>().All(a => a.CanConvertToClipMode()))
|
| 57 |
+
return ActionValidity.Valid;
|
| 58 |
+
|
| 59 |
+
return ActionValidity.NotApplicable;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
[MenuEntry("Convert To Infinite Clip", MenuPriority.CustomTrackActionSection.convertFromClipMode), UsedImplicitly]
|
| 64 |
+
class ConvertFromClipTrackAction : TrackAction
|
| 65 |
+
{
|
| 66 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 67 |
+
{
|
| 68 |
+
foreach (var animTrack in tracks.OfType<AnimationTrack>())
|
| 69 |
+
animTrack.ConvertFromClipMode(TimelineEditor.inspectedAsset);
|
| 70 |
+
|
| 71 |
+
TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
|
| 72 |
+
|
| 73 |
+
return true;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 77 |
+
{
|
| 78 |
+
if (tracks.Any(t => !t.GetType().IsAssignableFrom(typeof(AnimationTrack))))
|
| 79 |
+
return ActionValidity.NotApplicable;
|
| 80 |
+
|
| 81 |
+
if (tracks.Any(t => t.lockedInHierarchy))
|
| 82 |
+
return ActionValidity.Invalid;
|
| 83 |
+
|
| 84 |
+
if (tracks.OfType<AnimationTrack>().All(a => a.CanConvertFromClipMode()))
|
| 85 |
+
return ActionValidity.Valid;
|
| 86 |
+
|
| 87 |
+
return ActionValidity.NotApplicable;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
abstract class TrackOffsetBaseAction : TrackAction
|
| 92 |
+
{
|
| 93 |
+
public abstract TrackOffset trackOffset { get; }
|
| 94 |
+
|
| 95 |
+
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
| 96 |
+
{
|
| 97 |
+
if (tracks.Any(t => !t.GetType().IsAssignableFrom(typeof(AnimationTrack))))
|
| 98 |
+
return ActionValidity.NotApplicable;
|
| 99 |
+
|
| 100 |
+
if (tracks.Any(t => t.lockedInHierarchy))
|
| 101 |
+
{
|
| 102 |
+
return ActionValidity.Invalid;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
return ActionValidity.Valid;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
| 109 |
+
{
|
| 110 |
+
foreach (var animTrack in tracks.OfType<AnimationTrack>())
|
| 111 |
+
{
|
| 112 |
+
animTrack.UnarmForRecord();
|
| 113 |
+
animTrack.trackOffset = trackOffset;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
TimelineEditor.Refresh(RefreshReason.ContentsModified);
|
| 117 |
+
return true;
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
[MenuEntry("Track Offsets/Apply Transform Offsets", MenuPriority.CustomTrackActionSection.applyTrackOffset), UsedImplicitly]
|
| 123 |
+
[ApplyDefaultUndo]
|
| 124 |
+
class ApplyTransformOffsetAction : TrackOffsetBaseAction
|
| 125 |
+
{
|
| 126 |
+
public override TrackOffset trackOffset
|
| 127 |
+
{
|
| 128 |
+
get { return TrackOffset.ApplyTransformOffsets; }
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
[MenuEntry("Track Offsets/Apply Scene Offsets", MenuPriority.CustomTrackActionSection.applySceneOffset), UsedImplicitly]
|
| 133 |
+
[ApplyDefaultUndo]
|
| 134 |
+
class ApplySceneOffsetAction : TrackOffsetBaseAction
|
| 135 |
+
{
|
| 136 |
+
public override TrackOffset trackOffset
|
| 137 |
+
{
|
| 138 |
+
get { return TrackOffset.ApplySceneOffsets; }
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
[MenuEntry("Track Offsets/Auto (Deprecated)", MenuPriority.CustomTrackActionSection.applyAutoOffset), UsedImplicitly]
|
| 143 |
+
[ApplyDefaultUndo]
|
| 144 |
+
class ApplyAutoAction : TrackOffsetBaseAction
|
| 145 |
+
{
|
| 146 |
+
public override TrackOffset trackOffset
|
| 147 |
+
{
|
| 148 |
+
get { return TrackOffset.Auto; }
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/AnimationTrackActions.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: d4553f2006f48b6448553cb525d2876e
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/BindingSelector.cs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using System;
|
| 2 |
+
using System.Collections.Generic;
|
| 3 |
+
using System.Linq;
|
| 4 |
+
using UnityEditor.IMGUI.Controls;
|
| 5 |
+
using UnityEditorInternal;
|
| 6 |
+
using UnityEngine;
|
| 7 |
+
using UnityEngine.Timeline;
|
| 8 |
+
|
| 9 |
+
namespace UnityEditor.Timeline
|
| 10 |
+
{
|
| 11 |
+
class BindingSelector
|
| 12 |
+
{
|
| 13 |
+
TreeViewController m_TreeView;
|
| 14 |
+
public TreeViewController treeViewController
|
| 15 |
+
{
|
| 16 |
+
get { return m_TreeView; }
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
TreeViewState m_TrackGlobalTreeViewState;
|
| 20 |
+
TreeViewState m_TreeViewState;
|
| 21 |
+
BindingTreeViewDataSource m_TreeViewDataSource;
|
| 22 |
+
CurveDataSource m_CurveDataSource;
|
| 23 |
+
TimelineWindow m_Window;
|
| 24 |
+
CurveEditor m_CurveEditor;
|
| 25 |
+
ReorderableList m_DopeLines;
|
| 26 |
+
|
| 27 |
+
string[] m_StringList = {};
|
| 28 |
+
int[] m_Selection;
|
| 29 |
+
bool m_PartOfSelection;
|
| 30 |
+
public BindingSelector(EditorWindow window, CurveEditor curveEditor, TreeViewState trackGlobalTreeViewState)
|
| 31 |
+
{
|
| 32 |
+
m_Window = window as TimelineWindow;
|
| 33 |
+
m_CurveEditor = curveEditor;
|
| 34 |
+
m_TrackGlobalTreeViewState = trackGlobalTreeViewState;
|
| 35 |
+
|
| 36 |
+
m_DopeLines = new ReorderableList(m_StringList, typeof(string), false, false, false, false);
|
| 37 |
+
m_DopeLines.drawElementBackgroundCallback = null;
|
| 38 |
+
m_DopeLines.showDefaultBackground = false;
|
| 39 |
+
m_DopeLines.index = 0;
|
| 40 |
+
m_DopeLines.headerHeight = 0;
|
| 41 |
+
m_DopeLines.elementHeight = 20;
|
| 42 |
+
m_DopeLines.draggable = false;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public void OnGUI(Rect targetRect)
|
| 46 |
+
{
|
| 47 |
+
if (m_TreeView == null)
|
| 48 |
+
return;
|
| 49 |
+
|
| 50 |
+
m_TreeView.OnEvent();
|
| 51 |
+
m_TreeView.OnGUI(targetRect, GUIUtility.GetControlID(FocusType.Passive));
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
public void InitIfNeeded(Rect rect, CurveDataSource dataSource, bool isNewSelection)
|
| 55 |
+
{
|
| 56 |
+
if (Event.current.type != EventType.Layout)
|
| 57 |
+
return;
|
| 58 |
+
|
| 59 |
+
m_CurveDataSource = dataSource;
|
| 60 |
+
var clip = dataSource.animationClip;
|
| 61 |
+
|
| 62 |
+
List<EditorCurveBinding> allBindings = new List<EditorCurveBinding>();
|
| 63 |
+
allBindings.Add(new EditorCurveBinding { propertyName = "Summary" });
|
| 64 |
+
if (clip != null)
|
| 65 |
+
allBindings.AddRange(AnimationUtility.GetCurveBindings(clip));
|
| 66 |
+
|
| 67 |
+
m_DopeLines.list = allBindings.ToArray();
|
| 68 |
+
|
| 69 |
+
if (m_TreeViewState != null)
|
| 70 |
+
{
|
| 71 |
+
if (isNewSelection)
|
| 72 |
+
RefreshAll();
|
| 73 |
+
|
| 74 |
+
return;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
m_TreeViewState = m_TrackGlobalTreeViewState != null ? m_TrackGlobalTreeViewState : new TreeViewState();
|
| 78 |
+
|
| 79 |
+
m_TreeView = new TreeViewController(m_Window, m_TreeViewState)
|
| 80 |
+
{
|
| 81 |
+
useExpansionAnimation = false,
|
| 82 |
+
deselectOnUnhandledMouseDown = true
|
| 83 |
+
};
|
| 84 |
+
|
| 85 |
+
m_TreeView.selectionChangedCallback += OnItemSelectionChanged;
|
| 86 |
+
|
| 87 |
+
m_TreeViewDataSource = new BindingTreeViewDataSource(m_TreeView, clip, m_CurveDataSource);
|
| 88 |
+
|
| 89 |
+
m_TreeView.Init(rect, m_TreeViewDataSource, new BindingTreeViewGUI(m_TreeView), null);
|
| 90 |
+
|
| 91 |
+
m_TreeViewDataSource.UpdateData();
|
| 92 |
+
|
| 93 |
+
RefreshSelection();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
void OnItemSelectionChanged(int[] selection)
|
| 97 |
+
{
|
| 98 |
+
RefreshSelection(selection);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
void RefreshAll()
|
| 102 |
+
{
|
| 103 |
+
RefreshTree();
|
| 104 |
+
RefreshSelection();
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
void RefreshSelection()
|
| 108 |
+
{
|
| 109 |
+
RefreshSelection(m_TreeViewState.selectedIDs != null ? m_TreeViewState.selectedIDs.ToArray() : null);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
void RefreshSelection(int[] selection)
|
| 113 |
+
{
|
| 114 |
+
if (selection == null || selection.Length == 0)
|
| 115 |
+
{
|
| 116 |
+
// select all.
|
| 117 |
+
if (m_TreeViewDataSource.GetRows().Count > 0)
|
| 118 |
+
{
|
| 119 |
+
m_Selection = m_TreeViewDataSource.GetRows().Select(r => r.id).ToArray();
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
else
|
| 123 |
+
{
|
| 124 |
+
m_Selection = selection;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
RefreshCurves();
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
public void RefreshCurves()
|
| 131 |
+
{
|
| 132 |
+
if (m_CurveDataSource == null || m_Selection == null)
|
| 133 |
+
return;
|
| 134 |
+
|
| 135 |
+
var bindings = new HashSet<EditorCurveBinding>(AnimationPreviewUtilities.EditorCurveBindingComparer.Instance);
|
| 136 |
+
foreach (int s in m_Selection)
|
| 137 |
+
{
|
| 138 |
+
var item = (CurveTreeViewNode)m_TreeView.FindItem(s);
|
| 139 |
+
if (item != null && item.bindings != null)
|
| 140 |
+
bindings.UnionWith(item.bindings);
|
| 141 |
+
}
|
| 142 |
+
var wrappers = m_CurveDataSource.GenerateWrappers(bindings);
|
| 143 |
+
m_CurveEditor.animationCurves = wrappers.ToArray();
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
public void RefreshTree()
|
| 147 |
+
{
|
| 148 |
+
if (m_TreeViewDataSource == null)
|
| 149 |
+
return;
|
| 150 |
+
|
| 151 |
+
if (m_Selection == null)
|
| 152 |
+
m_Selection = new int[0];
|
| 153 |
+
|
| 154 |
+
// get the names of the previous items
|
| 155 |
+
var selected = m_Selection.Select(x => m_TreeViewDataSource.FindItem(x)).Where(t => t != null).Select(c => c.displayName).ToArray();
|
| 156 |
+
|
| 157 |
+
// update the source
|
| 158 |
+
m_TreeViewDataSource.UpdateData();
|
| 159 |
+
|
| 160 |
+
// find the same items
|
| 161 |
+
var reselected = m_TreeViewDataSource.GetRows().Where(x => selected.Contains(x.displayName)).Select(x => x.id).ToArray();
|
| 162 |
+
if (!reselected.Any())
|
| 163 |
+
{
|
| 164 |
+
if (m_TreeViewDataSource.GetRows().Count > 0)
|
| 165 |
+
{
|
| 166 |
+
reselected = new[] { m_TreeViewDataSource.GetItem(0).id };
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
// update the selection
|
| 171 |
+
OnItemSelectionChanged(reselected);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
internal virtual bool IsRenamingNodeAllowed(TreeViewItem node)
|
| 175 |
+
{
|
| 176 |
+
return false;
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
}
|
benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.timeline@1.4.6/Editor/Animation/BindingSelector.cs.meta
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fileFormatVersion: 2
|
| 2 |
+
guid: c171b9ca03610ea4faa426e082a1075d
|
| 3 |
+
MonoImporter:
|
| 4 |
+
externalObjects: {}
|
| 5 |
+
serializedVersion: 2
|
| 6 |
+
defaultReferences: []
|
| 7 |
+
executionOrder: 0
|
| 8 |
+
icon: {instanceID: 0}
|
| 9 |
+
userData:
|
| 10 |
+
assetBundleName:
|
| 11 |
+
assetBundleVariant:
|