Example #1
0
 private void button7_Click(object sender, EventArgs ea)
 {
     int n = listBox7.SelectedIndex;
     if (pcc == null || n == -1 || importudk == null)
         return;
     PCCPackage.ExportEntry e;
     bool overwrite = toolStripComboBox2.SelectedIndex == 1;
     int i = 0;
     if(overwrite)
     {
         if (Int32.TryParse(toolStripTextBox1.Text, out i))
         {
             e = pcc.Exports[i];
         }
         else
             return;
     }
     else
         e = new PCCPackage.ExportEntry();
     UDKObject.ExportEntry im = importudk.Exports[Objects[n]];            
     e.idxArchetype = 0;
     if (!overwrite)
     {
         e.idxLink = 0;
         e.idxName = pcc.FindNameOrAdd(importudk.GetName(im.name));
     }
     e.idxParent = 0;
     
     e.idxClass = pcc.FindClass("StaticMesh");
     e.ObjectFlags = 0x000F0004;
     e.Unk2 = 1;
     e.Unk3 = new int[0];
     MemoryStream m = new MemoryStream();
     CopySTMfromUDK(m, importudk, Objects[n]);
     e.Data = m.ToArray();
     e.DataLoaded = true;
     e.Datasize = e.Data.Length;
     if (overwrite)
         pcc.Exports[i] = e;
     else
     {
         pcc.Exports.Add(e);
         pcc.Header.ExportCount++;
     }
     listBox7.Items.Clear();
     richTextBox1.Text = "";
     importudk = null;
     RefreshAll();
     MessageBox.Show("Done");
 }
Example #2
0
 private void CopySTMfromUDK(MemoryStream m, UDKObject u, int idx)
 {
     UDKLibWV.Classes.StaticMesh stm = new UDKLibWV.Classes.StaticMesh(u, idx);
     m.Write(BitConverter.GetBytes((int)0), 0, 4);
     WriteName(m, pcc.FindNameOrAdd("BodySetup"));
     WriteName(m, pcc.FindNameOrAdd("ObjectProperty"));
     WriteInt(m, 4);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteName(m, pcc.FindNameOrAdd("UseSimpleBoxCollision"));
     WriteName(m, pcc.FindNameOrAdd("BoolProperty"));
     WriteInt(m, 0);
     WriteInt(m, 0);
     m.WriteByte(1);
     WriteName(m, pcc.FindNameOrAdd("None"));
     m.Write(stm.Bounds1, 0, stm.Bounds1.Length);
     WriteInt(m, 0);
     m.Write(stm.Bounds2, 0, stm.Bounds2.Length);
     m.Write(stm.Surfs, 0, stm.Surfs.Length);
     m.Write(stm.Faces, 0, stm.Faces.Length);
     WriteInt(m, 18);
     WriteInt(m, 1);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     m.Write(stm.Mats, 0, stm.Mats.Length);
     m.Write(stm.Tris, 0, 8);
     WriteInt(m, 1);
     m.Write(stm.Tris, 0, stm.Tris.Length);            
     m.Write(stm.Unk3, 0, stm.Unk3.Length);
     WriteInt(m, 0);
     m.Write(stm.UVs, 0, stm.UVs.Length);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 4);
     WriteInt(m, 0);
     WriteInt(m, 4);
     m.Write(stm.Unk4, 4, 8);
     m.Write(stm.Indexes1, 0, stm.Indexes1.Length);
     WriteInt(m, 2);
     WriteInt(m, 0);
     WriteInt(m, 0x10);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 1);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
     WriteInt(m, 0);
 }
Example #3
0
 private void button6_Click(object sender, EventArgs e)
 {
     listBox7.Items.Clear();
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.upk|*.upk";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Objects = new List<int>();
         importudk = new UDKObject(d.FileName);
         for (int i = 0; i < importudk.Exports.Count; i++)
             if (importudk.GetClass(importudk.Exports[i].clas) == "StaticMesh")
             {
                 Objects.Add(i);
                 listBox7.Items.Add("#" + i.ToString("d6") + " : " + importudk.GetName(importudk.Exports[i].name));
             }
     }
 }