public void LoadFile(ResU.ResFile resFileU) { ResFileNode.Load(resFileU); BfresWiiU.Read(this, resFileU, ResFileNode); UpdateVertexData(); UpdateTextureMaps(); }
private void button1_Click(object sender, EventArgs e) { if (formatCB.SelectedIndex < 0) { return; } string SelectedText = attributeCB.GetItemText(attributeCB.SelectedItem); DialogResult dialogResult = MessageBox.Show($"Are you sure you want to remove all {SelectedText} from" + $" FMDL {ActiveFMDL}? )", "", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { foreach (var shape in ActiveFMDL.shapes) { foreach (var att in shape.vertexAttributes) { if (att.Name == SelectedText) { shape.vertexAttributes.Remove(att); shape.SaveVertexBuffer(shape.IsWiiU); if (shape.IsWiiU) { BfresWiiU.ReadShapesVertices(shape, shape.ShapeU, shape.VertexBufferU, ActiveFMDL); } else { BfresSwitch.ReadShapesVertices(shape, shape.Shape, shape.VertexBuffer, ActiveFMDL); } attributeCB.Items.Remove(att.Name); if (attributeCB.Items.Count > 0) { attributeCB.SelectedIndex = 0; } break; } } } LoadObjects(ActiveFMDL); ActiveFMDL.UpdateVertexData(); } }
private void SaveWiiU(MemoryStream mem) { var resFileU = BFRESRender.ResFileNode.resFileU; resFileU.Models.Clear(); resFileU.SkeletalAnims.Clear(); // resFileU.SceneAnims.Clear(); // resFileU.ShapeAnims.Clear(); // resFileU.BoneVisibilityAnims.Clear(); resFileU.Textures.Clear(); int CurMdl = 0; if (Nodes.ContainsKey("FMDL")) { foreach (FMDL model in Nodes["FMDL"].Nodes) { resFileU.Models.Add(model.Text, BfresWiiU.SetModel(model)); } } if (Nodes.ContainsKey("FTEX")) { foreach (FTEX tex in Nodes["FTEX"].Nodes) { tex.texture.Name = tex.Text; resFileU.Textures.Add(tex.Text, tex.texture); } } if (Nodes.ContainsKey("FSKA")) { foreach (FSKA ska in Nodes["FSKA"].Nodes) { ska.SkeletalAnimU.Name = ska.Text; resFileU.SkeletalAnims.Add(ska.Text, ska.SkeletalAnimU); } } else { throw new Exception("Failed to find textures"); } ErrorCheck(); resFileU.Save(mem); }
private void SaveWiiU(MemoryStream mem) { bfres.resFileU.Save(mem); int CurMdl = 0; foreach (FMDL model in bfres.models) { bfres.resFileU.Models[CurMdl].Shapes.Clear(); bfres.resFileU.Models[CurMdl].VertexBuffers.Clear(); bfres.resFileU.Models[CurMdl].Materials.Clear(); int i = 0; var duplicates = model.shapes.GroupBy(c => c.Text).Where(g => g.Skip(1).Any()).SelectMany(c => c); foreach (var shape in duplicates) { shape.Text += i++; } foreach (FSHP shape in model.shapes) { CheckMissingTextures(shape); BfresWiiU.SetShape(shape, shape.ShapeU); bfres.resFileU.Models[CurMdl].Shapes.Add(shape.Text, shape.ShapeU); bfres.resFileU.Models[CurMdl].VertexBuffers.Add(shape.VertexBufferU); SetShaderAssignAttributes(shape.GetMaterial().shaderassign, shape); } foreach (FMAT mat in model.materials.Values) { BfresWiiU.SetMaterial(mat, mat.MaterialU); bfres.resFileU.Models[CurMdl].Materials.Add(mat.Text, mat.MaterialU); } CurMdl++; } bfres.resFile.SkeletalAnims.Clear(); if (EditorRoot.Nodes.ContainsKey("FSKA")) { foreach (BfresSkeletonAnim ska in EditorRoot.Nodes["FSKA"].Nodes) { bfres.resFile.SkeletalAnims.Add(ska.SkeletalAnim); } } }
private void SaveWiiU(MemoryStream mem) { var resFileU = bfres.ResFileNode.resFileU; resFileU.Models.Clear(); // resFileU.SkeletalAnims.Clear(); // resFileU.SceneAnims.Clear(); // resFileU.ShapeAnims.Clear(); // resFileU.BoneVisibilityAnims.Clear(); // resFileU.Textures.Clear(); int CurMdl = 0; if (EditorRoot.Nodes.ContainsKey("FMDL")) { foreach (FMDL model in EditorRoot.Nodes["FMDL"].Nodes) { resFileU.Models.Add(model.Text, BfresWiiU.SetModel(model)); } } ErrorCheck(); resFileU.Save(mem); }