/// <summary>
        ///
        /// </summary>
        private void UpdateAnimationWithFSMs()
        {
            // load backup animation
            var tempanim = new JointAnimManager();

            tempanim.FromFigaTree(BackupAnim.ToFigaTree());
            var backup = BackupAnim;

            // apply fsms to backup animation
            tempanim.ApplyFSMs(FrameSpeedModifiers);

            // load edited anim
            LoadFigaTree(SelectedAction.Symbol, tempanim.ToFigaTree());
            BackupAnim = backup;

            // refresh fsm display tips
            UpdateFrameTips();
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void compressAllAnimationsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (AJManager == null)
            {
                return;
            }

            HashSet <string> edited = new HashSet <string>();
            int oldSize             = 0;
            int newSize             = 0;

            foreach (var a in AllActions)
            {
                if (string.IsNullOrEmpty(a.Symbol) || edited.Contains(a.Symbol))
                {
                    continue;
                }

                var anim = AJManager.GetAnimationData(a.Symbol);
                if (anim != null)
                {
                    JointAnimManager ja = new JointAnimManager();
                    var animfile        = new HSDRawFile(anim);
                    ja.FromFigaTree(animfile.Roots[0].Data as HSD_FigaTree);
                    //ja.Optimize(JointManager.GetJOBJ(0), 0.01f);
                    animfile.Roots[0].Data = ja.ToFigaTree(0.01f);
                    using (MemoryStream s = new MemoryStream())
                    {
                        animfile.Save(s);
                        var newfile = s.ToArray();
                        oldSize += anim.Length;
                        newSize += newfile.Length;
                        AJManager.SetAnimation(a.Symbol, newfile);
                    }
                }
                edited.Add(a.Symbol);
            }

            Console.WriteLine($"{oldSize.ToString("X")} => {newSize.ToString("X")}");
            Console.WriteLine($"Saved {(oldSize - newSize).ToString("X")} bytes");
        }