public static AnimationWindowCurve CreateDefaultCurve(AnimationWindowSelectionItem selectionItem, EditorCurveBinding binding) { AnimationClip animationClip = selectionItem.animationClip; Type editorCurveValueType = selectionItem.GetEditorCurveValueType(binding); AnimationWindowCurve animationWindowCurve = new AnimationWindowCurve(animationClip, binding, editorCurveValueType); object currentValue = CurveBindingUtility.GetCurrentValue(selectionItem.rootGameObject, binding); if (animationClip.length == 0f) { AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(0f, animationClip.frameRate)); } else { AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(0f, animationClip.frameRate)); AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(animationClip.length, animationClip.frameRate)); } return(animationWindowCurve); }
public static bool IsNodeLeftOverCurve(AnimationWindowHierarchyNode node) { EditorCurveBinding?binding = node.binding; bool result; if (binding.HasValue) { if (node.curves.Length > 0) { AnimationWindowSelectionItem selectionBinding = node.curves[0].selectionBinding; if (selectionBinding != null) { if (selectionBinding.rootGameObject == null && selectionBinding.scriptableObject == null) { result = false; return(result); } AnimationWindowSelectionItem arg_77_0 = selectionBinding; EditorCurveBinding? binding2 = node.binding; result = (arg_77_0.GetEditorCurveValueType(binding2.Value) == null); return(result); } } } if (node.hasChildren) { using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator()) { if (enumerator.MoveNext()) { TreeViewItem current = enumerator.Current; result = AnimationWindowUtility.IsNodeLeftOverCurve(current as AnimationWindowHierarchyNode); return(result); } } } result = false; return(result); }