private void UpdateMaterialDisplay() { // If no model or material is selected, make the fields blank GcmfMaterial material = GetSelectedMaterial(); if (material == null) { pbMaterialTextureImage.Image = null; tlpMaterialProperties.Visible = false; return; } tlpMaterialProperties.Visible = true; lblMaterialFlags.Text = string.Format("0x{0:X8}", material.Flags); lblMaterialTextureIndex.Text = string.Format("{0}", material.TextureIdx); lblMaterialUnk6.Text = string.Format("0x{0:X2}", material.Unk6); lblMaterialAnisotropyLevel.Text = string.Format("0x{0:X2}", material.AnisotropyLevel); lblMaterialUnkC.Text = string.Format("0x{0:X4}", material.UnkC); lblMaterialUnk10.Text = string.Format("0x{0:X8}", material.Unk10); if (tpl != null && material.TextureIdx < tpl.Count && !tpl[material.TextureIdx].IsEmpty) { TplTexture tex = tpl[material.TextureIdx]; pbMaterialTextureImage.Image = tex.DecodeLevelToBitmap(0); } else { pbMaterialTextureImage.Image = null; } }
private void treeMaterials_AfterSelect(object sender, TreeViewEventArgs e) { // If no model or material is selected, make the fields blank GcmfMaterial material = mainWindow.paneMaterials.GetSelectedMaterial(); if (material == null) { materialTable.Visible = false; return; } materialTable.Visible = true; lblMaterialFlags.Text = string.Format("0x{0:X8}", material.Flags); lblMaterialTextureIndex.Text = string.Format("{0}", material.TextureIdx); lblMaterialUnk6.Text = string.Format("0x{0:X2}", material.Unk6); lblMaterialAnisotropyLevel.Text = string.Format("0x{0:X2}", material.AnisotropyLevel); lblMaterialUnkC.Text = string.Format("0x{0:X4}", material.UnkC); lblMaterialUnk10.Text = string.Format("0x{0:X8}", material.Unk10); if (material.TextureIdx < treeTextures.Nodes.Count) { treeTextures.SelectedNode = treeTextures.Nodes[material.TextureIdx]; } }