检索动画片段中的浮点曲线绑定。
Unity 有两种类型的动画:浮点曲线和对象引用曲线。浮点曲线是经典曲线,它随时间推移动画化浮点属性。对象引用曲线是随时间推移动画化对象引用属性的结构。
此方法返回浮点曲线绑定。有关对象引用曲线,请参阅 AnimationUtility.GetObjectReferenceCurveBindings。
using UnityEditor; using UnityEngine;
// Editor window for listing all float curves in an animation clip public class ClipInfo : EditorWindow { private AnimationClip clip;
[MenuItem("Window/Clip Info")] static void Init() { GetWindow(typeof(ClipInfo)); }
public void OnGUI() { clip = EditorGUILayout.ObjectField("Clip", clip, typeof(AnimationClip), false) as AnimationClip;
EditorGUILayout.LabelField("Curves:"); if (clip != null) { foreach (var binding in AnimationUtility.GetCurveBindings(clip)) { AnimationCurve curve = AnimationUtility.GetEditorCurve(clip, binding); EditorGUILayout.LabelField(binding.path + "/" + binding.propertyName + ", Keys: " + curve.keys.Length); } } } }