Skip to content

Commit

Permalink
Scrolling while transform tool is active now scales the selected shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Mar 19, 2016
1 parent c5c4a53 commit 34c198d
Showing 1 changed file with 52 additions and 10 deletions.
62 changes: 52 additions & 10 deletions OutfitStudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,7 @@ void OutfitStudio::OnImportShape(wxCommandEvent& WXUNUSED(event)) {
wxLogMessage("Imported shape.");

RefreshGUIFromProj();
glView->Refresh();
glView->Render();
}

void OutfitStudio::OnExportShape(wxCommandEvent& WXUNUSED(event)) {
Expand Down Expand Up @@ -3187,7 +3187,7 @@ void OutfitStudio::OnImportFBX(wxCommandEvent& WXUNUSED(event)) {
wxLogMessage("Imported shape.");

RefreshGUIFromProj();
glView->Refresh();
glView->Render();
}

void OutfitStudio::OnExportFBX(wxCommandEvent& WXUNUSED(event)) {
Expand Down Expand Up @@ -3337,6 +3337,9 @@ void OutfitStudio::OnMoveShape(wxCommandEvent& WXUNUSED(event)) {
}
previewMove.Zero();
}

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}

void OutfitStudio::OnMoveShapeOldOffset(wxCommandEvent& event) {
Expand Down Expand Up @@ -3424,7 +3427,11 @@ void OutfitStudio::PreviewMove(const Vector3& changed) {
project->GetLiveVerts(i->shapeName, verts);
glView->UpdateMeshVertices(i->shapeName, &verts);
}

previewMove = changed;

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}

void OutfitStudio::OnScaleShape(wxCommandEvent& WXUNUSED(event)) {
Expand Down Expand Up @@ -3463,6 +3470,9 @@ void OutfitStudio::OnScaleShape(wxCommandEvent& WXUNUSED(event)) {
}

previewScale = 1.0f;

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}
}

Expand Down Expand Up @@ -3514,6 +3524,9 @@ void OutfitStudio::PreviewScale(const float& scale) {
}

previewScale = scale;

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}

void OutfitStudio::OnRotateShape(wxCommandEvent& WXUNUSED(event)) {
Expand Down Expand Up @@ -3562,6 +3575,9 @@ void OutfitStudio::OnRotateShape(wxCommandEvent& WXUNUSED(event)) {
}

previewRotation.Zero();

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}
}

Expand Down Expand Up @@ -3615,7 +3631,11 @@ void OutfitStudio::PreviewRotation(const Vector3& changed) {
project->GetLiveVerts(i->shapeName, verts);
glView->UpdateMeshVertices(i->shapeName, &verts);
}

previewRotation = changed;

if (glView->GetTransformMode())
glView->ShowTransformTool(true, false);
}

void OutfitStudio::OnDupeShape(wxCommandEvent& WXUNUSED(event)) {
Expand Down Expand Up @@ -4280,6 +4300,9 @@ void wxGLPanel::OnKeys(wxKeyEvent& event) {
os->project->GetLiveVerts(os->activeItem->shapeName, verts);
UpdateMeshVertices(os->activeItem->shapeName, &verts);
}

if (transformMode)
ShowTransformTool(true, false);
}
}
else if (event.GetKeyCode() == WXK_SPACE)
Expand Down Expand Up @@ -4726,21 +4749,40 @@ void wxGLPanel::OnMouseWheel(wxMouseEvent& event) {
if (wxGetKeyState(wxKeyCode('S'))) {
wxPoint p = event.GetPosition();
int delt = event.GetWheelRotation();
if (delt < 0)
DecBrush();
else
IncBrush();

gls.UpdateCursor(p.x, p.y, bGlobalBrushCollision);
if (editMode) {
// Adjust brush size
if (delt < 0)
DecBrush();
else
IncBrush();

os->CheckBrushBounds();
os->UpdateBrushPane();
gls.UpdateCursor(p.x, p.y, bGlobalBrushCollision);
}
else if (transformMode) {
// Adjust scale of active shapes
float factor = delt < 0 ? 0.99f : 1.01f;
for (auto &m : gls.GetActiveMeshes()) {
unordered_map<ushort, float> mask;
vector<Vector3> verts;
GetShapeMask(mask, m->shapeName);

os->project->ScaleShape(m->shapeName, factor, &mask);
os->project->GetLiveVerts(m->shapeName, verts);
UpdateMeshVertices(m->shapeName, &verts);
}

ShowTransformTool(true, false);
}
}
else {
int delt = event.GetWheelRotation();
gls.DollyCamera(delt);
gls.UpdateProjection();
}

os->CheckBrushBounds();
os->UpdateBrushPane();

gls.RenderOneFrame();
}

Expand Down

0 comments on commit 34c198d

Please sign in to comment.