public void LoadStaticMesh(int index) { stm = new StaticMesh(pcc as ME3Package, index); List <MaterialInstanceConstant> matInsts = stm.Mesh.Mat.MatInst; bool foundTex = false; try { for (int i = 0; i < matInsts.Count; i++) { for (int j = 0; j < matInsts[i].Textures.Count; j++) { if (matInsts[i].Textures[j].Desc.Contains("Diffuse")) { Preview3D.setTex(matInsts[i].Textures[j].Texture); foundTex = true; break; } } } } catch { } if (!foundTex) { Preview3D.setTex(); } Preview3D.StatMesh = stm; //Preview3D.SkelMesh = null; Preview3D.CamOffset = new Vector3(0, 0, 0); treeView1.BeginUpdate(); treeView1.Nodes.Clear(); treeView1.Nodes.Add(stm.ToTree()); treeView1.Nodes[0].Expand(); treeView1.EndUpdate(); }
public void LoadSkeletalMesh(int index) { try { DisableLODs(); UnCheckLODs(); skm = new SkeletalMesh(pcc as ME3Package, index); skmold = new SkeletalMeshOld(pcc as ME3Package, index); hb1.ByteProvider = new DynamicByteProvider(pcc.Exports[index].Data); bool foundTex = false; try { for (int i = 0; i < skm.MatInsts.Count; i++) { for (int j = 0; j < skm.MatInsts[i].Textures.Count; j++) { if (skm.MatInsts[i].Textures[j].Desc.Contains("Diffuse")) { Preview3D.setTex(skm.MatInsts[i].Textures[j].Texture); foundTex = true; break; } } } } catch { } if (!foundTex) { Preview3D.setTex(); } Preview3D.StatMesh = null; Preview3D.SkelMesh = skm; Preview3D.CamDistance = skm.Bounding.r * 2.0f; Preview3D.CamOffset = skm.Bounding.origin; treeView1.BeginUpdate(); treeView1.Nodes.Clear(); treeView1.Nodes.Add(skm.ToTree()); treeView1.Nodes[0].Expand(); treeView1.EndUpdate(); lODToolStripMenuItem.Visible = true; lOD0ToolStripMenuItem.Enabled = true; lOD0ToolStripMenuItem.Checked = true; if (skm.LODModels.Count > 1) { lOD1ToolStripMenuItem.Enabled = true; } if (skm.LODModels.Count > 2) { lOD2ToolStripMenuItem.Enabled = true; } if (skm.LODModels.Count > 3) { lOD3ToolStripMenuItem.Enabled = true; } } catch { return; } }