//加载静态模型并将当前材质赋给模型 public void LoadStaticMesh(string pkg, string file) { try { using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this)) { NResourceLoc resLoc = new NResourceLoc(pkg, file); m_resStaticMesh = NResourceManager.Instance.LoadStaticMesh( resLoc, EResourceIOMode.Block, EResourceIOPriority.Normal ); for (int i = 0; i < m_resStaticMesh.GetNumLOD(); ++i) { for (int j = 0; j < m_resStaticMesh.GetNumSection(i); ++j) { m_resStaticMesh.ImportSetMaterial(i, j, m_Material); } } m_preview.ShowStaticMesh(m_resStaticMesh); m_Sphere = null; } } catch (System.Exception ex) { NexusEditor.Program.ShowException(ex, "Load Static Mesh FAILED"); } }
private void comboBoxLOD_SelectedIndexChanged(object sender, EventArgs e) { int lod = this.comboBoxLOD.SelectedIndex; this.comboBoxSection.Items.Clear(); int numSec = m_resStaticMesh.GetNumSection(lod); for (int i = 0; i < numSec; i++) { this.comboBoxSection.Items.Add(i.ToString()); } this.comboBoxSection.SelectedIndex = 0; }