diff --git a/install/user.xml b/install/user.xml index d23bfd5e5a..ffb5205461 100644 --- a/install/user.xml +++ b/install/user.xml @@ -307,6 +307,9 @@ + + + diff --git a/radiant/textool/TexTool.cpp b/radiant/textool/TexTool.cpp index cb13612781..57c2ecd93c 100644 --- a/radiant/textool/TexTool.cpp +++ b/radiant/textool/TexTool.cpp @@ -135,6 +135,7 @@ void TexTool::_preHide() _selectionChanged.disconnect(); _manipulatorChanged.disconnect(); + _selectionModeChanged.disconnect(); // Clear items to prevent us from running into stale references // when the textool is shown again @@ -150,6 +151,7 @@ void TexTool::_preShow() _undoHandler.disconnect(); _redoHandler.disconnect(); _manipulatorChanged.disconnect(); + _selectionModeChanged.disconnect(); // Register self to the SelSystem to get notified upon selection changes. _selectionChanged = GlobalSelectionSystem().signal_selectionChanged().connect( @@ -163,6 +165,9 @@ void TexTool::_preShow() _manipulatorChanged = GlobalTextureToolSelectionSystem().signal_activeManipulatorChanged().connect( sigc::mem_fun(this, &TexTool::onManipulatorModeChanged) ); + _selectionModeChanged = GlobalTextureToolSelectionSystem().signal_selectionModeChanged().connect( + sigc::mem_fun(this, &TexTool::onSelectionModeChanged) + ); // Trigger an update of the current selection _selectionRescanNeeded = true; @@ -179,6 +184,11 @@ void TexTool::onManipulatorModeChanged(selection::IManipulator::Type type) queueDraw(); } +void TexTool::onSelectionModeChanged(textool::SelectionMode mode) +{ + queueDraw(); +} + void TexTool::gridUp() { if (_grid*2 <= GRID_MAX && _gridActive) { _grid *= 2; diff --git a/radiant/textool/TexTool.h b/radiant/textool/TexTool.h index b329911af0..65ffb36696 100644 --- a/radiant/textool/TexTool.h +++ b/radiant/textool/TexTool.h @@ -1,6 +1,7 @@ #pragma once #include "icommandsystem.h" +#include "itexturetoolmodel.h" #include "wxutil/window/TransientWindow.h" #include "math/Vector3.h" @@ -90,6 +91,7 @@ class TexTool : sigc::connection _undoHandler; sigc::connection _redoHandler; sigc::connection _manipulatorChanged; + sigc::connection _selectionModeChanged; private: // This is where the static shared_ptr of the singleton instance is held. @@ -289,6 +291,7 @@ class TexTool : void updateProjection(); double getTextureAspectRatio(); void onManipulatorModeChanged(selection::IManipulator::Type type); + void onSelectionModeChanged(textool::SelectionMode mode); TextureToolMouseEvent createMouseEvent(const Vector2& point, const Vector2& delta = Vector2(0, 0)); diff --git a/radiant/textool/TexToolManipulatorToggle.h b/radiant/textool/TexToolManipulatorToggle.h deleted file mode 100644 index b514500ae7..0000000000 --- a/radiant/textool/TexToolManipulatorToggle.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "itexturetoolmodel.h" -#include "ieventmanager.h" - -#include - -namespace ui -{ - -// Adaptor class connecting the EventSystem toggles covering the various -// manipulator mode to the actual state of the backend TextureToolSelectionSystem -class TextureToolManipulatorToggle -{ -private: - sigc::connection _activeManipulatorChanged; - -public: - TextureToolManipulatorToggle() - { - _activeManipulatorChanged = GlobalTextureToolSelectionSystem().signal_activeManipulatorChanged() - .connect(sigc::mem_fun(this, &TextureToolManipulatorToggle::onActiveManipulatorChanged)); - - GlobalEventManager().addToggle("TextureToolRotateMode", [this](bool) - { - GlobalCommandSystem().executeCommand("ToggleTextureToolManipulatorMode", { "Rotate" }); - }); - - GlobalEventManager().addToggle("TextureToolDragMode", [this](bool) - { - GlobalCommandSystem().executeCommand("ToggleTextureToolManipulatorMode", { "Drag" }); - }); - - onActiveManipulatorChanged(GlobalTextureToolSelectionSystem().getActiveManipulatorType()); - } - - ~TextureToolManipulatorToggle() - { - _activeManipulatorChanged.disconnect(); - } - -private: - void onActiveManipulatorChanged(selection::IManipulator::Type type) - { - GlobalEventManager().setToggled("TextureToolRotateMode", type == selection::IManipulator::Rotate); - GlobalEventManager().setToggled("TextureToolDragMode", type == selection::IManipulator::Drag); - } -}; - -} diff --git a/radiant/textool/TexToolModeToggles.h b/radiant/textool/TexToolModeToggles.h new file mode 100644 index 0000000000..3d70cc1b78 --- /dev/null +++ b/radiant/textool/TexToolModeToggles.h @@ -0,0 +1,74 @@ +#pragma once + +#include "itexturetoolmodel.h" +#include "ieventmanager.h" + +#include + +namespace ui +{ + +// Adaptor class connecting the EventSystem toggles connecting the various +// modes to the actual state of the backend TextureToolSelectionSystem +class TexToolModeToggles +{ +private: + sigc::connection _activeSelectionModeChanged; + sigc::connection _activeManipulatorChanged; + +public: + TexToolModeToggles() + { + _activeManipulatorChanged = GlobalTextureToolSelectionSystem().signal_activeManipulatorChanged() + .connect(sigc::mem_fun(this, &TexToolModeToggles::onActiveManipulatorChanged)); + + _activeSelectionModeChanged = GlobalTextureToolSelectionSystem().signal_selectionModeChanged() + .connect(sigc::mem_fun(this, &TexToolModeToggles::onSelectionModeChanged)); + + // Manipulator mode toggles + GlobalEventManager().addToggle("TextureToolRotateMode", [this](bool) + { + GlobalCommandSystem().executeCommand("ToggleTextureToolManipulatorMode", { "Rotate" }); + }); + + GlobalEventManager().addToggle("TextureToolDragMode", [this](bool) + { + GlobalCommandSystem().executeCommand("ToggleTextureToolManipulatorMode", { "Drag" }); + }); + + // Selection mode toggles + GlobalEventManager().addToggle("TextureToolSurfaceSelectionMode", [this](bool) + { + GlobalCommandSystem().executeCommand("ToggleTextureToolSelectionMode", { "Surface" }); + }); + + GlobalEventManager().addToggle("TextureToolVertexSelectionMode", [this](bool) + { + GlobalCommandSystem().executeCommand("ToggleTextureToolSelectionMode", { "Vertex" }); + }); + + onSelectionModeChanged(GlobalTextureToolSelectionSystem().getMode()); + onActiveManipulatorChanged(GlobalTextureToolSelectionSystem().getActiveManipulatorType()); + } + + ~TexToolModeToggles() + { + _activeManipulatorChanged.disconnect(); + _activeSelectionModeChanged.disconnect(); + } + +private: + void onActiveManipulatorChanged(selection::IManipulator::Type type) + { + GlobalEventManager().setToggled("TextureToolRotateMode", type == selection::IManipulator::Rotate); + GlobalEventManager().setToggled("TextureToolDragMode", type == selection::IManipulator::Drag); + } + + void onSelectionModeChanged(textool::SelectionMode mode) + { + GlobalEventManager().setToggled("TextureToolSurfaceSelectionMode", mode == textool::SelectionMode::Surface); + GlobalEventManager().setToggled("TextureToolVertexSelectionMode", mode == textool::SelectionMode::Vertex); + } +}; + +} diff --git a/radiant/ui/UserInterfaceModule.cpp b/radiant/ui/UserInterfaceModule.cpp index 28260aeaca..55eabd64a2 100644 --- a/radiant/ui/UserInterfaceModule.cpp +++ b/radiant/ui/UserInterfaceModule.cpp @@ -218,7 +218,7 @@ void UserInterfaceModule::initialiseModule(const IApplicationContext& ctx) _editStopwatchStatus.reset(new statusbar::EditingStopwatchStatus); _mapStatisticsStatus.reset(new statusbar::MapStatistics); _manipulatorToggle.reset(new ManipulatorToggle); - _textureToolManipulatorModeToggle.reset(new TextureToolManipulatorToggle); + _textureToolModeToggles.reset(new TexToolModeToggles); _selectionModeToggle.reset(new SelectionModeToggle); MouseToolRegistrationHelper::RegisterTools(); @@ -257,6 +257,7 @@ void UserInterfaceModule::shutdownModule() _editStopwatchStatus.reset(); _manipulatorToggle.reset(); _selectionModeToggle.reset(); + _textureToolModeToggles.reset(); _mruMenu.reset(); } diff --git a/radiant/ui/UserInterfaceModule.h b/radiant/ui/UserInterfaceModule.h index fa48f3aac9..218115fb6c 100644 --- a/radiant/ui/UserInterfaceModule.h +++ b/radiant/ui/UserInterfaceModule.h @@ -23,7 +23,7 @@ #include "ui/mru/MRUMenu.h" #include "DispatchEvent.h" #include "map/AutoSaveTimer.h" -#include "textool/TexToolManipulatorToggle.h" +#include "textool/TexToolModeToggles.h" namespace ui { @@ -50,7 +50,7 @@ class UserInterfaceModule : std::unique_ptr _mapStatisticsStatus; std::unique_ptr _manipulatorToggle; std::unique_ptr _selectionModeToggle; - std::unique_ptr _textureToolManipulatorModeToggle; + std::unique_ptr _textureToolModeToggles; sigc::connection _entitySettingsConn; sigc::connection _coloursUpdatedConn; diff --git a/radiantcore/selection/textool/FaceNode.h b/radiantcore/selection/textool/FaceNode.h index f69c4d7e55..f64548563a 100644 --- a/radiantcore/selection/textool/FaceNode.h +++ b/radiantcore/selection/textool/FaceNode.h @@ -105,6 +105,10 @@ class FaceNode : { glColor3f(1, 0.5f, 0); } + else if (mode == SelectionMode::Vertex) + { + glColor3f(0.6f, 0.6f, 0.6f); + } else { glColor3f(0.8f, 0.8f, 0.8f); diff --git a/tools/msvc/DarkRadiant.vcxproj b/tools/msvc/DarkRadiant.vcxproj index 1e7dfdb975..f2abbb3588 100644 --- a/tools/msvc/DarkRadiant.vcxproj +++ b/tools/msvc/DarkRadiant.vcxproj @@ -420,7 +420,7 @@ - + diff --git a/tools/msvc/DarkRadiant.vcxproj.filters b/tools/msvc/DarkRadiant.vcxproj.filters index 4692cdd8b1..894732f20a 100644 --- a/tools/msvc/DarkRadiant.vcxproj.filters +++ b/tools/msvc/DarkRadiant.vcxproj.filters @@ -1431,7 +1431,7 @@ src\selection - + src\textool