public BoneAnimGroup()
 {
     Translate = new Vector3Group()
     {
         Name = "Translate"
     };
     Rotate = new Vector4Group()
     {
         Name = "Rotate"
     };
     Scale = new Vector3Group()
     {
         Name = "Scale"
     };
     SubAnimGroups.Add(Translate);
     SubAnimGroups.Add(Rotate);
     SubAnimGroups.Add(Scale);
 }
Exemple #2
0
        public void InsertKey(Type groupType)
        {
            var    group    = SearchGroup(groupType);
            string platform = "F";

            if (animEntry is BFLAN.PaiEntry)
            {
                //First we find the proper group to insert our key
                //If it doesn't exist, create it.
                if (groupType == typeof(LytPaneSRTGroup))
                {
                    if (group == null)
                    {
                        var tag = new BxlanPaiTag($"{platform}LPA");
                        group = new LytPaneSRTGroup(tag);
                        animEntry.Tags.Add(tag);
                        SubAnimGroups.Add(group);
                    }
                }
            }
        }
Exemple #3
0
        public LytAnimGroup(BxlanPaiEntry entry)
        {
            animEntry = entry;
            Name      = entry.Name;
            if (entry.Target == AnimationTarget.Material)
            {
                Category = "Materials";
            }
            else if (entry.Target == AnimationTarget.Pane)
            {
                Category = "Panes";
            }
            else
            {
                Category = "User Data";
            }

            //Generate sub groups which contain the track data
            for (int i = 0; i < entry.Tags?.Count; i++)
            {
                STAnimGroup group = new STAnimGroup();
                string      tag   = entry.Tags[i].Tag.Remove(0, 1);
                switch (tag)
                {
                case "LPA":
                    group = new LytPaneSRTGroup(entry.Tags[i]);
                    break;

                case "LVI":
                    group = new LytVisibiltyGroup(entry.Tags[i]);
                    break;

                case "LTS":
                    group = new LytTextureSRTGroup(entry.Tags[i]);
                    break;

                case "LVC":
                    group = new LytVertexColorGroup(entry.Tags[i]);
                    break;

                case "LMC":
                    group = new LytMaterialColorGroup(entry.Tags[i]);
                    break;

                case "LIM":
                    group = new LytIndirectSRTGroup(entry.Tags[i]);
                    break;

                case "LTP":
                    group = new LytTexturePatternGroup(entry.Tags[i]);
                    break;

                case "LAC":
                    group = new LytAlphaTestGroup(entry.Tags[i]);
                    break;

                case "LCT":
                    group = new LytFontShadowGroup(entry.Tags[i]);
                    break;

                case "LCC":
                    group = new LytPerCharacterTransformCurveGroup(entry.Tags[i]);
                    break;
                }

                foreach (var keyGroup in entry.Tags[i].Entries)
                {
                    if (!(group is IAnimationTarget))
                    {
                        continue;
                    }

                    var targetGroup = ((IAnimationTarget)group).GetTrack(keyGroup.AnimationTarget);
                    if (targetGroup != null)
                    {
                        targetGroup.LoadKeyFrames(keyGroup.KeyFrames);
                        targetGroup.Name = keyGroup.TargetName;

                        if (keyGroup.CurveType == CurveType.Constant)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Constant;
                        }
                        else if (keyGroup.CurveType == CurveType.Hermite)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Hermite;
                        }
                        else if (keyGroup.CurveType == CurveType.Step)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Step;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"Unsupported track type for tag {keyGroup.TargetName} {keyGroup.AnimationTarget}");
                    }
                }

                group.Name = entry.Tags[i].Type;
                SubAnimGroups.Add(group);
            }
        }