public virtual void Delete(WindowState state) { // we dont support deleting the summary if (m_DopeLines.index < 1) { return; } if (m_ClipDataSource == null) { return; } var clip = m_ClipDataSource.animationClip; if (clip == null) { return; } int curveIndexToDelete = m_DopeLines.index - 1; var bindings = AnimationUtility.GetCurveBindings(clip); if (curveIndexToDelete >= bindings.Length) { return; } TimelineUndo.PushUndo(clip, "Delete Curve"); AnimationUtility.SetEditorCurve(clip, bindings[m_DopeLines.index - 1], null); state.rebuildGraph = true; }
public void InitIfNeeded(Rect rect, CurveDataSource dataSource, bool isNewSelection) { if (Event.current.type != EventType.Layout) { return; } m_CurveDataSource = dataSource; var clip = dataSource.animationClip; List <EditorCurveBinding> allBindings = new List <EditorCurveBinding>(); allBindings.Add(new EditorCurveBinding { propertyName = "Summary" }); if (clip != null) { allBindings.AddRange(AnimationUtility.GetCurveBindings(clip)); } m_DopeLines.list = allBindings.ToArray(); if (m_TreeViewState != null) { if (isNewSelection) { RefreshAll(); } return; } m_TreeViewState = m_TrackGlobalTreeViewState != null ? m_TrackGlobalTreeViewState : new TreeViewState(); m_TreeView = new TreeViewController(m_Window, m_TreeViewState) { useExpansionAnimation = false, deselectOnUnhandledMouseDown = true }; m_TreeView.selectionChangedCallback += OnItemSelectionChanged; m_TreeViewDataSource = new BindingTreeViewDataSource(m_TreeView, clip, m_CurveDataSource); m_TreeView.Init(rect, m_TreeViewDataSource, new BindingTreeViewGUI(m_TreeView), null); m_TreeViewDataSource.UpdateData(); RefreshSelection(); }
public static AnimationClipCurveData[] GetAllCurves(AnimationClip clip, [DefaultValue("true")] bool includeCurveData) { EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(clip); AnimationClipCurveData[] array = new AnimationClipCurveData[curveBindings.Length]; for (int i = 0; i < array.Length; i++) { array[i] = new AnimationClipCurveData(curveBindings[i]); if (includeCurveData) { array[i].curve = AnimationUtility.GetEditorCurve(clip, curveBindings[i]); } } return(array); }
private void SetAnimationCurves() { this.m_AnimatedCurves = new Hashtable(); this.m_AnimatedPaths = new Hashtable(); this.m_LeftoverCurves = new Hashtable(); if (this.clip != null) { EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(this.clip); EditorCurveBinding[] array = curveBindings; for (int i = 0; i < array.Length; i++) { EditorCurveBinding editorCurveBinding = array[i]; int curveID = CurveUtility.GetCurveID(this.clip, editorCurveBinding); this.m_AnimatedCurves[curveID] = true; if (!this.CheckIfPropertyExists(editorCurveBinding)) { this.m_LeftoverCurves[editorCurveBinding] = editorCurveBinding; } else { this.m_AnimatedPaths[CurveUtility.GetPathAndTypeID(editorCurveBinding.path, editorCurveBinding.type)] = true; string text = editorCurveBinding.path; while (true) { int hashCode = text.GetHashCode(); if (this.m_AnimatedPaths.Contains(hashCode)) { break; } this.m_AnimatedPaths[hashCode] = true; if (text.Length == 0) { break; } int num = text.LastIndexOf('/'); if (num > 0) { text = text.Substring(0, num); } else { text = string.Empty; } } } } } }
public virtual void Delete(ITimelineState state) { if (this.m_DopeLines.get_index() >= 1) { if (this.m_ClipDataSource != null) { AnimationClip animationClip = this.m_ClipDataSource.animationClip; if (!(animationClip == null)) { int num = this.m_DopeLines.get_index() - 1; EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(animationClip); if (num < curveBindings.Length) { TimelineUndo.PushUndo(animationClip, "Delete Curve"); AnimationUtility.SetEditorCurve(animationClip, curveBindings[this.m_DopeLines.get_index() - 1], null); state.rebuildGraph = true; } } } } }
public void InitIfNeeded(Rect rect, CurveDataSource dataSource) { if (Event.get_current().get_type() == 8) { this.m_ClipDataSource = dataSource; AnimationClip animationClip = dataSource.animationClip; int num = (this.m_DopeLines.get_list() == null) ? 0 : this.m_DopeLines.get_list().Count; List <EditorCurveBinding> list = new List <EditorCurveBinding>(); list.Add(new EditorCurveBinding { propertyName = "Summary" }); if (animationClip != null) { list.AddRange(AnimationUtility.GetCurveBindings(animationClip)); } this.m_DopeLines.set_list(list.ToArray()); if (num != this.m_DopeLines.get_list().Count) { this.UpdateRowHeight(); } if (this.m_TreeViewState == null) { this.m_TreeViewState = new TreeViewState(); TreeViewController treeViewController = new TreeViewController(this.m_Window, this.m_TreeViewState); treeViewController.set_useExpansionAnimation(false); treeViewController.set_deselectOnUnhandledMouseDown(true); this.m_TreeView = treeViewController; TreeViewController expr_FD = this.m_TreeView; expr_FD.set_selectionChangedCallback((Action <int[]>)Delegate.Combine(expr_FD.get_selectionChangedCallback(), new Action <int[]>(this.OnItemSelectionChanged))); this.m_TreeViewDataSource = new BindingTreeViewDataSource(this.m_TreeView, animationClip); this.m_TreeView.Init(rect, this.m_TreeViewDataSource, new BindingTreeViewGUI(this.m_TreeView), null); this.m_TreeViewDataSource.UpdateData(); this.OnItemSelectionChanged(null); } } }