diff --git a/include/imanipulator.h b/include/imanipulator.h index 62cc7394e0..611499f263 100644 --- a/include/imanipulator.h +++ b/include/imanipulator.h @@ -22,9 +22,11 @@ struct WorkZone; * example, the rotation Manipulator draws several circles which cause rotations * around specific axes. */ -class Manipulator +class IManipulator { public: + using Ptr = std::shared_ptr; + // Manipulator type enum, user-defined manipulators should return "Custom" enum Type { @@ -75,7 +77,7 @@ class Manipulator virtual void transform(const Matrix4& pivot2world, const VolumeTest& view, const Vector2& devicePoint, unsigned int flags) = 0; }; - virtual ~Manipulator() {} + virtual ~IManipulator() {} // ID and Type management virtual std::size_t getId() const = 0; @@ -100,6 +102,5 @@ class Manipulator // Manipulators should indicate whether component editing is supported or not virtual bool supportsComponentManipulation() const = 0; }; -typedef std::shared_ptr ManipulatorPtr; } diff --git a/include/iselection.h b/include/iselection.h index 109e2f8acc..e23a6bb032 100644 --- a/include/iselection.h +++ b/include/iselection.h @@ -85,17 +85,17 @@ class SelectionSystem : virtual void removeObserver(Observer* observer) = 0; // Returns the ID of the registered manipulator - virtual std::size_t registerManipulator(const selection::ManipulatorPtr& manipulator) = 0; - virtual void unregisterManipulator(const selection::ManipulatorPtr& manipulator) = 0; + virtual std::size_t registerManipulator(const selection::IManipulator::Ptr& manipulator) = 0; + virtual void unregisterManipulator(const selection::IManipulator::Ptr& manipulator) = 0; - virtual selection::Manipulator::Type getActiveManipulatorType() = 0; + virtual selection::IManipulator::Type getActiveManipulatorType() = 0; // Returns the currently active Manipulator, which is always non-null - virtual const selection::ManipulatorPtr& getActiveManipulator() = 0; + virtual const selection::IManipulator::Ptr& getActiveManipulator() = 0; virtual void setActiveManipulator(std::size_t manipulatorId) = 0; - virtual void setActiveManipulator(selection::Manipulator::Type manipulatorType) = 0; + virtual void setActiveManipulator(selection::IManipulator::Type manipulatorType) = 0; - virtual sigc::signal& signal_activeManipulatorChanged() = 0; + virtual sigc::signal& signal_activeManipulatorChanged() = 0; virtual const SelectionInfo& getSelectionInfo() = 0; diff --git a/radiant/selection/ManipulateMouseTool.cpp b/radiant/selection/ManipulateMouseTool.cpp index 424cb4f6a4..dc40eaff10 100644 --- a/radiant/selection/ManipulateMouseTool.cpp +++ b/radiant/selection/ManipulateMouseTool.cpp @@ -94,11 +94,11 @@ unsigned int ManipulateMouseTool::getRefreshMode() bool ManipulateMouseTool::selectManipulator(const render::View& view, const Vector2& devicePoint, const Vector2& deviceEpsilon) { - const selection::ManipulatorPtr& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); + const auto& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); assert(activeManipulator); - bool dragComponentMode = activeManipulator->getType() == selection::Manipulator::Drag && + bool dragComponentMode = activeManipulator->getType() == selection::IManipulator::Drag && GlobalSelectionSystem().Mode() == SelectionSystem::eComponent; if (!nothingSelected() || dragComponentMode) @@ -144,7 +144,7 @@ bool ManipulateMouseTool::selectManipulator(const render::View& view, const Vect void ManipulateMouseTool::handleMouseMove(const render::View& view, const Vector2& devicePoint) { - const selection::ManipulatorPtr& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); + const auto& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); assert(activeManipulator); // Check if the active manipulator is selected in the first place @@ -179,12 +179,12 @@ void ManipulateMouseTool::handleMouseMove(const render::View& view, const Vector #endif // Query keyboard modifier state and pass them as flags - int constraintFlag = selection::Manipulator::Component::Constraint::Unconstrained; - constraintFlag |= wxGetKeyState(WXK_SHIFT) ? selection::Manipulator::Component::Constraint::Type1 : 0; - constraintFlag |= wxGetKeyState(WXK_ALT) ? selection::Manipulator::Component::Constraint::Type3 : 0; + int constraintFlag = selection::IManipulator::Component::Constraint::Unconstrained; + constraintFlag |= wxGetKeyState(WXK_SHIFT) ? selection::IManipulator::Component::Constraint::Type1 : 0; + constraintFlag |= wxGetKeyState(WXK_ALT) ? selection::IManipulator::Component::Constraint::Type3 : 0; // Grid constraint is ON by default, unless CTRL is held - constraintFlag |= wxGetKeyState(WXK_CONTROL) ? 0 : selection::Manipulator::Component::Constraint::Grid; + constraintFlag |= wxGetKeyState(WXK_CONTROL) ? 0 : selection::IManipulator::Component::Constraint::Grid; // Get the component of the currently active manipulator (done by selection test) // and call the transform method @@ -202,7 +202,7 @@ void ManipulateMouseTool::endMove() { freezeTransforms(); - const selection::ManipulatorPtr& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); + const auto& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); assert(activeManipulator); _manipulationActive = false; @@ -215,26 +215,26 @@ void ManipulateMouseTool::endMove() { std::ostringstream command; - if (activeManipulator->getType() == selection::Manipulator::Translate) + if (activeManipulator->getType() == selection::IManipulator::Translate) { command << "translateTool"; //outputTranslation(command); } - else if (activeManipulator->getType() == selection::Manipulator::Rotate) + else if (activeManipulator->getType() == selection::IManipulator::Rotate) { command << "rotateTool"; //outputRotation(command); } - else if (activeManipulator->getType() == selection::Manipulator::Scale) + else if (activeManipulator->getType() == selection::IManipulator::Scale) { command << "scaleTool"; //outputScale(command); } - else if (activeManipulator->getType() == selection::Manipulator::Drag) + else if (activeManipulator->getType() == selection::IManipulator::Drag) { command << "dragTool"; } - else if (activeManipulator->getType() == selection::Manipulator::ModelScale) + else if (activeManipulator->getType() == selection::IManipulator::ModelScale) { command << "modelScaleTool"; } @@ -248,7 +248,7 @@ void ManipulateMouseTool::endMove() void ManipulateMouseTool::cancelMove() { - const selection::ManipulatorPtr& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); + const auto& activeManipulator = GlobalSelectionSystem().getActiveManipulator(); assert(activeManipulator); _manipulationActive = false; diff --git a/radiant/textool/TexTool.cpp b/radiant/textool/TexTool.cpp index fd6c122653..84046ee163 100644 --- a/radiant/textool/TexTool.cpp +++ b/radiant/textool/TexTool.cpp @@ -80,7 +80,7 @@ TexTool::TexTool() : #if 0 registerManipulator(std::make_shared(_pivot, 8, 64.0f)); #endif - _defaultManipulatorType = selection::Manipulator::Rotate; + _defaultManipulatorType = selection::IManipulator::Rotate; setActiveManipulator(_defaultManipulatorType); } @@ -1217,7 +1217,7 @@ TextureToolMouseEvent TexTool::createMouseEvent(const Vector2& point, const Vect return TextureToolMouseEvent(*this, normalisedDeviceCoords, delta); } -std::size_t TexTool::registerManipulator(const selection::ManipulatorPtr& manipulator) +std::size_t TexTool::registerManipulator(const selection::IManipulator::Ptr& manipulator) { std::size_t newId = 1; @@ -1243,7 +1243,7 @@ std::size_t TexTool::registerManipulator(const selection::ManipulatorPtr& manipu return newId; } -void TexTool::unregisterManipulator(const selection::ManipulatorPtr& manipulator) +void TexTool::unregisterManipulator(const selection::IManipulator::Ptr& manipulator) { for (Manipulators::const_iterator i = _manipulators.begin(); i != _manipulators.end(); ++i) { @@ -1256,12 +1256,12 @@ void TexTool::unregisterManipulator(const selection::ManipulatorPtr& manipulator } } -selection::Manipulator::Type TexTool::getActiveManipulatorType() +selection::IManipulator::Type TexTool::getActiveManipulatorType() { return _activeManipulator->getType(); } -const selection::ManipulatorPtr& TexTool::getActiveManipulator() +const selection::IManipulator::Ptr& TexTool::getActiveManipulator() { return _activeManipulator; } @@ -1285,7 +1285,7 @@ void TexTool::setActiveManipulator(std::size_t manipulatorId) #endif } -void TexTool::setActiveManipulator(selection::Manipulator::Type manipulatorType) +void TexTool::setActiveManipulator(selection::IManipulator::Type manipulatorType) { for (const Manipulators::value_type& pair : _manipulators) { @@ -1305,7 +1305,7 @@ void TexTool::setActiveManipulator(selection::Manipulator::Type manipulatorType) rError() << "Cannot activate non-existent manipulator by type " << manipulatorType << std::endl; } -sigc::signal& TexTool::signal_activeManipulatorChanged() +sigc::signal& TexTool::signal_activeManipulatorChanged() { return _sigActiveManipulatorChanged; } diff --git a/radiant/textool/TexTool.h b/radiant/textool/TexTool.h index 5132ede90c..ffb8066d94 100644 --- a/radiant/textool/TexTool.h +++ b/radiant/textool/TexTool.h @@ -90,14 +90,14 @@ class TexTool : sigc::connection _undoHandler; sigc::connection _redoHandler; - typedef std::map Manipulators; + typedef std::map Manipulators; Manipulators _manipulators; // The currently active manipulator - selection::ManipulatorPtr _activeManipulator; - selection::Manipulator::Type _defaultManipulatorType; + selection::IManipulator::Ptr _activeManipulator; + selection::IManipulator::Type _defaultManipulatorType; - sigc::signal _sigActiveManipulatorChanged; + sigc::signal _sigActiveManipulatorChanged; private: // This is where the static shared_ptr of the singleton instance is held. @@ -281,14 +281,14 @@ class TexTool : static void registerCommands(); // Returns the ID of the registered manipulator - std::size_t registerManipulator(const selection::ManipulatorPtr& manipulator); - void unregisterManipulator(const selection::ManipulatorPtr& manipulator); + std::size_t registerManipulator(const selection::IManipulator::Ptr& manipulator); + void unregisterManipulator(const selection::IManipulator::Ptr& manipulator); - selection::Manipulator::Type getActiveManipulatorType(); - const selection::ManipulatorPtr& getActiveManipulator(); + selection::IManipulator::Type getActiveManipulatorType(); + const selection::IManipulator::Ptr& getActiveManipulator(); void setActiveManipulator(std::size_t manipulatorId); - void setActiveManipulator(selection::Manipulator::Type manipulatorType); - sigc::signal& signal_activeManipulatorChanged(); + void setActiveManipulator(selection::IManipulator::Type manipulatorType); + sigc::signal& signal_activeManipulatorChanged(); /** greebo: Returns the number of selected TexToolItems. */ diff --git a/radiant/textool/tools/TextureToolManipulateMouseTool.cpp b/radiant/textool/tools/TextureToolManipulateMouseTool.cpp index 14f8c6f5cd..b1233a0742 100644 --- a/radiant/textool/tools/TextureToolManipulateMouseTool.cpp +++ b/radiant/textool/tools/TextureToolManipulateMouseTool.cpp @@ -146,7 +146,7 @@ bool TextureToolManipulateMouseTool::selectManipulator(const render::View& view, void TextureToolManipulateMouseTool::handleMouseMove(const render::View& view, const Vector2& devicePoint) { - const selection::ManipulatorPtr& activeManipulator = TexTool::Instance().getActiveManipulator(); + const auto& activeManipulator = TexTool::Instance().getActiveManipulator(); assert(activeManipulator); // Check if the active manipulator is selected in the first place @@ -181,12 +181,12 @@ void TextureToolManipulateMouseTool::handleMouseMove(const render::View& view, c #endif // Query keyboard modifier state and pass them as flags - int constraintFlag = selection::Manipulator::Component::Constraint::Unconstrained; - constraintFlag |= wxGetKeyState(WXK_SHIFT) ? selection::Manipulator::Component::Constraint::Type1 : 0; - constraintFlag |= wxGetKeyState(WXK_ALT) ? selection::Manipulator::Component::Constraint::Type3 : 0; + int constraintFlag = selection::IManipulator::Component::Constraint::Unconstrained; + constraintFlag |= wxGetKeyState(WXK_SHIFT) ? selection::IManipulator::Component::Constraint::Type1 : 0; + constraintFlag |= wxGetKeyState(WXK_ALT) ? selection::IManipulator::Component::Constraint::Type3 : 0; // Grid constraint is ON by default, unless CTRL is held - constraintFlag |= wxGetKeyState(WXK_CONTROL) ? 0 : selection::Manipulator::Component::Constraint::Grid; + constraintFlag |= wxGetKeyState(WXK_CONTROL) ? 0 : selection::IManipulator::Component::Constraint::Grid; // Get the component of the currently active manipulator (done by selection test) // and call the transform method @@ -204,7 +204,7 @@ void TextureToolManipulateMouseTool::endMove() { freezeTransforms(); - const selection::ManipulatorPtr& activeManipulator = TexTool::Instance().getActiveManipulator(); + const auto& activeManipulator = TexTool::Instance().getActiveManipulator(); assert(activeManipulator); _manipulationActive = false; @@ -224,7 +224,7 @@ void TextureToolManipulateMouseTool::endMove() void TextureToolManipulateMouseTool::cancelMove() { - const selection::ManipulatorPtr& activeManipulator = TexTool::Instance().getActiveManipulator(); + const auto& activeManipulator = TexTool::Instance().getActiveManipulator(); assert(activeManipulator); _manipulationActive = false; diff --git a/radiant/ui/ManipulatorToggle.h b/radiant/ui/ManipulatorToggle.h index c8d4fafb49..0b8f731554 100644 --- a/radiant/ui/ManipulatorToggle.h +++ b/radiant/ui/ManipulatorToggle.h @@ -57,13 +57,13 @@ class ManipulatorToggle } private: - void onActiveManipulatorChanged(selection::Manipulator::Type type) + void onActiveManipulatorChanged(selection::IManipulator::Type type) { GlobalEventManager().setToggled("ToggleClipper", GlobalClipper().clipMode()); - GlobalEventManager().setToggled("MouseTranslate", type == selection::Manipulator::Translate); - GlobalEventManager().setToggled("MouseRotate", type == selection::Manipulator::Rotate); - GlobalEventManager().setToggled("MouseDrag", type == selection::Manipulator::Drag); - GlobalEventManager().setToggled("ToggleModelScaleManipulator", type == selection::Manipulator::ModelScale); + GlobalEventManager().setToggled("MouseTranslate", type == selection::IManipulator::Translate); + GlobalEventManager().setToggled("MouseRotate", type == selection::IManipulator::Rotate); + GlobalEventManager().setToggled("MouseDrag", type == selection::IManipulator::Drag); + GlobalEventManager().setToggled("ToggleModelScaleManipulator", type == selection::IManipulator::ModelScale); } }; diff --git a/radiantcore/clipper/Clipper.cpp b/radiantcore/clipper/Clipper.cpp index 74f6695bad..a9414c7e24 100644 --- a/radiantcore/clipper/Clipper.cpp +++ b/radiantcore/clipper/Clipper.cpp @@ -200,7 +200,7 @@ void Clipper::splitClip() { } bool Clipper::clipMode() const { - return GlobalSelectionSystem().getActiveManipulatorType() == selection::Manipulator::Clip; + return GlobalSelectionSystem().getActiveManipulatorType() == selection::IManipulator::Clip; } void Clipper::onClipMode(bool enabled) { diff --git a/radiantcore/selection/RadiantSelectionSystem.cpp b/radiantcore/selection/RadiantSelectionSystem.cpp index 3178910069..dc542276b1 100644 --- a/radiantcore/selection/RadiantSelectionSystem.cpp +++ b/radiantcore/selection/RadiantSelectionSystem.cpp @@ -41,7 +41,7 @@ namespace RadiantSelectionSystem::RadiantSelectionSystem() : _requestWorkZoneRecalculation(true), - _defaultManipulatorType(Manipulator::Drag), + _defaultManipulatorType(IManipulator::Drag), _mode(ePrimitive), _componentMode(eDefault), _countPrimitive(0), @@ -235,7 +235,7 @@ sigc::signal& RadiantSelectionSystem::sig return _sigComponentModeChanged; } -std::size_t RadiantSelectionSystem::registerManipulator(const ManipulatorPtr& manipulator) +std::size_t RadiantSelectionSystem::registerManipulator(const IManipulator::Ptr& manipulator) { std::size_t newId = 1; @@ -261,7 +261,7 @@ std::size_t RadiantSelectionSystem::registerManipulator(const ManipulatorPtr& ma return newId; } -void RadiantSelectionSystem::unregisterManipulator(const ManipulatorPtr& manipulator) +void RadiantSelectionSystem::unregisterManipulator(const IManipulator::Ptr& manipulator) { for (Manipulators::const_iterator i = _manipulators.begin(); i != _manipulators.end(); ++i) { @@ -274,12 +274,12 @@ void RadiantSelectionSystem::unregisterManipulator(const ManipulatorPtr& manipul } } -Manipulator::Type RadiantSelectionSystem::getActiveManipulatorType() +IManipulator::Type RadiantSelectionSystem::getActiveManipulatorType() { return _activeManipulator->getType(); } -const ManipulatorPtr& RadiantSelectionSystem::getActiveManipulator() +const IManipulator::Ptr& RadiantSelectionSystem::getActiveManipulator() { return _activeManipulator; } @@ -302,7 +302,7 @@ void RadiantSelectionSystem::setActiveManipulator(std::size_t manipulatorId) pivotChanged(); } -void RadiantSelectionSystem::setActiveManipulator(Manipulator::Type manipulatorType) +void RadiantSelectionSystem::setActiveManipulator(IManipulator::Type manipulatorType) { for (const Manipulators::value_type& pair : _manipulators) { @@ -321,7 +321,7 @@ void RadiantSelectionSystem::setActiveManipulator(Manipulator::Type manipulatorT rError() << "Cannot activate non-existent manipulator by type " << manipulatorType << std::endl; } -sigc::signal& RadiantSelectionSystem::signal_activeManipulatorChanged() +sigc::signal& RadiantSelectionSystem::signal_activeManipulatorChanged() { return _sigActiveManipulatorChanged; } @@ -787,12 +787,12 @@ void RadiantSelectionSystem::onManipulationEnd() // The selection bounds have possibly changed _requestWorkZoneRecalculation = true; - const selection::ManipulatorPtr& activeManipulator = getActiveManipulator(); + const auto& activeManipulator = getActiveManipulator(); assert(activeManipulator); // greebo: Deselect all faces if we are in brush and drag mode if ((Mode() == SelectionSystem::ePrimitive || Mode() == SelectionSystem::eGroupPart) && - activeManipulator->getType() == selection::Manipulator::Drag) + activeManipulator->getType() == selection::IManipulator::Drag) { SelectAllComponentWalker faceSelector(false, SelectionSystem::eFace); GlobalSceneGraph().root()->traverse(faceSelector); @@ -809,7 +809,7 @@ void RadiantSelectionSystem::onManipulationEnd() void RadiantSelectionSystem::onManipulationCancelled() { - const selection::ManipulatorPtr& activeManipulator = getActiveManipulator(); + const auto& activeManipulator = getActiveManipulator(); assert(activeManipulator); // Unselect any currently selected manipulators to be sure @@ -843,7 +843,7 @@ void RadiantSelectionSystem::onManipulationCancelled() }); // greebo: Deselect all faces if we are in brush and drag mode - if (Mode() == SelectionSystem::ePrimitive && activeManipulator->getType() == selection::Manipulator::Drag) + if (Mode() == SelectionSystem::ePrimitive && activeManipulator->getType() == selection::IManipulator::Drag) { SelectAllComponentWalker faceSelector(false, SelectionSystem::eFace); GlobalSceneGraph().root()->traverse(faceSelector); @@ -990,7 +990,7 @@ void RadiantSelectionSystem::initialiseModule(const IApplicationContext& ctx) registerManipulator(std::make_shared(_pivot, 8, 64.0f)); registerManipulator(std::make_shared(_pivot)); - _defaultManipulatorType = Manipulator::Drag; + _defaultManipulatorType = IManipulator::Drag; setActiveManipulator(_defaultManipulatorType); pivotChanged(); @@ -1086,7 +1086,7 @@ void RadiantSelectionSystem::checkComponentModeSelectionMode(const ISelectable& } } -std::size_t RadiantSelectionSystem::getManipulatorIdForType(Manipulator::Type type) +std::size_t RadiantSelectionSystem::getManipulatorIdForType(IManipulator::Type type) { for (const Manipulators::value_type& pair : _manipulators) { @@ -1115,7 +1115,7 @@ void RadiantSelectionSystem::toggleManipulatorModeById(std::size_t manipId) } else // we're not in yet { - std::size_t clipperId = getManipulatorIdForType(Manipulator::Clip); + std::size_t clipperId = getManipulatorIdForType(IManipulator::Clip); if (manipId == clipperId) { @@ -1152,31 +1152,31 @@ void RadiantSelectionSystem::toggleManipulatorModeCmd(const cmd::ArgumentList& a if (manip == "drag") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::Drag)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::Drag)); } else if (manip == "translate") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::Translate)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::Translate)); } else if (manip == "rotate") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::Rotate)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::Rotate)); } else if (manip == "scale") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::Drag)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::Drag)); } else if (manip == "clip") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::Clip)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::Clip)); } else if (manip == "modelscale") { - toggleManipulatorModeById(getManipulatorIdForType(Manipulator::ModelScale)); + toggleManipulatorModeById(getManipulatorIdForType(IManipulator::ModelScale)); } } -void RadiantSelectionSystem::toggleManipulatorMode(Manipulator::Type type) +void RadiantSelectionSystem::toggleManipulatorMode(IManipulator::Type type) { // Switch back to the default mode if we're already in if (_activeManipulator->getType() == type && _defaultManipulatorType != type) @@ -1185,7 +1185,7 @@ void RadiantSelectionSystem::toggleManipulatorMode(Manipulator::Type type) } else // we're not in yet { - if (type == Manipulator::Clip) + if (type == IManipulator::Clip) { activateDefaultMode(); GlobalClipper().onClipMode(true); diff --git a/radiantcore/selection/RadiantSelectionSystem.h b/radiantcore/selection/RadiantSelectionSystem.h index a92c49100b..71e6de14e5 100644 --- a/radiantcore/selection/RadiantSelectionSystem.h +++ b/radiantcore/selection/RadiantSelectionSystem.h @@ -44,12 +44,12 @@ class RadiantSelectionSystem : sigc::signal _sigSelectionChanged; - typedef std::map Manipulators; + typedef std::map Manipulators; Manipulators _manipulators; // The currently active manipulator - ManipulatorPtr _activeManipulator; - Manipulator::Type _defaultManipulatorType; + IManipulator::Ptr _activeManipulator; + IManipulator::Type _defaultManipulatorType; // state EMode _mode; @@ -68,7 +68,7 @@ class RadiantSelectionSystem : bool nothingSelected() const; - sigc::signal _sigActiveManipulatorChanged; + sigc::signal _sigActiveManipulatorChanged; sigc::signal _sigSelectionModeChanged; sigc::signal _sigComponentModeChanged; @@ -101,14 +101,14 @@ class RadiantSelectionSystem : sigc::signal& signal_componentModeChanged() override; // Returns the ID of the registered manipulator - std::size_t registerManipulator(const ManipulatorPtr& manipulator) override; - void unregisterManipulator(const ManipulatorPtr& manipulator) override; + std::size_t registerManipulator(const IManipulator::Ptr& manipulator) override; + void unregisterManipulator(const IManipulator::Ptr& manipulator) override; - Manipulator::Type getActiveManipulatorType() override; - const ManipulatorPtr& getActiveManipulator() override; + IManipulator::Type getActiveManipulatorType() override; + const IManipulator::Ptr& getActiveManipulator() override; void setActiveManipulator(std::size_t manipulatorId) override; - void setActiveManipulator(Manipulator::Type manipulatorType) override; - sigc::signal& signal_activeManipulatorChanged() override; + void setActiveManipulator(IManipulator::Type manipulatorType) override; + sigc::signal& signal_activeManipulatorChanged() override; std::size_t countSelected() const override; std::size_t countSelectedComponents() const override; @@ -184,11 +184,11 @@ class RadiantSelectionSystem : void notifyObservers(const scene::INodePtr& node, bool isComponent); - std::size_t getManipulatorIdForType(Manipulator::Type type); + std::size_t getManipulatorIdForType(IManipulator::Type type); // Command targets used to connect to the event system void toggleManipulatorModeCmd(const cmd::ArgumentList& args); - void toggleManipulatorMode(Manipulator::Type type); + void toggleManipulatorMode(IManipulator::Type type); void toggleManipulatorModeById(std::size_t manipId); void activateDefaultMode(); diff --git a/radiantcore/selection/algorithm/Transformation.cpp b/radiantcore/selection/algorithm/Transformation.cpp index ddbf0273ab..fa4fb5cd33 100644 --- a/radiantcore/selection/algorithm/Transformation.cpp +++ b/radiantcore/selection/algorithm/Transformation.cpp @@ -383,14 +383,14 @@ void nudgeSelected(ENudgeDirection direction, float amount, EViewType viewtype) //Vector3 view_direction(-axes.z); Vector3 nudge(AxisBase_axisForDirection(axes, direction) * amount); - if (GlobalSelectionSystem().getActiveManipulatorType() == selection::Manipulator::Translate || - GlobalSelectionSystem().getActiveManipulatorType() == selection::Manipulator::Drag || - GlobalSelectionSystem().getActiveManipulatorType() == selection::Manipulator::Clip) + if (GlobalSelectionSystem().getActiveManipulatorType() == selection::IManipulator::Translate || + GlobalSelectionSystem().getActiveManipulatorType() == selection::IManipulator::Drag || + GlobalSelectionSystem().getActiveManipulatorType() == selection::IManipulator::Clip) { translateSelected(nudge); // In clip mode, update the clipping plane - if (GlobalSelectionSystem().getActiveManipulatorType() == selection::Manipulator::Clip) + if (GlobalSelectionSystem().getActiveManipulatorType() == selection::IManipulator::Clip) { GlobalClipper().update(); } diff --git a/radiantcore/selection/manipulators/ManipulatorBase.h b/radiantcore/selection/manipulators/ManipulatorBase.h index eb41039914..4a860900bc 100644 --- a/radiantcore/selection/manipulators/ManipulatorBase.h +++ b/radiantcore/selection/manipulators/ManipulatorBase.h @@ -13,7 +13,7 @@ namespace selection * around specific axes. */ class ManipulatorBase : - public Manipulator + public IManipulator { private: std::size_t _id; diff --git a/radiantcore/selection/manipulators/ManipulatorComponents.h b/radiantcore/selection/manipulators/ManipulatorComponents.h index 52f43d6fc2..042f9e0de4 100644 --- a/radiantcore/selection/manipulators/ManipulatorComponents.h +++ b/radiantcore/selection/manipulators/ManipulatorComponents.h @@ -18,7 +18,7 @@ namespace selection { class ManipulatorComponentBase : - public Manipulator::Component + public IManipulator::Component { public: virtual ~ManipulatorComponentBase() diff --git a/test/Selection.cpp b/test/Selection.cpp index 5fdbb73504..9884fcc1d2 100644 --- a/test/Selection.cpp +++ b/test/Selection.cpp @@ -118,7 +118,7 @@ TEST_F(SelectionTest, PivotIsResetAfterCancelingOperation) auto worldspawn = GlobalMapModule().findOrInsertWorldspawn(); auto brush = algorithm::findFirstBrushWithMaterial(worldspawn, "textures/numbers/1"); - GlobalSelectionSystem().setActiveManipulator(selection::Manipulator::Translate); + GlobalSelectionSystem().setActiveManipulator(selection::IManipulator::Translate); // Select the node, the pivot should now be at the node center Node_setSelected(brush, true);