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();
        }
        internal void RemovePropertiesByIds(IEnumerable <int> ids, bool removeCompleteGroup = true)
        {
            List <EditorCurveBinding> bindingsToRemove = new List <EditorCurveBinding>();

            foreach (int selectedId in ids)
            {
                BindingTreeViewDataSource bindingTree = m_BindingHierarchy.treeViewController.data as BindingTreeViewDataSource;
                CurveTreeViewNode         node        = bindingTree.FindItem(selectedId) as CurveTreeViewNode;
                if (node == null)
                {
                    continue;
                }
                foreach (EditorCurveBinding editorCurveBinding in node.bindings)
                {
                    if (bindingsToRemove.Contains(editorCurveBinding))
                    {
                        continue;
                    }
                    CurveTreeViewNode currentNode = node;
                    do
                    {
                        //check if property is part of a group
                        bool isRoot  = currentNode.depth == 0;
                        bool isGroup = currentNode.displayName == BindingTreeViewDataSource.GroupName(editorCurveBinding);
                        if (!isRoot && !isGroup && removeCompleteGroup)
                        {
                            currentNode = currentNode.parent as CurveTreeViewNode;
                        }
                        else
                        {
                            if (!AnimationWindowUtility.ForceGrouping(editorCurveBinding))
                            {
                                bindingsToRemove.Add(editorCurveBinding);
                            }
                            else //Group to remove
                            {
                                bindingsToRemove.AddRange(currentNode.bindings);
                            }
                            break;
                        }
                    }while (currentNode != null);
                }
            }

            RemoveProperty(bindingsToRemove);
            m_BindingHierarchy.RefreshTree();
            TimelineWindow.instance.state.CalculateRowRects();
        }
 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);
         }
     }
 }