diff --git a/radiant/clipboard/ClipboardModule.cpp b/radiant/clipboard/ClipboardModule.cpp index b031acef9d..5313159203 100644 --- a/radiant/clipboard/ClipboardModule.cpp +++ b/radiant/clipboard/ClipboardModule.cpp @@ -10,6 +10,19 @@ namespace ui { +namespace +{ + inline std::string getContentHash(const std::string& content) + { + // Inspect the clipboard when the main window regains focus + // and fire the event if the contents changed + math::Hash hash; + hash.addString(content); + + return hash; + } +} + std::string ClipboardModule::getString() { std::string returnValue; @@ -37,6 +50,8 @@ void ClipboardModule::setString(const std::string& str) wxTheClipboard->SetData(new wxTextDataObject(str)); wxTheClipboard->Close(); + _contentHash = getContentHash(str); + // Contents changed signal _sigContentsChanged.emit(); } @@ -77,10 +92,7 @@ void ClipboardModule::onAppActivated(wxActivateEvent& ev) { // Inspect the clipboard when the main window regains focus // and fire the event if the contents changed - math::Hash hash; - hash.addString(getString()); - - std::string newHash = hash; + auto newHash = getContentHash(getString()); if (newHash != _contentHash) { diff --git a/radiantcore/selection/clipboard/Clipboard.cpp b/radiantcore/selection/clipboard/Clipboard.cpp index 11cbfe0192..dfda4ee7fd 100644 --- a/radiantcore/selection/clipboard/Clipboard.cpp +++ b/radiantcore/selection/clipboard/Clipboard.cpp @@ -88,7 +88,13 @@ void paste(const cmd::ArgumentList& args) { UndoableCommand undo("pasteMaterialFromClipboard"); - GlobalShaderClipboard().setSourceShader(clipboardMaterial); + // Activate the material name in the shader clipboard, but don't overwrite + // anything there if the material is already matching to not overwrite Face/Patch information + if (GlobalShaderClipboard().getShaderName() != clipboardMaterial) + { + GlobalShaderClipboard().setSourceShader(clipboardMaterial); + } + algorithm::pasteShaderToSelection(args); return; }