Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,112 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEditor.Timeline.Actions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace DocCodeExamples
|
||||
{
|
||||
class ActionExamples_HideAPI
|
||||
{
|
||||
#region declare-sampleClipAction
|
||||
|
||||
[MenuEntry("Custom Actions/Sample clip Action")]
|
||||
public class SampleClipAction : ClipAction
|
||||
{
|
||||
public override ActionValidity Validate(IEnumerable<TimelineClip> clip)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(IEnumerable<TimelineClip> items)
|
||||
{
|
||||
Debug.Log("Test Action");
|
||||
return true;
|
||||
}
|
||||
|
||||
[TimelineShortcut("SampleClipAction", KeyCode.K)]
|
||||
public static void HandleShortCut(ShortcutArguments args)
|
||||
{
|
||||
Invoker.InvokeWithSelectedClips<SampleClipAction>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-sampleMarkerAction
|
||||
|
||||
[MenuEntry("Custom Actions/Sample marker Action")]
|
||||
public class SampleMarkerAction : MarkerAction
|
||||
{
|
||||
public override ActionValidity Validate(IEnumerable<IMarker> markers)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(IEnumerable<IMarker> items)
|
||||
{
|
||||
Debug.Log("Test Action");
|
||||
return true;
|
||||
}
|
||||
|
||||
[TimelineShortcut("SampleMarkerAction", KeyCode.L)]
|
||||
public static void HandleShortCut(ShortcutArguments args)
|
||||
{
|
||||
Invoker.InvokeWithSelectedMarkers<SampleMarkerAction>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-sampleTrackAction
|
||||
|
||||
[MenuEntry("Custom Actions/Sample track Action")]
|
||||
public class SampleTrackAction : TrackAction
|
||||
{
|
||||
public override ActionValidity Validate(IEnumerable<TrackAsset> tracks)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(IEnumerable<TrackAsset> tracks)
|
||||
{
|
||||
Debug.Log("Test Action");
|
||||
return true;
|
||||
}
|
||||
|
||||
[TimelineShortcut("SampleTrackAction", KeyCode.H)]
|
||||
public static void HandleShortCut(ShortcutArguments args)
|
||||
{
|
||||
Invoker.InvokeWithSelectedTracks<SampleTrackAction>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-sampleTimelineAction
|
||||
|
||||
[MenuEntry("Custom Actions/Sample Timeline Action")]
|
||||
public class SampleTimelineAction : TimelineAction
|
||||
{
|
||||
public override ActionValidity Validate(ActionContext context)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(ActionContext context)
|
||||
{
|
||||
Debug.Log("Test Action");
|
||||
return true;
|
||||
}
|
||||
|
||||
[TimelineShortcut("SampleTimelineAction", KeyCode.Q)]
|
||||
public static void HandleShortCut(ShortcutArguments args)
|
||||
{
|
||||
Invoker.InvokeWithSelected<SampleTimelineAction>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 617e6579183b7cc488aae748fe3f88bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "DocCodeExamples",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:f06555f75b070af458a003d92f9efb00",
|
||||
"GUID:02f771204943f4a40949438e873e3eff"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9550f6b9c1ac87345a996c43f204fb30
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,20 @@
|
|||
using UnityEditor;
|
||||
using UnityEditor.Timeline;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DocCodeExamples
|
||||
{
|
||||
class MarkerEditorExamples
|
||||
{
|
||||
void MarkerRegionExample(MarkerOverlayRegion region)
|
||||
{
|
||||
#region declare-trackRegion
|
||||
|
||||
GUI.BeginClip(region.trackRegion, -region.trackRegion.min, Vector2.zero, false);
|
||||
EditorGUI.DrawRect(region.markerRegion, Color.blue);
|
||||
GUI.EndClip();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ebaa79c245e369449a3565c4b9c3e703
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,132 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEditor.Timeline;
|
||||
using UnityEditor.Timeline.Actions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace DocCodeExamples
|
||||
{
|
||||
class TimelineAttributesExamples_HideAPI
|
||||
{
|
||||
#region declare-sampleTrackBindingAttr
|
||||
|
||||
[TrackBindingType(typeof(Light), TrackBindingFlags.AllowCreateComponent)]
|
||||
public class LightTrack : TrackAsset {}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-menuEntryAttribute
|
||||
|
||||
[MenuEntry("Simple Menu Action")]
|
||||
class SimpleMenuAction : TimelineAction
|
||||
{
|
||||
public override ActionValidity Validate(ActionContext actionContext)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(ActionContext actionContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[MenuEntry("Menu Action with priority", 9999)]
|
||||
class MenuActionWithPriority : TimelineAction
|
||||
{
|
||||
public override ActionValidity Validate(ActionContext actionContext)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(ActionContext actionContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[MenuEntry("My Menu/Menu Action inside submenu")]
|
||||
class MenuActionInsideSubMenu : TimelineAction
|
||||
{
|
||||
public override ActionValidity Validate(ActionContext actionContext)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(ActionContext actionContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-timelineShortcutAttr
|
||||
|
||||
public class ShortcutAction : TimelineAction
|
||||
{
|
||||
public override ActionValidity Validate(ActionContext _)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(ActionContext _)
|
||||
{
|
||||
Debug.Log("Action executed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
[TimelineShortcut("Test Action", KeyCode.K, ShortcutModifiers.Shift | ShortcutModifiers.Alt)]
|
||||
public static void HandleShortCut(ShortcutArguments args)
|
||||
{
|
||||
Invoker.InvokeWithSelected<ShortcutAction>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-applyDefaultUndoAttr
|
||||
|
||||
[ApplyDefaultUndo]
|
||||
public class SetNameToTypeAction : TrackAction
|
||||
{
|
||||
public override ActionValidity Validate(IEnumerable<TrackAsset> items)
|
||||
{
|
||||
return ActionValidity.Valid;
|
||||
}
|
||||
|
||||
public override bool Execute(IEnumerable<TrackAsset> items)
|
||||
{
|
||||
foreach (TrackAsset track in items)
|
||||
track.name = track.GetType().Name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-customStyleMarkerAttr
|
||||
|
||||
[CustomStyle("MyStyle")]
|
||||
public class MyMarker : UnityEngine.Timeline.Marker {}
|
||||
|
||||
#endregion
|
||||
|
||||
#region declare-customTimelineEditorAttr
|
||||
|
||||
[CustomTimelineEditor(typeof(MyCustomClip))]
|
||||
class MyCustomClipEditor : ClipEditor {}
|
||||
|
||||
#endregion
|
||||
|
||||
class MyCustomClip : PlayableAsset
|
||||
{
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
return Playable.Null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5724bf63aa724f5586275b3153a02a01
|
||||
timeCreated: 1600894640
|
|
@ -0,0 +1,16 @@
|
|||
using UnityEditor.Timeline;
|
||||
|
||||
namespace DocCodeExamples
|
||||
{
|
||||
class TimelineEditorExamples_HideAPI
|
||||
{
|
||||
void RefreshReasonExample()
|
||||
{
|
||||
#region declare-refreshReason
|
||||
|
||||
TimelineEditor.Refresh(RefreshReason.ContentsModified | RefreshReason.SceneNeedsUpdate);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6cd9f16fc29247c8af731c6b3b0a990f
|
||||
timeCreated: 1600965115
|
|
@ -0,0 +1,17 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace DocCodeExamples
|
||||
{
|
||||
class TrackAssetExamples_HideAPI
|
||||
{
|
||||
#region declare-trackAssetExample
|
||||
|
||||
[TrackColor(1, 0, 0)]
|
||||
[TrackBindingType(typeof(Animator))]
|
||||
[TrackClipType(typeof(AnimationClip))]
|
||||
public class CustomAnimationTrack : TrackAsset {}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c9f0489deaf04d0fbcbe45fd50a018f6
|
||||
timeCreated: 1600894170
|
Loading…
Add table
Add a link
Reference in a new issue