Added name for items in undo/redo stack inside multi-material gizmo.

This commit is contained in:
Lukáš Hejl 2021-06-03 18:11:48 +02:00
parent 6ed4885d01
commit cc913d52ef
8 changed files with 84 additions and 260 deletions

View file

@ -13,9 +13,7 @@
#include <GL/glew.h>
namespace Slic3r {
namespace GUI {
namespace Slic3r::GUI {
@ -164,7 +162,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
ImGui::Separator();
if (m_imgui->button(m_desc.at("remove_all"))) {
Plater::TakeSnapshot(wxGetApp().plater(), wxString(_L("Reset selection")));
Plater::TakeSnapshot snapshot(wxGetApp().plater(), wxString(_L("Reset selection")));
ModelObject* mo = m_c->selection_info()->model_object();
int idx = -1;
for (ModelVolume* mv : mo->volumes) {
@ -248,9 +246,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
ImGui::SameLine(clipping_slider_left);
ImGui::PushItemWidth(window_width - clipping_slider_left);
float clp_dist = m_c->object_clipper()->get_position();
auto clp_dist = float(m_c->object_clipper()->get_position());
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -265,7 +264,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
{
float threshold = (M_PI/180.)*threshold_deg;
float threshold = (float(M_PI)/180.f)*threshold_deg;
const Selection& selection = m_parent.get_selection();
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[selection.get_instance_idx()];
@ -297,7 +296,7 @@ void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
activate_internal_undo_redo_stack(true);
Plater::TakeSnapshot(wxGetApp().plater(), block ? _L("Block supports by angle")
Plater::TakeSnapshot snapshot(wxGetApp().plater(), block ? _L("Block supports by angle")
: _L("Add supports by angle"));
update_model_object();
m_parent.set_as_dirty();
@ -356,6 +355,18 @@ PainterGizmoType GLGizmoFdmSupports::get_painter_type() const
return PainterGizmoType::FDM_SUPPORTS;
}
wxString GLGizmoFdmSupports::handle_snapshot_action_name(bool shift_down, GLGizmoPainterBase::Button button_down) const
{
wxString action_name;
if (shift_down)
action_name = _L("Remove selection");
else {
if (button_down == Button::Left)
action_name = _L("Add supports");
else
action_name = _L("Block supports");
}
return action_name;
}
} // namespace GUI
} // namespace Slic3r
} // namespace Slic3r::GUI