예제 #1
0
        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;
        }
예제 #2
0
 private void TextureEntry_OnDoubleClick(object sender, EventArgs e)
 {
     // Add the new selected one
     Debug.Assert(sender == SelectedEntry, "The sent control should be the same as SelectedMaterial, but it is not!");
     SelectedMaterial = SelectedEntry.GetMaterial();
     Close();
 }