Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_copy_and_paste

This commit is contained in:
Enrico Turri 2019-04-23 08:03:54 +02:00
commit 705f7c8fa0
4 changed files with 109 additions and 36 deletions

View File

@ -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);

View File

@ -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;

View File

@ -5,8 +5,11 @@
#include <GL/glew.h>
#include <wx/msgdlg.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#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"
@ -823,33 +826,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<ConfigOptionFloat*>(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)
@ -885,9 +887,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<const ConfigOption*> opts = get_config_options({"support_points_density_relative", "support_points_minimal_distance"});
float density = static_cast<const ConfigOptionInt*>(opts[0])->value;
@ -898,7 +900,7 @@ RENDER_AGAIN:
m_model_object->config.opt<ConfigOptionFloat>("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<ConfigOptionInt>("support_points_density_relative", true)->value = (int)density;
@ -911,43 +913,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
@ -1200,6 +1210,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<std::pair<std::string, wxString>> 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

View File

@ -12,6 +12,7 @@
#include "libslic3r/SLA/SLACommon.hpp"
#include "libslic3r/SLAPrint.hpp"
#include <wx/dialog.h>
namespace Slic3r {
@ -137,6 +138,12 @@ protected:
};
class SlaGizmoHelpDialog : public wxDialog
{
public:
SlaGizmoHelpDialog();
};
} // namespace GUI
} // namespace Slic3r