Skip to content

Commit

Permalink
#5746: TexTool is listening to manipulator mode changes now
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 18, 2021
1 parent 7b34d73 commit c04661c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions radiant/textool/TexTool.cpp
Expand Up @@ -134,6 +134,7 @@ void TexTool::_preHide()
_redoHandler.disconnect();

_selectionChanged.disconnect();
_manipulatorChanged.disconnect();

// Clear items to prevent us from running into stale references
// when the textool is shown again
Expand All @@ -148,6 +149,7 @@ void TexTool::_preShow()
_selectionChanged.disconnect();
_undoHandler.disconnect();
_redoHandler.disconnect();
_manipulatorChanged.disconnect();

// Register self to the SelSystem to get notified upon selection changes.
_selectionChanged = GlobalSelectionSystem().signal_selectionChanged().connect(
Expand All @@ -158,6 +160,10 @@ void TexTool::_preShow()
_redoHandler = GlobalUndoSystem().signal_postRedo().connect(
sigc::mem_fun(this, &TexTool::onUndoRedoOperation));

_manipulatorChanged = GlobalTextureToolSelectionSystem().signal_activeManipulatorChanged().connect(
sigc::mem_fun(this, &TexTool::onManipulatorModeChanged)
);

// Trigger an update of the current selection
_selectionRescanNeeded = true;
queueDraw();
Expand All @@ -168,6 +174,11 @@ void TexTool::onUndoRedoOperation()
queueDraw();
}

void TexTool::onManipulatorModeChanged(selection::IManipulator::Type type)
{
queueDraw();
}

void TexTool::gridUp() {
if (_grid*2 <= GRID_MAX && _gridActive) {
_grid *= 2;
Expand Down
2 changes: 2 additions & 0 deletions radiant/textool/TexTool.h
Expand Up @@ -89,6 +89,7 @@ class TexTool :
sigc::connection _selectionChanged;
sigc::connection _undoHandler;
sigc::connection _redoHandler;
sigc::connection _manipulatorChanged;

private:
// This is where the static shared_ptr of the singleton instance is held.
Expand Down Expand Up @@ -287,6 +288,7 @@ class TexTool :
private:
void updateProjection();
double getTextureAspectRatio();
void onManipulatorModeChanged(selection::IManipulator::Type type);

TextureToolMouseEvent createMouseEvent(const Vector2& point, const Vector2& delta = Vector2(0, 0));

Expand Down

0 comments on commit c04661c

Please sign in to comment.