Unity-jump-proj
This commit is contained in:
@ -0,0 +1,56 @@
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
namespace UnityEditor.Timeline
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[CustomTimelineEditor(typeof(ActivationTrack))]
|
||||
class ActivationTrackEditor : TrackEditor
|
||||
{
|
||||
static readonly string ClipText = L10n.Tr("Active");
|
||||
|
||||
static readonly string k_ErrorParentString = L10n.Tr("The bound GameObject is a parent of the PlayableDirector.");
|
||||
static readonly string k_ErrorString = L10n.Tr("The bound GameObject contains the PlayableDirector.");
|
||||
|
||||
public override TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
|
||||
{
|
||||
var options = base.GetTrackOptions(track, binding);
|
||||
options.errorText = GetErrorText(track, binding);
|
||||
return options;
|
||||
}
|
||||
|
||||
string GetErrorText(TrackAsset track, Object binding)
|
||||
{
|
||||
var gameObject = binding as GameObject;
|
||||
var currentDirector = TimelineEditor.inspectedDirector;
|
||||
if (gameObject != null && currentDirector != null)
|
||||
{
|
||||
var director = gameObject.GetComponent<PlayableDirector>();
|
||||
if (currentDirector == director)
|
||||
{
|
||||
return k_ErrorString;
|
||||
}
|
||||
|
||||
if (currentDirector.gameObject.transform.IsChildOf(gameObject.transform))
|
||||
{
|
||||
return k_ErrorParentString;
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetErrorText(track, binding, TrackBindingErrors.PrefabBound);
|
||||
}
|
||||
|
||||
public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
|
||||
{
|
||||
// Add a default clip to the newly created track
|
||||
if (copiedFrom == null)
|
||||
{
|
||||
var clip = track.CreateClip(0);
|
||||
clip.displayName = ClipText;
|
||||
clip.duration = System.Math.Max(clip.duration, track.timelineAsset.duration * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fbcc9b1f6ace8c4f8724a88dccca5f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Timeline;
|
||||
|
||||
namespace UnityEditor.Timeline
|
||||
{
|
||||
[CustomEditor(typeof(ActivationTrack))]
|
||||
class ActivationTrackInspector : TrackAssetInspector
|
||||
{
|
||||
static class Styles
|
||||
{
|
||||
public static readonly GUIContent PostPlaybackStateText = L10n.TextContent("Post-playback state");
|
||||
}
|
||||
|
||||
SerializedProperty m_PostPlaybackProperty;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
using (new EditorGUI.DisabledScope(IsTrackLocked()))
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
if (m_PostPlaybackProperty != null)
|
||||
EditorGUILayout.PropertyField(m_PostPlaybackProperty, Styles.PostPlaybackStateText);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
var activationTrack = target as ActivationTrack;
|
||||
if (activationTrack != null)
|
||||
activationTrack.UpdateTrackMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_PostPlaybackProperty = serializedObject.FindProperty("m_PostPlaybackState");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c46b007a3762fc84cb1ee7ca30060f0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user