Exemple #1
0
        private void importFromPSKToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n;

            if (stm != null)
            {
                n = stm.index;
            }
            else if (skm != null)
            {
                n = skm.MyIndex;
            }
            else
            {
                return;
            }
            if (pcc.Exports[n].ClassName == "StaticMesh")
            {
                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "*.psk|*.psk;*.pskx";
                if (d.ShowDialog() == DialogResult.OK)
                {
                    timer1.Enabled = false;
                    stm.ImportFromPsk(d.FileName);
                    byte[]       buff = stm.SerializeToBuffer();
                    int          idx  = n;
                    IExportEntry en   = pcc.Exports[idx];
                    en.Data = buff;
                    MessageBox.Show("Done.");
                    timer1.Enabled = true;
                }
            }
            if (pcc.Exports[n].ClassName == "SkeletalMesh")
            {
                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "*.psk|*.psk;*.pskx";
                if (d.ShowDialog() == DialogResult.OK)
                {
                    timer1.Enabled = false;
                    rtb1.Visible   = true;
                    skmold.ImportFromPsk(d.FileName, getLOD());
                    byte[]       buff = skmold.Serialize();
                    int          idx  = n;
                    IExportEntry en   = pcc.Exports[idx];
                    en.Data = buff;
                    MessageBox.Show("Done.");
                    rtb1.Visible   = false;
                    timer1.Enabled = true;
                }
            }
        }
Exemple #2
0
        private void importFromPSKToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1 | pcc == null)
            {
                return;
            }
            if (pcc.Exports[Objects[n].index].ClassName == "StaticMesh")
            {
                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "*.psk|*.psk;*.pskx";
                if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    timer1.Enabled = false;
                    stm.ImportFromPsk(d.FileName);
                    byte[] buff = stm.SerializeToBuffer();
                    int    idx  = Objects[n].index;
                    PCCObject.ExportEntry en = pcc.Exports[idx];
                    en.Data = buff;
                    pcc.altSaveToFile(CurrFile, true);
                    MessageBox.Show("Done.");
                    timer1.Enabled = true;
                }
            }
            if (pcc.Exports[Objects[n].index].ClassName == "SkeletalMesh")
            {
                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "*.psk|*.psk;*.pskx";
                if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    timer1.Enabled = false;
                    rtb1.Visible   = true;
                    skmold.ImportFromPsk(d.FileName, getLOD());
                    byte[] buff = skmold.Serialize();
                    int    idx  = Objects[n].index;
                    PCCObject.ExportEntry en = pcc.Exports[idx];
                    en.Data = buff;
                    pcc.altSaveToFile(CurrFile, true);
                    MessageBox.Show("Done.");
                    rtb1.Visible   = false;
                    timer1.Enabled = true;
                }
            }
        }