// Loading Mat private void loadPresetButton_Click(object sender, EventArgs e) { MaterialSelector matSelector = new MaterialSelector(); matSelector.ShowDialog(); if (matSelector.exitStatus == MaterialSelector.Opened) { FileData matFile = new FileData(matSelector.path); int soff = matFile.readInt(); NUD.PolyData pol = new NUD.PolyData() { texprop1 = matFile.readInt(), texprop2 = matFile.readInt(), texprop3 = matFile.readInt(), texprop4 = matFile.readInt() }; // Store the original material to preserve Tex IDs. NUD.Material original = currentPolygon.materials[0].Clone(); currentPolygon.materials = NUD.ReadMaterials(matFile, pol, soff); // Copy the old Tex IDs. currentPolygon.materials[0].CopyTextureIds(original); currentMaterialList = currentPolygon.materials; currentMatIndex = 0; Init(); FillForm(); } }
public static List <NUD.Material> ReadMaterialListFromPreset(string file) { FileData matFile = new FileData(file); int soff = matFile.readInt(); NUD.PolyData pol = new NUD.PolyData() { texprop1 = matFile.readInt(), texprop2 = matFile.readInt(), texprop3 = matFile.readInt(), texprop4 = matFile.readInt() }; List <NUD.Material> presetMaterials = NUD.ReadMaterials(matFile, pol, soff); return(presetMaterials); }