private TimelineGroupGUI CreateItem(TrackAsset a, ref Dictionary <TrackAsset, TimelineGroupGUI> tree, List <TrackAsset> selectedRows, TreeViewItem parentTreeViewItem)
        {
            TimelineGroupGUI result;

            if (a == null)
            {
                result = null;
            }
            else
            {
                if (tree == null)
                {
                    throw new ArgumentNullException("tree");
                }
                if (selectedRows == null)
                {
                    throw new ArgumentNullException("selectedRows");
                }
                if (tree.ContainsKey(a))
                {
                    result = tree[a];
                }
                else
                {
                    TimelineTrackBaseGUI timelineTrackBaseGUI = parentTreeViewItem as TimelineTrackBaseGUI;
                    if (selectedRows.Contains(a.parent as TrackAsset))
                    {
                        timelineTrackBaseGUI = this.CreateItem(a.parent as TrackAsset, ref tree, selectedRows, parentTreeViewItem);
                    }
                    int num = -1;
                    if (timelineTrackBaseGUI != null)
                    {
                        num = timelineTrackBaseGUI.get_depth();
                    }
                    num++;
                    TimelineGroupGUI timelineGroupGUI;
                    if (a.GetType() != TimelineHelpers.GroupTrackType.trackType)
                    {
                        timelineGroupGUI = new TimelineTrackGUI(this.m_TreeView, this.m_ParentGUI, a.GetInstanceID(), num, timelineTrackBaseGUI, a.get_name(), a);
                    }
                    else
                    {
                        timelineGroupGUI = new TimelineGroupGUI(this.m_TreeView, this.m_ParentGUI, a.GetInstanceID(), num, timelineTrackBaseGUI, a.get_name(), a, false);
                    }
                    this.allTrackGuis.Add(timelineGroupGUI);
                    if (timelineTrackBaseGUI != null)
                    {
                        if (timelineTrackBaseGUI.get_children() == null)
                        {
                            timelineTrackBaseGUI.set_children(new List <TreeViewItem>());
                        }
                        timelineTrackBaseGUI.get_children().Add(timelineGroupGUI);
                    }
                    else
                    {
                        this.m_RootItem = timelineGroupGUI;
                        this.SetExpanded(this.m_RootItem, true);
                    }
                    tree[a] = timelineGroupGUI;
                    AnimationTrack animationTrack = timelineGroupGUI.track as AnimationTrack;
                    bool           flag           = animationTrack != null && animationTrack.ShouldShowInfiniteClipEditor();
                    if (flag)
                    {
                        if (timelineGroupGUI.get_children() == null)
                        {
                            timelineGroupGUI.set_children(new List <TreeViewItem>());
                        }
                    }
                    else
                    {
                        bool flag2 = false;
                        for (int num2 = 0; num2 != timelineGroupGUI.track.clips.Length; num2++)
                        {
                            AnimationClip animationClip  = timelineGroupGUI.track.clips[num2].curves;
                            AnimationClip animationClip2 = timelineGroupGUI.track.clips[num2].animationClip;
                            if (animationClip != null && animationClip.get_empty())
                            {
                                animationClip = null;
                            }
                            if (animationClip2 != null && animationClip2.get_empty())
                            {
                                animationClip2 = null;
                            }
                            if (animationClip2 != null && (animationClip2.get_hideFlags() & 8) != null)
                            {
                                animationClip2 = null;
                            }
                            if (!timelineGroupGUI.track.clips[num2].recordable)
                            {
                                animationClip2 = null;
                            }
                            flag2 = (animationClip != null || animationClip2 != null);
                            if (flag2)
                            {
                                break;
                            }
                        }
                        if (flag2)
                        {
                            if (timelineGroupGUI.get_children() == null)
                            {
                                timelineGroupGUI.set_children(new List <TreeViewItem>());
                            }
                        }
                    }
                    if (a.subTracks != null)
                    {
                        for (int i = 0; i < a.subTracks.Count; i++)
                        {
                            this.CreateItem(a.subTracks[i], ref tree, selectedRows, timelineGroupGUI);
                        }
                    }
                    result = timelineGroupGUI;
                }
            }
            return(result);
        }
        // 生成track公共信息
        private JSONObject GenerateBaseTrack(TrackAsset trackAsset, int type)
        {
            JSONObject trackJSON = new JSONObject(JSONObject.Type.OBJECT);

            trackJSON.AddField("name", trackAsset.name);
            trackJSON.AddField("type", type);

            // 兼容2017没有locked
            UnityEditor.SerializedObject serializedObject = new UnityEditor.SerializedObject(trackAsset);
            bool locked = serializedObject.FindProperty("m_Locked").boolValue;

            trackJSON.AddField("locked", locked);

            trackJSON.AddField("muted", trackAsset.muted);
            trackJSON.AddField("children", new JSONObject(JSONObject.Type.ARRAY));
            trackJSON.AddField("clips", new JSONObject(JSONObject.Type.ARRAY));
            trackJSON.AddField("infinityClip", JSONObject.nullJO);
            trackJSON.AddField("trackLocalId", GetTrackLocalIdByInstanceID(unityAssetPath, trackAsset.GetInstanceID()));
            return(trackJSON);
        }