Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move scale code to algorithm namespace.
  • Loading branch information
codereader committed Dec 19, 2016
1 parent 47f9c4b commit 4454ec6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
1 change: 0 additions & 1 deletion include/iselection.h
Expand Up @@ -254,7 +254,6 @@ class SelectionSystem :
virtual SelectionChangedSignal signal_selectionChanged() const = 0;

virtual void translateSelected(const Vector3& translation) = 0;
virtual void scaleSelected(const Vector3& scaling) = 0;

virtual const Matrix4& getPivot2World() = 0;
virtual void pivotChanged() = 0;
Expand Down
19 changes: 0 additions & 19 deletions radiant/selection/RadiantSelectionSystem.cpp
Expand Up @@ -799,25 +799,6 @@ void RadiantSelectionSystem::translateSelected(const Vector3& translation)
freezeTransforms();
}

// Shortcut call for an instantly applied scaling of the current selection
void RadiantSelectionSystem::scaleSelected(const Vector3& scaling)
{
// Pass the scale to the according traversor
if (Mode() == eComponent)
{
Scene_Scale_Component_Selected(GlobalSceneGraph(), scaling, _pivot.getVector3());
}
else
{
Scene_Scale_Selected(GlobalSceneGraph(), scaling, _pivot.getVector3());
}

// Update the scene views
SceneChangeNotify();

freezeTransforms();
}

void RadiantSelectionSystem::renderWireframe(RenderableCollector& collector, const VolumeTest& volume) const
{
renderSolid(collector, volume);
Expand Down
1 change: 0 additions & 1 deletion radiant/selection/RadiantSelectionSystem.h
Expand Up @@ -143,7 +143,6 @@ class RadiantSelectionSystem :
void onManipulationEnd() override;

void translateSelected(const Vector3& translation);
void scaleSelected(const Vector3& scaling);

void freezeTransforms();

Expand Down
24 changes: 20 additions & 4 deletions radiant/selection/algorithm/Transformation.cpp
Expand Up @@ -71,11 +71,27 @@ void scaleSelected(const Vector3& scaleXYZ)
{
std::string command("scaleSelected: ");
command += string::to_string(scaleXYZ);
UndoableCommand undo(command.c_str());
UndoableCommand undo(command);

GlobalSelectionSystem().scaleSelected(scaleXYZ);
// Pass the scale to the according traversor
if (GlobalSelectionSystem().Mode() == SelectionSystem::eComponent)
{
Scene_Scale_Component_Selected(GlobalSceneGraph(), scaleXYZ,
GlobalSelectionSystem().getPivot2World().t().getVector3());
}
else
{
Scene_Scale_Selected(GlobalSceneGraph(), scaleXYZ,
GlobalSelectionSystem().getPivot2World().t().getVector3());
}

// Update the scene views
SceneChangeNotify();

GlobalSceneGraph().foreachNode(scene::freezeTransformableNode);
}
else {
else
{
wxutil::Messagebox::ShowError(_("Cannot scale by zero value."));
}
}
Expand Down Expand Up @@ -522,7 +538,7 @@ void mirrorSelection(int axis)
Vector3 flip(1, 1, 1);
flip[axis] = -1;

GlobalSelectionSystem().scaleSelected(flip);
scaleSelected(flip);
}

void mirrorSelectionX(const cmd::ArgumentList& args)
Expand Down

0 comments on commit 4454ec6

Please sign in to comment.