protected virtual void AddVariableAndTagData(SpriterAnimation animation, float targetTime)
        {
            if (animation.Meta == null)
            {
                return;
            }

            if (Config.VarsEnabled && animation.Meta.Varlines != null && animation.Meta.Varlines.Length > 0)
            {
                for (int i = 0; i < animation.Meta.Varlines.Length; ++i)
                {
                    SpriterVarline varline  = animation.Meta.Varlines[i];
                    SpriterVarDef  variable = animation.Entity.Variables[varline.Def];
                    FrameData.AnimationVars[variable.Name] = GetVariableValue(animation, variable, varline, targetTime);
                }
            }

            SpriterElement[] tags    = animation.Entity.Spriter.Tags;
            SpriterTagline   tagline = animation.Meta.Tagline;

            if (Config.TagsEnabled && tagline != null && tagline.Keys != null && tagline.Keys.Length > 0)
            {
                SpriterTaglineKey key = tagline.Keys.GetLastKey(targetTime);
                if (key != null && key.Tags != null)
                {
                    for (int i = 0; i < key.Tags.Length; ++i)
                    {
                        SpriterTag tag = key.Tags[i];
                        FrameData.AnimationTags.Add(tags[tag.TagId].Name);
                    }
                }
            }

            for (int i = 0; i < animation.Timelines.Length; ++i)
            {
                SpriterTimeline timeline = animation.Timelines[i];
                SpriterMeta     meta     = timeline.Meta;
                if (meta == null)
                {
                    continue;
                }

                SpriterObjectInfo objInfo = GetObjectInfo(animation, timeline.Name);

                if (Config.VarsEnabled && meta.Varlines != null && meta.Varlines.Length > 0)
                {
                    for (int j = 0; j < timeline.Meta.Varlines.Length; ++j)
                    {
                        SpriterVarline varline  = timeline.Meta.Varlines[j];
                        SpriterVarDef  variable = objInfo.Variables[varline.Def];
                        FrameData.AddObjectVar(objInfo.Name, variable.Name, GetVariableValue(animation, variable, varline, targetTime));
                    }
                }

                if (Config.TagsEnabled && meta.Tagline != null && meta.Tagline.Keys != null && meta.Tagline.Keys.Length > 0)
                {
                    SpriterTaglineKey key = tagline.Keys.GetLastKey(targetTime);
                    if (key != null && key.Tags != null)
                    {
                        for (int j = 0; j < key.Tags.Length; ++j)
                        {
                            SpriterTag tag = key.Tags[j];
                            FrameData.AddObjectTag(objInfo.Name, tags[tag.TagId].Name);
                        }
                    }
                }
            }
        }
        private static void AddVariableAndTagData(SpriterAnimation animation, float targetTime, FrameMetadata metadata)
        {
            if (animation.Meta == null)
            {
                return;
            }

            if (animation.Meta.Varlines != null && animation.Meta.Varlines.Length > 0)
            {
                foreach (SpriterVarline varline in animation.Meta.Varlines)
                {
                    SpriterVarDef variable = animation.Entity.Variables[varline.Def];
                    metadata.AnimationVars[variable.Name] = GetVariableValue(animation, variable, varline, targetTime);
                }
            }

            SpriterElement[] tags    = animation.Entity.Spriter.Tags;
            SpriterTagline   tagline = animation.Meta.Tagline;

            if (tagline != null && tagline.Keys != null && tagline.Keys.Length > 0)
            {
                SpriterTaglineKey key = LastKeyForTime <SpriterTaglineKey>(tagline.Keys, targetTime);
                if (key != null && key.Tags != null)
                {
                    foreach (SpriterTag tag in key.Tags)
                    {
                        metadata.AnimationTags.Add(tags[tag.TagId].Name);
                    }
                }
            }

            foreach (SpriterTimeline timeline in animation.Timelines)
            {
                SpriterMeta meta = timeline.Meta;
                if (meta == null)
                {
                    continue;
                }

                SpriterObjectInfo objInfo = GetObjectInfo(animation, timeline.Name);

                if (meta.Varlines != null && meta.Varlines.Length > 0)
                {
                    foreach (SpriterVarline varline in timeline.Meta.Varlines)
                    {
                        SpriterVarDef variable = objInfo.Variables[varline.Def];
                        metadata.AddObjectVar(objInfo.Name, variable.Name, GetVariableValue(animation, variable, varline, targetTime));
                    }
                }

                if (meta.Tagline != null && meta.Tagline.Keys != null && meta.Tagline.Keys.Length > 0)
                {
                    SpriterTaglineKey key = LastKeyForTime <SpriterTaglineKey>(tagline.Keys, targetTime);
                    if (key != null && key.Tags != null)
                    {
                        foreach (SpriterTag tag in key.Tags)
                        {
                            metadata.AddObjectTag(objInfo.Name, tags[tag.TagId].Name);
                        }
                    }
                }
            }
        }