Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2020-02-20 19:32:46 +0300
committerYuSanka <yusanka@gmail.com>2020-02-20 19:33:43 +0300
commit487ac0423e1dc254bd93ab34b133acf8d4036a88 (patch)
treefbf70555c17e70930f0dfb1ce749d1bc9b9a3766 /src/slic3r/GUI
parent90a8076d25626a05a94abdb8409ca09493079e54 (diff)
Implemented time estimation for PausePrint (#3544)
DoubleSlider: fixed get_color_for_color_change_tick()
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r--src/slic3r/GUI/DoubleSlider.cpp4
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp7
-rw-r--r--src/slic3r/GUI/Plater.cpp41
3 files changed, 38 insertions, 14 deletions
diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp
index 357c143c4..9afbb73ed 100644
--- a/src/slic3r/GUI/DoubleSlider.cpp
+++ b/src/slic3r/GUI/DoubleSlider.cpp
@@ -696,9 +696,11 @@ std::string Control::get_color_for_color_change_tick(std::set<TickCode>::const_i
if (it_n->gcode == ToolChangeCode) {
is_tool_change = true;
if (it_n->extruder == it->extruder)
- return m_extruder_colors[it->extruder-1]; // return a color for a specific extruder from the colors list
+ return it->color;
break;
}
+ if (it_n->gcode == ColorChangeCode && it_n->extruder == it->extruder)
+ return it->color;
}
if (!is_tool_change && it->extruder == def_extruder)
return it->color;
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index b5319a2f1..496de1d54 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -982,12 +982,17 @@ void GLCanvas3D::LegendTexture::fill_color_print_legend_items( const GLCanvas3D
cp_legend_items.emplace_back(I18N::translate_utf8(L("Pause print or custom G-code")));
int cnt = custom_gcode_per_print_z.size();
+ int color_change_idx = color_cnt - extruders_cnt;
for (int i = cnt-1; i >= 0; --i)
if (custom_gcode_per_print_z[i].gcode == ColorChangeCode) {
::memcpy((void*)(colors.data() + color_pos), (const void*)(colors_in.data() + color_in_pos), 4 * sizeof(float));
color_pos += 4;
color_in_pos -= 4;
- cp_legend_items.emplace_back((boost::format(I18N::translate_utf8(L("Color change for Extruder %d at %.2f mm"))) % custom_gcode_per_print_z[i].extruder % custom_gcode_per_print_z[i].print_z).str());
+
+ // create label for color change item
+ std::string id_str = std::to_string(color_change_idx--) + ": ";
+
+ cp_legend_items.emplace_back(id_str + (boost::format(I18N::translate_utf8(L("Color change for Extruder %d at %.2f mm"))) % custom_gcode_per_print_z[i].extruder % custom_gcode_per_print_z[i].print_z).str());
}
}
}
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index bc28b62e0..8296e15d5 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -1252,23 +1252,40 @@ void Sidebar::update_sliced_info_sizer()
else {
new_label = _(L("Estimated printing time")) +" :";
info_text = "";
- if (ps.estimated_normal_print_time != "N/A") {
- new_label += wxString::Format("\n - %s", _(L("normal mode")));
- info_text += wxString::Format("\n%s", ps.estimated_normal_print_time);
- for (int i = (int)ps.estimated_normal_color_print_times.size() - 1; i >= 0; --i)
+ wxString str_color = _(L("Color"));
+ wxString str_pause = _(L("Pause"));
+
+ auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGcodeType, std::string>>& times,
+ wxString& new_label, wxString& info_text)
+ {
+ int color_change_count = 0;
+ for (auto time : times)
+ if (time.first == cgtColorChange)
+ color_change_count++;
+
+ for (int i = (int)times.size() - 1; i >= 0; --i)
{
- new_label += wxString::Format("\n - %s%d", _(L("Color")) + " ", i + 1);
- info_text += wxString::Format("\n%s", ps.estimated_normal_color_print_times[i]);
+ if (i == 0 || times[i - 1].first == cgtPausePrint)
+ new_label += wxString::Format("\n - %s%d", str_color + " ", color_change_count);
+ else if (times[i - 1].first == cgtColorChange)
+ new_label += wxString::Format("\n - %s%d", str_color + " ", color_change_count--);
+
+ if (i != (int)times.size() - 1 && times[i].first == cgtPausePrint)
+ new_label += wxString::Format(" -> %s", str_pause);
+
+ info_text += wxString::Format("\n%s", times[i].second);
}
+ };
+
+ if (ps.estimated_normal_print_time != "N/A") {
+ new_label += wxString::Format("\n - %s", _(L("normal mode")));
+ info_text += wxString::Format("\n%s", ps.estimated_normal_print_time);
+ fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
}
if (ps.estimated_silent_print_time != "N/A") {
- new_label += wxString::Format("\n - %s", _(L("stealth mode")));
+ new_label += wxString::Format("\n - %s", _(L("stealth mode")));
info_text += wxString::Format("\n%s", ps.estimated_silent_print_time);
- for (int i = (int)ps.estimated_silent_color_print_times.size() - 1; i >= 0; --i)
- {
- new_label += wxString::Format("\n - %s%d", _(L("Color")) + " ", i + 1);
- info_text += wxString::Format("\n%s", ps.estimated_silent_color_print_times[i]);
- }
+ fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
}
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
}