ILayerable
代码修改动画后推
public static void SetTimeClipExtrapolation(TimelineClip clip,TimelineClip.ClipExtrapolation extrapolation)
{
var type = clip.GetType();
var property = type.GetProperty("postExtrapolationMode");
property.SetValue(clip,extrapolation);
}
TrackAsset内获取绑定对象
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
{
var director = go.GetComponent<PlayableDirector>();
var animator = director.GetGenericBinding(this) as Animator;
}
在Clip上显示正确的AnimationClip长度
public override double duration
{
get
{
double length = TimeUtility.GetAnimationClipLength(animationClip);
if (length < float.Epsilon)
return base.duration;
return length;
}
}
自定义背景
public class AnimationExtClipEditor:ClipEditor
{
public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region)
{
base.DrawBackground(clip, region);
var ac = clip.asset as AnimationExtClip;
var blendTime = ac.template.BlendTime;
if (blendTime <= 0)
{
return;
}
if (clip.hasBlendIn)
{
return;
}
var duration = clip.duration;
float left = region.position.xMin;
float max = region.position.xMax;
float right = blendTime / (float)duration * max;
right = Mathf.Min(right, max);
var rect = Rect.MinMaxRect(left, region.position.yMin, right, region.position.yMax);
EditorGUI.DrawRect(rect, Color.green);
}
}
外推对Behaviour逻辑的影响
超过Clip范围,外推时State还是Playing
会改变Duration
seekOccur问题
mixer为true,clip对应的behaviour为false
设置TimelineClip的Extrapolation属性
public static void SetTimeClipExtrapolation(TimelineClip clip,TimelineClip.ClipExtrapolation extrapolation)
{
var type = clip.GetType();
var property = type.GetProperty("postExtrapolationMode");
property.SetValue(clip,extrapolation);
}
Clip上显示的文字改变
继承ClipEditor
public override void OnClipChanged(TimelineClip clip)
{
base.OnClipChanged(clip);
var extClip = clip.asset as AnimationExtClip;
if (extClip == null)
{
return;
}
if (extClip.animationClip != null)
{
clip.displayName = extClip.animationClip.name;
}
}
代码中设置ExposedReference<T>
string guid = GUID.Generate().ToString();
ExposedReference<CinemachineVirtualCameraBase> cam;
cam.exposedName = guid;
标签:clip,Timeline,void,笔记,override,Unity,var,TimelineClip,public
From: https://www.cnblogs.com/terrynoya/p/15989384.html