From 1fd6748178a6261447b0e6a7fd7b230d282ac4f2 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 18 Apr 2019 14:45:13 +0200 Subject: [PATCH 1/3] Fixed a typo in export_obj parameter label --- src/libslic3r/PrintConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index b3061ca61..ec5acf43b 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2926,7 +2926,7 @@ CLIActionsConfigDef::CLIActionsConfigDef() // Actions: def = this->add("export_obj", coBool); - def->label = L("Export SVG"); + def->label = L("Export OBJ"); def->tooltip = L("Export the model(s) as OBJ."); def->default_value = new ConfigOptionBool(false); From 3f74ec491e53074e5dd01bd1686d1c1625e511c7 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 18 Apr 2019 15:08:11 +0200 Subject: [PATCH 2/3] Partial fix of "Wrong width of perimeter for solid anchors #1803" Improvement in handling of the "default" external perimeter width. --- src/libslic3r/SupportMaterial.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index c1847fcd8..fde35ca1e 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -160,17 +160,13 @@ PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object m_support_material_interface_flow = m_support_material_flow; } + // Evaluate the XY gap between the object outer perimeters and the support structures. // Evaluate the XY gap between the object outer perimeters and the support structures. coordf_t external_perimeter_width = 0.; - for (size_t region_id = 0; region_id < object->region_volumes.size(); ++ region_id) { - if (! object->region_volumes[region_id].empty()) { - const PrintRegionConfig &config = object->print()->get_region(region_id)->config(); - coordf_t width = config.external_perimeter_extrusion_width.get_abs_value(slicing_params.layer_height); - if (width <= 0.) - width = m_print_config->nozzle_diameter.get_at(config.perimeter_extruder-1); - external_perimeter_width = std::max(external_perimeter_width, width); - } - } + for (size_t region_id = 0; region_id < object->region_volumes.size(); ++ region_id) + if (! object->region_volumes[region_id].empty()) + external_perimeter_width = std::max(external_perimeter_width, + (coordf_t)object->print()->get_region(region_id)->flow(frExternalPerimeter, slicing_params.layer_height, false, false, -1, *object).width); m_gap_xy = m_object_config->support_material_xy_spacing.get_abs_value(external_perimeter_width); m_can_merge_support_regions = m_object_config->support_material_extruder.value == m_object_config->support_material_interface_extruder.value; From 55c07394e59183f7b45197b2f8ffcce1df9ef378 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 18 Apr 2019 07:23:51 +0200 Subject: [PATCH 3/3] Added dialog with shortcuts to the SLA gizmo, tried to improve the dialog look --- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 122 +++++++++++++++---- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp | 7 ++ 2 files changed, 103 insertions(+), 26 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index ab3f7eb46..e8fe32688 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -5,8 +5,11 @@ #include #include +#include +#include #include "slic3r/GUI/GUI_App.hpp" +#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI_ObjectSettings.hpp" #include "slic3r/GUI/GUI_ObjectList.hpp" #include "slic3r/GUI/PresetBundle.hpp" @@ -863,33 +866,32 @@ void GLGizmoSlaSupports::on_render_input_window(float x, float y, float bottom_l bool first_run = true; // This is a hack to redraw the button when all points are removed, // so it is not delayed until the background process finishes. RENDER_AGAIN: + //m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); + //const ImVec2 window_size(m_imgui->scaled(18.f, 16.f)); + //ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) )); + //ImGui::SetNextWindowSize(ImVec2(window_size)); + + const float approx_height = m_imgui->scaled(18.0f); + y = std::min(y, bottom_limit - approx_height); m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); - - const ImVec2 window_size(m_imgui->scaled(17.f, 20.f)); - ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) )); - ImGui::SetNextWindowSize(ImVec2(window_size)); - m_imgui->set_next_window_bg_alpha(0.5f); m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); - ImGui::PushItemWidth(100.0f); + ImGui::PushItemWidth(m_imgui->scaled(5.55f)); bool force_refresh = false; bool remove_selected = false; bool remove_all = false; if (m_editing_mode) { - m_imgui->text(_(L("Left mouse click - add point"))); - m_imgui->text(_(L("Right mouse click - remove point"))); - m_imgui->text(_(L("Shift + Left (+ drag) - select point(s)"))); - m_imgui->text(" "); // vertical gap float diameter_upper_cap = static_cast(wxGetApp().preset_bundle->sla_prints.get_edited_preset().config.option("support_pillar_diameter"))->value; if (m_new_point_head_diameter > diameter_upper_cap) m_new_point_head_diameter = diameter_upper_cap; m_imgui->text(_(L("Head diameter: "))); - ImGui::SameLine(); + ImGui::SameLine(m_imgui->scaled(6.66f)); + ImGui::PushItemWidth(m_imgui->scaled(8.33f)); if (ImGui::SliderFloat("", &m_new_point_head_diameter, 0.1f, diameter_upper_cap, "%.1f")) { // value was changed for (auto& cache_entry : m_editing_mode_cache) @@ -925,9 +927,9 @@ RENDER_AGAIN: } } else { // not in editing mode: - ImGui::PushItemWidth(100.0f); + ImGui::PushItemWidth(m_imgui->scaled(5.55f)); m_imgui->text(_(L("Minimal points distance: "))); - ImGui::SameLine(); + ImGui::SameLine(m_imgui->scaled(9.44f)); std::vector opts = get_config_options({"support_points_density_relative", "support_points_minimal_distance"}); float density = static_cast(opts[0])->value; @@ -938,7 +940,7 @@ RENDER_AGAIN: m_model_object->config.opt("support_points_minimal_distance", true)->value = minimal_point_distance; m_imgui->text(_(L("Support points density: "))); - ImGui::SameLine(); + ImGui::SameLine(m_imgui->scaled(9.44f)); if (ImGui::SliderFloat(" ", &density, 0.f, 200.f, "%.f %%")) { value_changed = true; m_model_object->config.opt("support_points_density_relative", true)->value = (int)density; @@ -951,43 +953,51 @@ RENDER_AGAIN: }); } - bool generate = m_imgui->button(_(L("Auto-generate points [A]"))); + bool generate = m_imgui->button(_(L("Auto-generate points"))); if (generate) auto_generate(); m_imgui->text(""); - if (m_imgui->button(_(L("Manual editing [M]")))) + if (m_imgui->button(_(L("Manual editing")))) switch_to_editing_mode(); m_imgui->disabled_begin(m_editing_mode_cache.empty()); remove_all = m_imgui->button(_(L("Remove all points"))); m_imgui->disabled_end(); - m_imgui->text(""); - - m_imgui->text(m_model_object->sla_points_status == sla::PointsStatus::None ? _(L("No points (will be autogenerated)")) : - (m_model_object->sla_points_status == sla::PointsStatus::AutoGenerated ? _(L("Autogenerated points (no modifications)")) : - (m_model_object->sla_points_status == sla::PointsStatus::UserModified ? _(L("User-modified points")) : - (m_model_object->sla_points_status == sla::PointsStatus::Generating ? _(L("Generation in progress...")) : "UNKNOWN STATUS")))); + // m_imgui->text(""); + // m_imgui->text(m_model_object->sla_points_status == sla::PointsStatus::None ? _(L("No points (will be autogenerated)")) : + // (m_model_object->sla_points_status == sla::PointsStatus::AutoGenerated ? _(L("Autogenerated points (no modifications)")) : + // (m_model_object->sla_points_status == sla::PointsStatus::UserModified ? _(L("User-modified points")) : + // (m_model_object->sla_points_status == sla::PointsStatus::Generating ? _(L("Generation in progress...")) : "UNKNOWN STATUS")))); } // Following is rendered in both editing and non-editing mode: + m_imgui->text(""); if (m_clipping_plane_distance == 0.f) m_imgui->text("Clipping of view: "); else { - if (m_imgui->button(_(L("Reset direction [R] ")))) { + if (m_imgui->button(_(L("Reset direction")))) { wxGetApp().CallAfter([this](){ reset_clipping_plane_normal(); }); } } - ImGui::SameLine(140.f); - ImGui::PushItemWidth(150.0f); + ImGui::SameLine(m_imgui->scaled(6.66f)); + ImGui::PushItemWidth(m_imgui->scaled(8.33f)); ImGui::SliderFloat(" ", &m_clipping_plane_distance, 0.f, 1.f, "%.2f"); - + + + if (m_imgui->button("?")) { + wxGetApp().CallAfter([]() { + SlaGizmoHelpDialog help_dlg; + help_dlg.ShowModal(); + }); + } + m_imgui->end(); if (m_editing_mode != m_old_editing_state) { // user toggled between editing/non-editing mode @@ -1240,6 +1250,66 @@ void GLGizmoSlaSupports::reset_clipping_plane_normal() const } +SlaGizmoHelpDialog::SlaGizmoHelpDialog() +: wxDialog(NULL, wxID_ANY, _(L("SLA gizmo keyboard shortcuts")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) +{ + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + const std::string &ctrl = GUI::shortkey_ctrl_prefix(); + const std::string &alt = GUI::shortkey_alt_prefix(); + + + // fonts + const wxFont& font = wxGetApp().small_font(); + const wxFont& bold_font = wxGetApp().bold_font(); + + auto note_text = new wxStaticText(this, wxID_ANY, "Note: some shortcuts work in (non)editing mode only."); + note_text->SetFont(font); + + auto vsizer = new wxBoxSizer(wxVERTICAL); + auto gridsizer = new wxFlexGridSizer(2, 5, 15); + auto hsizer = new wxBoxSizer(wxHORIZONTAL); + + hsizer->AddSpacer(20); + hsizer->Add(vsizer); + hsizer->AddSpacer(20); + + vsizer->AddSpacer(20); + vsizer->Add(note_text, 1, wxALIGN_CENTRE_HORIZONTAL); + vsizer->AddSpacer(20); + vsizer->Add(gridsizer); + vsizer->AddSpacer(20); + + std::vector> shortcuts; + shortcuts.push_back(std::make_pair("Left click", _(L("Add point")))); + shortcuts.push_back(std::make_pair("Right click", _(L("Remove point")))); + shortcuts.push_back(std::make_pair("Drag", _(L("Move point")))); + shortcuts.push_back(std::make_pair(ctrl+"Left click", _(L("Add point to selection")))); + shortcuts.push_back(std::make_pair(alt+"Left click", _(L("Remove point from selection")))); + shortcuts.push_back(std::make_pair("Shift+drag", _(L("Select by rectangle")))); + shortcuts.push_back(std::make_pair(alt+"drag", _(L("Deselect by rectangle")))); + shortcuts.push_back(std::make_pair(ctrl+"A", _(L("Select all points")))); + shortcuts.push_back(std::make_pair("Delete", _(L("Remove selected points")))); + shortcuts.push_back(std::make_pair(ctrl+"mouse wheel", _(L("Move clipping plane")))); + shortcuts.push_back(std::make_pair("R", _(L("Reset clipping plane")))); + shortcuts.push_back(std::make_pair("Enter", _(L("Apply changes")))); + shortcuts.push_back(std::make_pair("Esc", _(L("Discard changes")))); + shortcuts.push_back(std::make_pair("M", _(L("Switch to editing mode")))); + shortcuts.push_back(std::make_pair("A", _(L("Auto-generate points")))); + + for (const auto& pair : shortcuts) { + auto shortcut = new wxStaticText(this, wxID_ANY, pair.first); + auto desc = new wxStaticText(this, wxID_ANY, pair.second); + shortcut->SetFont(bold_font); + desc->SetFont(font); + gridsizer->Add(shortcut, -1, wxALIGN_CENTRE_VERTICAL); + gridsizer->Add(desc, -1, wxALIGN_CENTRE_VERTICAL); + } + + SetSizer(hsizer); + hsizer->SetSizeHints(this); +} + + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp index 982f6c95d..eaf0932c4 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp @@ -11,6 +11,7 @@ #include "libslic3r/SLA/SLACommon.hpp" #include "libslic3r/SLAPrint.hpp" +#include namespace Slic3r { @@ -139,6 +140,12 @@ protected: }; +class SlaGizmoHelpDialog : public wxDialog +{ +public: + SlaGizmoHelpDialog(); +}; + } // namespace GUI } // namespace Slic3r