private void MatViewPanel_TextureEntryOnDoubleClick(object sender, EventArgs e) { // Get our entry TextureEntry Entry = (sender as TextureEntry); // Create our browser; once the user has finished with this menu they should? have a material. string MaterialName = ""; IMaterial OurMaterial = Entry.GetMaterial(); if (OurMaterial != null) { MaterialName = OurMaterial.GetMaterialName(); } MaterialBrowser Browser = new MaterialBrowser(MaterialName); IMaterial SelectedMaterial = Browser.GetSelectedMaterial(); // Set the new material data, notify the map editor that a change has been made. if (SelectedMaterial != null) { currentMaterials[Entry].MaterialName = SelectedMaterial.GetMaterialName(); currentMaterials[Entry].MaterialHash = SelectedMaterial.GetMaterialHash(); Entry.SetMaterial(SelectedMaterial); OnObjectUpdated(sender, e); } // Yeet the browser into the shadow realm. Browser.Dispose(); Browser = null; Entry.IsSelected = false; }
public void SetMaterial(IMaterial material) { if (material != null) { MaterialName.Text = material.GetMaterialName(); TextureImage.Image = TextureLoader.LoadThumbnail(material); this.material = material; } }
public void ReadFromFile(MemoryStream reader, bool isBigEndian) { numFaces = reader.ReadInt32(isBigEndian); startIndex = reader.ReadInt32(isBigEndian); materialHash = reader.ReadUInt64(isBigEndian); unk3 = reader.ReadInt32(isBigEndian); IMaterial mat = MaterialsManager.LookupMaterialByHash(materialHash); if (mat != null) { materialName = mat.GetMaterialName(); } else { materialName = "UNABLE TO GET FROM MTLs"; } }