diff --git a/radiant/shaders/Doom3ShaderSystem.cpp b/radiant/shaders/Doom3ShaderSystem.cpp index 25b3359774..185deb8b1a 100644 --- a/radiant/shaders/Doom3ShaderSystem.cpp +++ b/radiant/shaders/Doom3ShaderSystem.cpp @@ -308,20 +308,6 @@ TableDefinitionPtr Doom3ShaderSystem::getTableForName(const std::string& name) return _library->getTableForName(name); } -void Doom3ShaderSystem::refreshShadersCmd(const cmd::ArgumentList& args) -{ - // Disable screen updates for the scope of this function - IScopedScreenUpdateBlockerPtr blocker = GlobalMainFrame().getScopedScreenUpdateBlocker(_("Processing..."), _("Loading Shaders")); - - // Reload the Shadersystem, this will also trigger an - // OpenGLRenderSystem unrealise/realise sequence as the rendersystem - // is attached to this class as Observer - // We can't do this refresh() operation in a thread it seems due to context binding - refresh(); - - GlobalMainFrame().updateAllWindows(); -} - const std::string& Doom3ShaderSystem::getName() const { static std::string _name(MODULE_SHADERSYSTEM); @@ -337,7 +323,6 @@ const StringSet& Doom3ShaderSystem::getDependencies() const _dependencies.insert(MODULE_VIRTUALFILESYSTEM); _dependencies.insert(MODULE_XMLREGISTRY); _dependencies.insert(MODULE_GAMEMANAGER); - _dependencies.insert(MODULE_PREFERENCESYSTEM); } return _dependencies; @@ -347,10 +332,6 @@ void Doom3ShaderSystem::initialiseModule(const ApplicationContext& ctx) { rMessage() << getName() << "::initialiseModule called" << std::endl; - GlobalCommandSystem().addCommand("RefreshShaders", - std::bind(&Doom3ShaderSystem::refreshShadersCmd, this, std::placeholders::_1)); - GlobalEventManager().addCommand("RefreshShaders", "RefreshShaders"); - construct(); realise(); diff --git a/radiant/shaders/Doom3ShaderSystem.h b/radiant/shaders/Doom3ShaderSystem.h index b2e7f8c474..c1859d6960 100644 --- a/radiant/shaders/Doom3ShaderSystem.h +++ b/radiant/shaders/Doom3ShaderSystem.h @@ -128,9 +128,6 @@ class Doom3ShaderSystem : // For methods accessing the ShaderLibrary the parser thread must be done void ensureDefsLoaded(); - // The "Flush & Reload Shaders" command target - void refreshShadersCmd(const cmd::ArgumentList& args); - // Unloads all the existing shaders and calls activeShadersChangedNotify() void freeShaders(); diff --git a/radiant/ui/UserInterfaceModule.cpp b/radiant/ui/UserInterfaceModule.cpp index c1add773d7..593df9cccb 100644 --- a/radiant/ui/UserInterfaceModule.cpp +++ b/radiant/ui/UserInterfaceModule.cpp @@ -5,6 +5,8 @@ #include "ifilter.h" #include "iorthocontextmenu.h" #include "ieventmanager.h" +#include "imainframe.h" +#include "ishaders.h" #include "wxutil/menu/CommandMenuItem.h" #include "wxutil/MultiMonitor.h" @@ -129,6 +131,20 @@ void UserInterfaceModule::shutdownModule() { } +void UserInterfaceModule::refreshShadersCmd(const cmd::ArgumentList& args) +{ + // Disable screen updates for the scope of this function + auto blocker = GlobalMainFrame().getScopedScreenUpdateBlocker(_("Processing..."), _("Loading Shaders")); + + // Reload the Shadersystem, this will also trigger an + // OpenGLRenderSystem unrealise/realise sequence as the rendersystem + // is attached to this class as Observer + // We can't do this refresh() operation in a thread it seems due to context binding + GlobalMaterialManager().refresh(); + + GlobalMainFrame().updateAllWindows(); +} + void UserInterfaceModule::registerUICommands() { TexTool::registerCommands(); @@ -157,6 +173,9 @@ void UserInterfaceModule::registerUICommands() GlobalCommandSystem().addCommand("EntityClassTree", EClassTree::ShowDialog); GlobalCommandSystem().addCommand("EntityList", EntityList::toggle); + GlobalCommandSystem().addCommand("RefreshShaders", + std::bind(&UserInterfaceModule::refreshShadersCmd, this, std::placeholders::_1)); + // ----------------------- Bind Events --------------------------------------- GlobalEventManager().addCommand("ProjectSettings", "ProjectSettings"); @@ -183,6 +202,7 @@ void UserInterfaceModule::registerUICommands() GlobalEventManager().addCommand("ExportSelectedAsModelDialog", "ExportSelectedAsModelDialog"); GlobalEventManager().addCommand("EntityClassTree", "EntityClassTree"); GlobalEventManager().addCommand("EntityList", "EntityList"); + GlobalEventManager().addCommand("RefreshShaders", "RefreshShaders"); } // Static module registration diff --git a/radiant/ui/UserInterfaceModule.h b/radiant/ui/UserInterfaceModule.h index 04db7a897c..1c15b95682 100644 --- a/radiant/ui/UserInterfaceModule.h +++ b/radiant/ui/UserInterfaceModule.h @@ -2,6 +2,7 @@ #include "imodule.h" #include "iorthocontextmenu.h" +#include "icommandsystem.h" namespace ui { @@ -25,6 +26,7 @@ class UserInterfaceModule : private: void registerUICommands(); + void refreshShadersCmd(const cmd::ArgumentList& args); }; }