public void AddField(AnimFieldInfo field)
        {
            bool exists = fieldInfos.Exists(x =>
            {
                return(x.path == field.path);
            });

            if (!exists)
            {
                fieldInfos.Add(field);
                Rebuild();
            }
        }
        /// <summary>
        /// Refreshes the contents of the curve and property display by loading animation curves from the provided
        /// animation clip.
        /// </summary>
        /// <param name="clip">Clip containing the animation to load.</param>
        private void LoadAnimClip(AnimationClip clip)
        {
            EditorPersistentData persistentData = EditorApplication.PersistentData;

            if (persistentData.dirtyAnimClips.TryGetValue(clip.UUID, out clipInfo))
            {
                // If an animation clip is imported, we don't care about it's cached curve values as they could have changed
                // since last modification, so we re-load the clip. But we persist the events as those can only be set
                // within the editor.
                if (clipInfo.isImported)
                {
                    EditorAnimClipInfo newClipInfo = EditorAnimClipInfo.Create(clip);
                    newClipInfo.events = clipInfo.events;
                }
            }
            else
                clipInfo = EditorAnimClipInfo.Create(clip);

            persistentData.dirtyAnimClips[clip.UUID] = clipInfo;

            AnimFieldInfo[] fieldInfos = new AnimFieldInfo[clipInfo.curves.Count];

            int idx = 0;
            foreach (var curve in clipInfo.curves)
                fieldInfos[idx++] = new AnimFieldInfo(curve.Key, curve.Value);

            guiFieldDisplay.SetFields(fieldInfos);

            guiCurveEditor.Events = clipInfo.events;
            guiCurveEditor.DisableCurveEdit = clipInfo.isImported;

            SetCurrentFrame(0);
            FPS = clipInfo.sampleRate;
        }
        /// <summary>
        /// Sets which fields to display.
        /// </summary>
        /// <param name="fields">A list of fields to display.</param>
        public void SetFields(AnimFieldInfo[] fields)
        {
            this.fieldInfos.Clear();
            this.fieldInfos.AddRange(fields);

            Rebuild();
        }
        /// <summary>
        /// Adds a new field to the existing field list, and displays it.
        /// </summary>
        /// <param name="field">Field to append to the field list, and display.</param>
        public void AddField(AnimFieldInfo field)
        {
            bool exists = fieldInfos.Exists(x =>
            {
                return x.path == field.path;
            });

            if (!exists)
            {
                fieldInfos.Add(field);
                Rebuild();
            }
        }