diff --git a/radiant/camera/CamWnd.cpp b/radiant/camera/CamWnd.cpp index 6e28eb4c08..b4c8a0dd33 100644 --- a/radiant/camera/CamWnd.cpp +++ b/radiant/camera/CamWnd.cpp @@ -123,6 +123,11 @@ CamWnd::CamWnd(wxWindow* parent) : _glExtensionsInitialisedNotifier = GlobalRenderSystem().signal_extensionsInitialised().connect( sigc::mem_fun(this, &CamWnd::onGLExtensionsInitialised)); + + _textureChangedHandler = GlobalRadiantCore().getMessageBus().addListener( + radiant::IMessage::Type::TextureChanged, + radiant::TypeListener( + sigc::mem_fun(this, &CamWnd::handleTextureChanged))); } wxWindow* CamWnd::getMainWidget() const @@ -242,6 +247,8 @@ void CamWnd::constructGUIComponents() CamWnd::~CamWnd() { + GlobalRadiantCore().getMessageBus().removeListener(_textureChangedHandler); + const wxToolBarToolBase* gridButton = getToolBarToolByLabel(_camToolbar, "drawGridButton"); auto toggleCameraGridEvent = GlobalEventManager().findEvent("ToggleCameraGrid"); toggleCameraGridEvent->disconnectToolItem(gridButton); @@ -1389,6 +1396,11 @@ void CamWnd::rotateRightDiscrete() setCameraAngles(angles); } +void CamWnd::handleTextureChanged(radiant::TextureChangedMessage& msg) +{ + queueDraw(); +} + // ------------------------------------------------------------------------------- render::CamRenderer::HighlightShaders CamWnd::_shaders; diff --git a/radiant/camera/CamWnd.h b/radiant/camera/CamWnd.h index 6e568eac22..65f39ee549 100644 --- a/radiant/camera/CamWnd.h +++ b/radiant/camera/CamWnd.h @@ -27,6 +27,7 @@ #include "tools/CameraMouseToolEvent.h" #include "render/RenderStatistics.h" #include "render/CamRenderer.h" +#include "messages/TextureChanged.h" const int CAMWND_MINSIZE_X = 240; const int CAMWND_MINSIZE_Y = 200; @@ -107,6 +108,8 @@ class CamWnd : IGLFont::Ptr _glFont; + std::size_t _textureChangedHandler; + public: // Constructor and destructor CamWnd(wxWindow* parent); @@ -253,6 +256,8 @@ class CamWnd : // Gets called with the accumulated delta values, as buffered by wxutil::DeferredMotionDelta void onDeferredMotionDelta(int x, int y); void performFreeMove(int dx, int dy); + + void handleTextureChanged(radiant::TextureChangedMessage& msg); }; /** diff --git a/radiant/ui/UserInterfaceModule.cpp b/radiant/ui/UserInterfaceModule.cpp index 55eabd64a2..fba2fb8dd9 100644 --- a/radiant/ui/UserInterfaceModule.cpp +++ b/radiant/ui/UserInterfaceModule.cpp @@ -15,6 +15,7 @@ #include "imousetool.h" #include "imainframe.h" #include "ishaders.h" +#include "icameraview.h" #include "wxutil/menu/CommandMenuItem.h" #include "wxutil/MultiMonitor.h" @@ -200,10 +201,6 @@ void UserInterfaceModule::initialiseModule(const IApplicationContext& ctx) radiant::TypeListener( sigc::mem_fun(this, &UserInterfaceModule::handleCommandExecutionFailure))); - _textureChangedListener = GlobalRadiantCore().getMessageBus().addListener( - radiant::IMessage::Type::TextureChanged, - radiant::TypeListener(UserInterfaceModule::HandleTextureChanged)); - _notificationListener = GlobalRadiantCore().getMessageBus().addListener( radiant::IMessage::Type::Notification, radiant::TypeListener(UserInterfaceModule::HandleNotificationMessage)); @@ -239,7 +236,6 @@ void UserInterfaceModule::shutdownModule() wxTheApp->Unbind(DISPATCH_EVENT, &UserInterfaceModule::onDispatchEvent, this); - GlobalRadiantCore().getMessageBus().removeListener(_textureChangedListener); GlobalRadiantCore().getMessageBus().removeListener(_execFailedListener); GlobalRadiantCore().getMessageBus().removeListener(_notificationListener); @@ -438,11 +434,6 @@ void UserInterfaceModule::registerUICommands() GlobalCommandSystem().addCommand("OpenMapFromProject", ui::MapSelector::OpenMapFromProject); } -void UserInterfaceModule::HandleTextureChanged(radiant::TextureChangedMessage& msg) -{ - SurfaceInspector::update(); -} - // Static module registration module::StaticModule userInterfaceModule; diff --git a/radiant/ui/UserInterfaceModule.h b/radiant/ui/UserInterfaceModule.h index 218115fb6c..8935767625 100644 --- a/radiant/ui/UserInterfaceModule.h +++ b/radiant/ui/UserInterfaceModule.h @@ -57,7 +57,6 @@ class UserInterfaceModule : sigc::connection _mapEditModeChangedConn; std::size_t _execFailedListener; - std::size_t _textureChangedListener; std::size_t _notificationListener; std::unique_ptr _mruMenu; @@ -85,7 +84,6 @@ class UserInterfaceModule : void refreshShadersCmd(const cmd::ArgumentList& args); void handleCommandExecutionFailure(radiant::CommandExecutionFailedMessage& msg); - static void HandleTextureChanged(radiant::TextureChangedMessage& msg); static void HandleNotificationMessage(radiant::NotificationMessage& msg); void onDispatchEvent(DispatchEvent& evt);