From a154a7fb876feeae91248201edde01eabb76f955 Mon Sep 17 00:00:00 2001 From: Matthew Mott Date: Wed, 3 Jul 2024 19:19:03 +0100 Subject: [PATCH] #6514: replacement material is now applied to skin after browsing If the browse button was clicked and the result was OK, call the onReplacementEntryChanged method to apply the change to the data model. This does not yet apply if the replacement material entry box is edited manually. --- radiant/ui/skin/SkinEditor.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/radiant/ui/skin/SkinEditor.cpp b/radiant/ui/skin/SkinEditor.cpp index 1e64e6e5a..5b7a9883d 100644 --- a/radiant/ui/skin/SkinEditor.cpp +++ b/radiant/ui/skin/SkinEditor.cpp @@ -235,18 +235,20 @@ void SkinEditor::setupRemappingPanel() void SkinEditor::chooseRemappedSourceMaterial() { - MaterialChooser chooser( - this, MaterialSelector::TextureFilter::All, _sourceMaterialEdit - ); - chooser.ShowModal(); + MaterialChooser chooser(this, MaterialSelector::TextureFilter::All); + if (chooser.ShowModal() == wxID_OK) { + _sourceMaterialEdit->SetValue(chooser.GetSelectedDeclName()); + } } void SkinEditor::chooseRemappedDestMaterial() { - MaterialChooser chooser( - this, MaterialSelector::TextureFilter::All, _replacementMaterialEdit - ); - chooser.ShowModal(); + MaterialChooser chooser(this, MaterialSelector::TextureFilter::All); + if (chooser.ShowModal() == wxID_OK) { + const std::string materialName = chooser.GetSelectedDeclName(); + _replacementMaterialEdit->SetValue(materialName); + onReplacementEntryChanged(materialName); + } } decl::ISkin::Ptr SkinEditor::getSelectedSkin()