diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2022-05-13 10:46:09 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2022-06-06 11:18:04 +0300 |
commit | 9062a74c5c29c9f124d172838ade3cd6088b035d (patch) | |
tree | 2bdaf089398ecb6341ea03927f9cfae1fd30c33f | |
parent | 9efeb0b9e594b250987f2f2ff589cdc75b898d18 (diff) |
Tech ENABLE_TRANSFORMATIONS_BY_MATRICES - Fixed scale reset
-rw-r--r-- | src/slic3r/GUI/GUI_ObjectManipulation.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 8af365457..6b11b46bf 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -460,13 +460,24 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : m_reset_scale_button = new ScalableButton(parent, wxID_ANY, ScalableBitmap(parent, "undo")); m_reset_scale_button->SetToolTip(_L("Reset scale")); m_reset_scale_button->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) { - Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset scale")); #if ENABLE_TRANSFORMATIONS_BY_MATRICES - bool old_uniform = m_uniform_scale; - m_uniform_scale = true; - change_scale_value(0, 100.0); - m_uniform_scale = old_uniform; + GLCanvas3D* canvas = wxGetApp().plater()->canvas3D(); + Selection& selection = canvas->get_selection(); + if (selection.is_single_volume_or_modifier()) + const_cast<GLVolume*>(selection.get_first_volume())->set_volume_scaling_factor(Vec3d::Ones()); + else if (selection.is_single_full_instance()) { + for (unsigned int idx : selection.get_volume_idxs()) { + const_cast<GLVolume*>(selection.get_volume(idx))->set_instance_scaling_factor(Vec3d::Ones()); + } + } + else + return; + + canvas->do_scale(L("Reset scale")); + + UpdateAndShow(true); #else + Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset scale")); change_scale_value(0, 100.); change_scale_value(1, 100.); change_scale_value(2, 100.); |