Skip to content

Commit

Permalink
Merge branch 'merill-merge'
Browse files Browse the repository at this point in the history
  • Loading branch information
remi durand committed Jun 12, 2021
2 parents 18a49e4 + c082d19 commit 1bd0a1b
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp_mac_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 'Nigthly'
ref: 'rc'
- name: update submodule profiles
working-directory: ./resources/profiles
run: git submodule update --init
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccpp_ubuntu_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 'Nigthly'
ref: 'rc'
- name: update submodule profiles
working-directory: ./resources/profiles
run: git submodule update --init
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccpp_win_rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: 'Nigthly'
ref: 'rc'
- uses: ilammy/msvc-dev-cmd@v1
- name: mkdir in deps
run: mkdir deps/build
Expand Down
2 changes: 1 addition & 1 deletion resources/profiles
10 changes: 8 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3876,6 +3876,9 @@ std::string GCode::_after_extrude(const ExtrusionPath &path) {
else
gcode += ";_EXTRUDE_END\n";

if (path.role() != ExtrusionRole::erGapFill ) {
m_last_notgapfill_extrusion_role = path.role();
}

this->set_last_pos(path.last_point());
return gcode;
Expand Down Expand Up @@ -4003,11 +4006,14 @@ std::string GCode::retract(bool toolchange)
length is honored in case wipe path was too short. */
gcode += toolchange ? m_writer.retract_for_toolchange() : m_writer.retract();
bool need_lift = !m_writer.tool_is_extruder() || toolchange || (BOOL_EXTRUDER_CONFIG(retract_lift_first_layer) && m_config.print_retract_lift.value != 0 && this->m_layer_index == 0);
bool last_fill_extusion_role_top_infill = (this->m_last_extrusion_role == ExtrusionRole::erTopSolidInfill);
if(this->m_last_extrusion_role == ExtrusionRole::erGapFill)
last_fill_extusion_role_top_infill = (this->m_last_notgapfill_extrusion_role == ExtrusionRole::erTopSolidInfill);
if (!need_lift && m_config.print_retract_lift.value != 0) {
if (EXTRUDER_CONFIG_WITH_DEFAULT(retract_lift_top, "") == "Not on top")
need_lift = (this->m_last_extrusion_role != ExtrusionRole::erTopSolidInfill);
need_lift = !last_fill_extusion_role_top_infill;
else if (EXTRUDER_CONFIG_WITH_DEFAULT(retract_lift_top, "") == "Only on top")
need_lift = (this->m_last_extrusion_role == ExtrusionRole::erTopSolidInfill);
need_lift = last_fill_extusion_role_top_infill;
else
need_lift = true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/GCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ class GCode : ExtrusionVisitorConst {
double m_volumetric_speed;
// Support for the extrusion role markers. Which marker is active?
ExtrusionRole m_last_extrusion_role;
// Not know the gapfill role for retract_lift_top
ExtrusionRole m_last_notgapfill_extrusion_role;
// Support for G-Code Processor
float m_last_height{ 0.0f };
float m_last_layer_z{ 0.0f };
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/CoolingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ float new_feedrate_to_reach_time_stretch(
float time_stretch_final = 0.f;
for (auto it = it_begin; it != it_end; ++ it)
time_stretch_final += (*it)->time_stretch_when_slowing_down_to_feedrate(new_feedrate);
assert(std::abs(time_stretch - time_stretch_final) < EPSILON);
//assert(std::abs(time_stretch - time_stretch_final) < EPSILON);
}
#endif /* NDEBUG */

Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PresetBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void PresetBundle::load_selections(AppConfig &config, const std::string &preferr
void PresetBundle::export_selections(AppConfig &config)
{
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() >= 1);
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
//assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
config.clear_section("presets");
config.set("presets", "print", prints.get_selected_preset_name());
config.set("presets", "filament", filament_presets.front());
Expand Down
1 change: 0 additions & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ void PrintConfigDef::init_common_params()
def->tooltip = L("Set this to the maximum height that can be reached by your extruder while printing.");
def->sidetext = L("mm");
def->min = 0;
def->max = 1200;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(200.0));

Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<WipeAlgo>::get_en

template<> inline const t_config_enum_values& ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
static t_config_enum_values keys_map = {
{"reprap", gcfRepRap},
{"reprapfirmware", gcfRepRap},
{"repetier", gcfRepetier},
{"teacup", gcfTeacup},
{"makerware", gcfMakerWare},
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/ConfigWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,10 @@ PageMaterials::PageMaterials(ConfigWizard *parent, Materials *materials, wxStrin
update_lists(evt.GetInt(), list_type->GetSelection(), list_vendor->GetSelection());
});
list_type->Bind(wxEVT_LISTBOX, [this](wxCommandEvent &) {
update_lists(list_printer->GetSelection(), list_type->GetSelection(), list_vendor->GetSelection());
update_lists(-1, list_type->GetSelection(), list_vendor->GetSelection());
});
list_vendor->Bind(wxEVT_LISTBOX, [this](wxCommandEvent &) {
update_lists(list_printer->GetSelection(), list_type->GetSelection(), list_vendor->GetSelection());
update_lists(-1, list_type->GetSelection(), list_vendor->GetSelection());
});

list_profile->Bind(wxEVT_CHECKLISTBOX, [this](wxCommandEvent &evt) { select_material(evt.GetInt()); });
Expand Down
50 changes: 28 additions & 22 deletions src/slic3r/GUI/GCodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,9 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
#if ENABLE_REDUCED_TOOLPATHS_SEGMENT_CAPS
for (const auto& [tbuffer_id, ibuffer_id, path_id, sub_path_id] : paths) {
TBuffer& buffer = const_cast<TBuffer&>(m_buffers[tbuffer_id]);
if (buffer.paths.size() <= path_id) return; // invalid data check
const Path& path = buffer.paths[path_id];
if (m_tool_colors.size() <= path.extruder_id) return; // invalid data check
#else
for (const auto& [buffer, ibuffer_id, path_id, sub_path_id] : paths) {
const Path& path = buffer->paths[path_id];
Expand Down Expand Up @@ -4192,15 +4194,17 @@ void GCodeViewer::render_legend() const
{
// shows only extruders actually used
for (unsigned char i : m_extruder_ids) {
append_item(EItemType::Rect, m_tool_colors[i], _u8L("Extruder") + " " + std::to_string(i + 1));
if(m_tool_colors.size() > i)
append_item(EItemType::Rect, m_tool_colors[i], _u8L("Extruder") + " " + std::to_string(i + 1));
}
break;
}
case EViewType::Filament:
{
// shows only filament actually used
for (unsigned char i : m_extruder_ids) {
append_item(EItemType::Rect, m_filament_colors[i], _u8L("Filament") + " " + std::to_string(i + 1));
if (m_filament_colors.size() > i)
append_item(EItemType::Rect, m_filament_colors[i], _u8L("Filament") + " " + std::to_string(i + 1));
}
break;
}
Expand Down Expand Up @@ -4232,28 +4236,30 @@ void GCodeViewer::render_legend() const
{
// shows only extruders actually used
for (unsigned char i : m_extruder_ids) {
std::vector<std::pair<Color, std::pair<double, double>>> cp_values = color_print_ranges(i, custom_gcode_per_print_z);
const int items_cnt = static_cast<int>(cp_values.size());
if (items_cnt == 0) { // There are no color changes, but there are some pause print or custom Gcode
append_item(EItemType::Rect, m_tool_colors[i], _u8L("Extruder") + " " + std::to_string(i + 1) + " " + _u8L("default color"));
}
else {
for (int j = items_cnt; j >= 0; --j) {
// create label for color change item
std::string label = _u8L("Extruder") + " " + std::to_string(i + 1);
if (j == 0) {
label += " " + upto_label(cp_values.front().second.first);
append_item(EItemType::Rect, m_tool_colors[i], label);
break;
}
else if (j == items_cnt) {
label += " " + above_label(cp_values[j - 1].second.second);
if (m_tool_colors.size() > i) {
std::vector<std::pair<Color, std::pair<double, double>>> cp_values = color_print_ranges(i, custom_gcode_per_print_z);
const int items_cnt = static_cast<int>(cp_values.size());
if (items_cnt == 0) { // There are no color changes, but there are some pause print or custom Gcode
append_item(EItemType::Rect, m_tool_colors[i], _u8L("Extruder") + " " + std::to_string(i + 1) + " " + _u8L("default color"));
}
else {
for (int j = items_cnt; j >= 0; --j) {
// create label for color change item
std::string label = _u8L("Extruder") + " " + std::to_string(i + 1);
if (j == 0) {
label += " " + upto_label(cp_values.front().second.first);
append_item(EItemType::Rect, m_tool_colors[i], label);
break;
}
else if (j == items_cnt) {
label += " " + above_label(cp_values[j - 1].second.second);
append_item(EItemType::Rect, cp_values[j - 1].first, label);
continue;
}

label += " " + fromto_label(cp_values[j - 1].second.second, cp_values[j].second.first);
append_item(EItemType::Rect, cp_values[j - 1].first, label);
continue;
}

label += " " + fromto_label(cp_values[j - 1].second.second, cp_values[j].second.first);
append_item(EItemType::Rect, cp_values[j - 1].first, label);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/slic3r/GUI/KBShortcutsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ void KBShortcutsDialog::fill_shortcuts()
{ "0-6", L("Camera view") },
{ "E", L("Show/Hide object/instance labels") },
// Configuration
#ifdef __APPLE__
{ ctrl + ",", L("Preferences") },
#else
{ ctrl + "P", L("Preferences") },
#endif
// Help
{ "?", L("Show keyboard shortcuts list") }
};
Expand Down
16 changes: 9 additions & 7 deletions src/slic3r/GUI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,9 @@ void MainFrame::on_sys_color_changed()
#ifdef _MSC_VER
// \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators,
// as the simple numeric accelerators spoil all numeric data entry.
static const wxString sep = "\t\xA0";
// note: same for letters
// note: don't work anymore, it doesn't show them to the right. Revert to " - "
static const wxString sep = " - ";//\t\xA0
static const wxString sep_space = "\xA0";
#else
static const wxString sep = " - ";
Expand Down Expand Up @@ -1129,7 +1131,7 @@ static wxMenu* generate_help_menu()

static void add_common_view_menu_items(wxMenu* view_menu, MainFrame* mainFrame, std::function<bool(void)> can_change_view)
{
// The camera control accelerators are captured by GLCanvas3D::on_char().
// The camera control accelerators are captured by GLCanvas3D::on_char(). So be sure to don't activate the accelerator by using '\t'
append_menu_item(view_menu, wxID_ANY, _L("Iso") + sep + "&0", _L("Iso View"), [mainFrame](wxCommandEvent&) { mainFrame->select_view("iso"); },
"", nullptr, [can_change_view]() { return can_change_view(); }, mainFrame);
view_menu->AppendSeparator();
Expand Down Expand Up @@ -1379,8 +1381,8 @@ void MainFrame::init_menubar_as_editor()

editMenu->AppendSeparator();
append_menu_item(editMenu, wxID_ANY, _L("Searc&h") + "\tCtrl+F",
_L("Search in settings"), [this](wxCommandEvent&) { m_plater->search(/*m_tabpanel->GetCurrentPage() == */m_plater->IsShown()); },
"search", nullptr, []() {return true; }, this);
_L("Search in settings"), [this](wxCommandEvent&) { m_plater->search(/*m_tabpanel->GetCurrentPage() == */m_plater->IsShown() && can_change_view()); },
"search", nullptr, []() { return true; }, this);
}

// Window menu
Expand Down Expand Up @@ -1425,9 +1427,9 @@ void MainFrame::init_menubar_as_editor()
viewMenu = new wxMenu();
add_common_view_menu_items(viewMenu, this, std::bind(&MainFrame::can_change_view, this));
viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &labels") + "\t" + "E", _L("Show object/instance labels in 3D scene"),
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this,
[this]() { return m_plater->is_view3D_shown() && can_change_view(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &labels") + sep + "&e", _L("Show object/instance labels in 3D scene"),
[this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); /* only called on clic, real event is handled by GLCanvas3D::on_char */ }, this,
[this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
append_menu_check_item(viewMenu, wxID_ANY, _L("&Collapse sidebar") + "\t" + "Shift+" + sep_space + "Tab", _L("Collapse sidebar"),
[this](wxCommandEvent&) { m_plater->collapse_sidebar(!m_plater->is_sidebar_collapsed()); }, this,
[this]() { return can_change_view(); }, [this]() { return m_plater->is_sidebar_collapsed(); }, this);
Expand Down
8 changes: 8 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5961,7 +5961,15 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
{
bool update_scheduled = false;
bool bed_shape_changed = false;
auto diffs = p->config->diff(config);
for (auto opt_key : p->config->diff(config)) {
if (opt_key == "nozzle_diameter") {
if (p->config->option<ConfigOptionFloats>(opt_key)->values.size() > config.option<ConfigOptionFloats>(opt_key)->values.size()) {
//lower number of extuders, please don't try to display the old gcode.
p->reset_gcode_toolpaths();
p->gcode_result.reset();
}
}
if (opt_key == "filament_colour")
{
update_scheduled = true; // update should be scheduled (for update 3DScene) #2738
Expand Down
33 changes: 24 additions & 9 deletions src/slic3r/GUI/PresetComboBoxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,16 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
// So, use GetSelection() from event parameter
auto selected_item = evt.GetSelection();

auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX)
this->SetSelection(this->m_last_selected);
else if (on_selection_changed && (m_last_selected != selected_item || m_collection->current_is_dirty())) {
m_last_selected = selected_item;
on_selection_changed(selected_item);
evt.StopPropagation();
//protected as selected_item is often at a weird value
if (selected_item < this->GetCount() && selected_item >= 0) {
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX)
this->SetSelection(this->m_last_selected);
else if (on_selection_changed && (m_last_selected != selected_item || m_collection->current_is_dirty())) {
m_last_selected = selected_item;
on_selection_changed(selected_item);
evt.StopPropagation();
}
}
evt.Skip();
});
Expand Down Expand Up @@ -451,6 +454,8 @@ wxBitmap* PresetComboBox::get_bmp( std::string bitmap_key, const std::string& m
bool PresetComboBox::is_selected_physical_printer()
{
auto selected_item = this->GetSelection();
if (selected_item >= this->GetCount() || selected_item < 0)
std::cout << "qfohadfh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
return marker == LABEL_ITEM_PHYSICAL_PRINTER;
}
Expand Down Expand Up @@ -572,6 +577,8 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &evt) {
auto selected_item = evt.GetSelection();

if (selected_item >= this->GetCount() || selected_item < 0)
std::cout << "qfoshiofh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) {
this->SetSelection(this->m_last_selected);
Expand Down Expand Up @@ -696,7 +703,14 @@ bool PlaterPresetComboBox::switch_to_tab()

wxGetApp().tab_panel()->SetSelection(page_id);
// Switch to Settings NotePad
wxGetApp().mainframe->select_tab(MainFrame::ETabType::LastSettings);
if(m_type == Preset::Type::TYPE_PRINT || m_type == Preset::Type::TYPE_SLA_PRINT)
wxGetApp().mainframe->select_tab(MainFrame::ETabType::PrintSettings);
else if (m_type == Preset::Type::TYPE_FILAMENT || m_type == Preset::Type::TYPE_SLA_MATERIAL)
wxGetApp().mainframe->select_tab(MainFrame::ETabType::FilamentSettings);
else if (m_type == Preset::Type::TYPE_PRINTER)
wxGetApp().mainframe->select_tab(MainFrame::ETabType::PrinterSettings);
else
wxGetApp().mainframe->select_tab(MainFrame::ETabType::LastSettings);
return true;
}

Expand Down Expand Up @@ -912,7 +926,8 @@ TabPresetComboBox::TabPresetComboBox(wxWindow* parent, Preset::Type preset_type)
// m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive.
// So, use GetSelection() from event parameter
auto selected_item = evt.GetSelection();

if (selected_item >= this->GetCount() || selected_item < 0)
std::cout << "qfoazfhasuiofh \n";
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item));
if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX) {
this->SetSelection(this->m_last_selected);
Expand Down

0 comments on commit 1bd0a1b

Please sign in to comment.