예제 #1
0
        public void ReplaceAnimation(object sender, EventArgs args)
        {
            using (OpenFileDialog of = new OpenFileDialog())
            {
                of.ShowDialog();

                foreach (string filename in of.FileNames)
                {
                    if (filename.EndsWith(".omo"))
                    {
                        Animation a = OMOOld.read(new FileData(filename));
                        a.Text = filename;
                        ReplaceMe(a);
                    }
                    if (filename.EndsWith(".smd"))
                    {
                        Animation a = new Animation(filename.Replace(".smd", ""));
                        Smd.Read(filename, a, Runtime.TargetVbn);
                        ReplaceMe(a);
                    }
                    if (filename.EndsWith(".chr0"))
                    {
                        Animation a = (CHR0.read(new FileData(filename), Runtime.TargetVbn));
                        ReplaceMe(a);
                    }
                    if (filename.EndsWith(".anim"))
                    {
                        Animation a = (ANIM.read(filename, Runtime.TargetVbn));
                        ReplaceMe(a);
                    }
                }
            }
        }
예제 #2
0
 public void Import(object sender, EventArgs args)
 {
     using (OpenFileDialog fd = new OpenFileDialog())
     {
         fd.Filter = "Supported Formats|*.omo;*.anim;*.chr0;*.smd;*.mta;|" +
                     "Object Motion|*.omo|" +
                     "Maya Animation|*.anim|" +
                     "NW4R Animation|*.chr0|" +
                     "Source Animation (SMD)|*.smd|" +
                     "Smash 4 Material Animation (MTA)|*.mta|" +
                     "All files(*.*)|*.*";
         if (fd.ShowDialog() == DialogResult.OK)
         {
             foreach (string filename in fd.FileNames)
             {
                 if (filename.EndsWith(".mta"))
                 {
                     MTA mta = new MTA();
                     try
                     {
                         mta.Read(filename);
                         Runtime.MaterialAnimations.Add(filename, mta);
                         Nodes.Add(filename);
                     }
                     catch (Exception)
                     {
                         mta = null;
                     }
                 }
                 else if (filename.EndsWith(".smd"))
                 {
                     var anim = new Animation(filename);
                     if (Runtime.TargetVbn == null)
                     {
                         Runtime.TargetVbn = new VBN();
                     }
                     Smd.Read(filename, anim, Runtime.TargetVbn);
                     Nodes.Add(anim);
                 }
                 if (filename.EndsWith(".omo"))
                 {
                     Animation a = OMOOld.read(new FileData(filename));
                     a.Text = filename;
                     Nodes.Add(a);
                 }
                 if (filename.EndsWith(".chr0"))
                 {
                     Nodes.Add(CHR0.read(new FileData(filename), Runtime.TargetVbn));
                 }
                 if (filename.EndsWith(".anim"))
                 {
                     Nodes.Add(ANIM.read(filename, Runtime.TargetVbn));
                 }
             }
         }
     }
 }
예제 #3
0
        public void Read(FileData d)
        {
            d.endian = Endianness.Big;

            d.Seek(0x16);
            int count = d.ReadUShort();

            d.Seek(0x60);

            for (int i = 0; i < count; i++)
            {
                string name = d.ReadString(d.Pos(), -1);
                d.Skip(0x40);
                int unk      = d.ReadInt();
                int nextFile = d.ReadInt();
                int c2       = d.ReadUShort();
                int c1       = d.ReadUShort();
                d.Skip(4); // padding?

                int[] partsizes = new int[4];
                for (int j = 0; j < 4; j++)
                {
                    partsizes[j] = d.ReadInt();
                }

                TreeNode part = new TreeNode();
                part.Text = name;
                Nodes.Add(part);

                int off = 0;
                for (int j = 0; j < c1; j++)
                {
                    TreeNode t = new TreeNode();
                    part.Nodes.Add(t);
                    int    decompressedSize = d.ReadInt();
                    byte[] dat = FileData.InflateZlib(d.GetSection(d.Pos(), partsizes[j] - 4 - off));
                    d.Skip(partsizes[j] - 4);
                    off += partsizes[j];
                    string mag = new FileData(dat).Magic();
                    t.Text = name + "." + mag;

                    if (mag.Equals("NTWD"))
                    {
                        Runtime.textureContainers.Add(new NUT(new FileData(dat)));
                    }

                    if (mag.Equals("OMO "))
                    {
                        Runtime.Animations.Add(t.Text, OMOOld.read(new FileData(dat)));
                        MainForm.Instance.animList.treeView1.Nodes.Add(t.Text);
                    }
                }
            }
        }
예제 #4
0
        public void ImportAnimation(string filename)
        {
            if (filename.ToLower().EndsWith(".pac"))
            {
                PAC p = new PAC();
                p.Read(filename);
                AnimationGroupNode animGroup = new AnimationGroupNode()
                {
                    Text = filename
                };
                string groupname = null;
                foreach (var pair in p.Files)
                {
                    if (pair.Key.EndsWith(".omo"))
                    {
                        var anim = OMOOld.read(new FileData(pair.Value));
                        animGroup.Nodes.Add(anim);
                        string animName = Regex.Match(pair.Key, @"([A-Z][0-9][0-9])(.*)").Groups[0].ToString();

                        if (!string.IsNullOrEmpty(animName))
                        {
                            if (groupname == null)
                            {
                                groupname = pair.Key.Replace(animName, "");
                            }
                            anim.Text = animName;
                        }
                        //Runtime.acmdEditor.updateCrcList();
                    }
                    else if (pair.Key.EndsWith(".mta"))
                    {
                        MTA mta = new MTA();
                        mta.read(new FileData(pair.Value));
                        mta.Text = pair.Key;
                        animGroup.Nodes.Add(mta);
                    }
                }

                if (groupname != null && !groupname.Equals(""))
                {
                    animGroup.useGroupName = true;
                    animGroup.Text         = groupname;
                }

                treeView1.Nodes.Add(animGroup);
            }
        }