Skip to content

Commit

Permalink
#5746: Component selections are tracked
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 24, 2021
1 parent e5f26c3 commit 46da5bc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/itexturetoolmodel.h
Expand Up @@ -194,8 +194,9 @@ class ITextureToolSelectionSystem :
virtual void onManipulationFinished() = 0;
virtual void onManipulationCancelled() = 0;

// Feedback method which is invoked by selectable nodes to report a selection status change
// Feedback methods which are invoked by selectable nodes to report a selection status change
virtual void onNodeSelectionChanged(ISelectable& selectable) = 0;
virtual void onComponentSelectionChanged(ISelectable& selectable) = 0;
};

}
Expand Down
12 changes: 10 additions & 2 deletions radiantcore/selection/textool/SelectableVertex.h
@@ -1,19 +1,21 @@
#pragma once

#include "selection/BasicSelectable.h"
#include "itexturetoolmodel.h"
#include "ObservedSelectable.h"

namespace textool
{

class SelectableVertex :
public selection::BasicSelectable
public selection::ObservedSelectable
{
private:
Vector3& _vertex;
Vector2& _texcoord;

public:
SelectableVertex(Vector3& vertex, Vector2& texcoord) :
ObservedSelectable(sigc::mem_fun(*this, &SelectableVertex::onSelectionStatusChanged)),
_vertex(vertex),
_texcoord(texcoord)
{}
Expand All @@ -37,6 +39,12 @@ class SelectableVertex :
{
return _texcoord;
}

private:
void onSelectionStatusChanged(const ISelectable& selectable)
{
GlobalTextureToolSelectionSystem().onComponentSelectionChanged(*this);
}
};

}
5 changes: 5 additions & 0 deletions radiantcore/selection/textool/TextureToolSelectionSystem.cpp
Expand Up @@ -522,6 +522,11 @@ void TextureToolSelectionSystem::onNodeSelectionChanged(ISelectable& selectable)
_sigSelectionChanged.emit();
}

void TextureToolSelectionSystem::onComponentSelectionChanged(ISelectable& selectable)
{
_sigSelectionChanged.emit();
}

module::StaticModule<TextureToolSelectionSystem> _textureToolSelectionSystemModule;

}
1 change: 1 addition & 0 deletions radiantcore/selection/textool/TextureToolSelectionSystem.h
Expand Up @@ -72,6 +72,7 @@ class TextureToolSelectionSystem :
void onManipulationCancelled() override;

void onNodeSelectionChanged(ISelectable& selectable) override;
void onComponentSelectionChanged(ISelectable& selectable) override;

private:
void handleUnselectRequest(selection::UnselectSelectionRequest& request);
Expand Down

0 comments on commit 46da5bc

Please sign in to comment.