FIX: add set to Optimal button
2. modify the manual mode of filament_dialog jira: none Change-Id: I2ce6834eb65de2da70e7649346fc88b90f280b29 Change-Id: I18448e800fe3338f045d35f7a1fa6c3e3c8eef79
This commit is contained in:
parent
21379e1336
commit
5dce0ebc06
|
@ -6,9 +6,11 @@
|
|||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
const wxString manual_tips = _L("You can drag the filaments to change which extruder they are assigned to,\n"
|
||||
"and we will slice according to this grouping method.\n"
|
||||
"But your filament arrangement may not be the most filament-efficient.");
|
||||
const wxString manual_tips = _L("we will slice according to this grouping method:");
|
||||
|
||||
const wxString manual_below_tips = _L("Tips:\n"
|
||||
"You can drag the filaments to change which extruder they are assigned to.\n"
|
||||
"But your filament arrangement may not be the most filament-efficient.");
|
||||
|
||||
const wxString auto_tips = _L("Automatic filament grouping will be performed to reduce flushing consumption\n"
|
||||
"and filament changes during the slicing process.\n"
|
||||
|
@ -146,10 +148,15 @@ FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
|||
|
||||
main_sizer->Add(m_extruder_panel_sizer, 1, wxEXPAND | wxALL, 10);
|
||||
|
||||
m_below_tip_text = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||
m_below_tip_text->SetLabel(manual_below_tips);
|
||||
main_sizer->Add(m_below_tip_text, 0, wxALIGN_LEFT | wxLEFT, 15);
|
||||
|
||||
if (is_auto) {
|
||||
m_manual_left_panel->Hide();
|
||||
m_manual_right_panel->Hide();
|
||||
m_switch_filament_btn->Hide();
|
||||
m_below_tip_text->Hide();
|
||||
if (m_has_auto_result) {
|
||||
m_tip_text->SetLabel(auto_tips_with_result);
|
||||
}
|
||||
|
@ -165,6 +172,7 @@ FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
|||
m_auto_right_panel->Hide();
|
||||
m_switch_filament_btn_auto->Hide();
|
||||
m_tip_text->SetLabel(manual_tips);
|
||||
m_below_tip_text->Show();
|
||||
}
|
||||
|
||||
wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -222,6 +230,7 @@ void FilamentMapDialog::on_switch_mode(wxCommandEvent &event)
|
|||
m_manual_left_panel->Hide();
|
||||
m_manual_right_panel->Hide();
|
||||
m_switch_filament_btn->Hide();
|
||||
m_below_tip_text->Hide();
|
||||
if (m_has_auto_result) {
|
||||
m_auto_left_panel->Show();
|
||||
m_auto_right_panel->Show();
|
||||
|
@ -238,6 +247,7 @@ void FilamentMapDialog::on_switch_mode(wxCommandEvent &event)
|
|||
m_manual_left_panel->Show();
|
||||
m_manual_right_panel->Show();
|
||||
m_switch_filament_btn->Show();
|
||||
m_below_tip_text->Show();
|
||||
|
||||
m_auto_left_panel->Hide();
|
||||
m_auto_right_panel->Hide();
|
||||
|
|
|
@ -39,6 +39,7 @@ private:
|
|||
|
||||
private:
|
||||
wxStaticText * m_tip_text;
|
||||
wxStaticText * m_below_tip_text;
|
||||
SwitchButton * m_mode_switch_btn;
|
||||
wxBoxSizer * m_extruder_panel_sizer;
|
||||
DragDropPanel* m_manual_left_panel;
|
||||
|
|
|
@ -4630,6 +4630,36 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
|||
}
|
||||
};
|
||||
|
||||
auto link_text_set_to_optional = [&](const std::string &label) {
|
||||
ImVec2 wiki_part_size = ImGui::CalcTextSize(label.c_str());
|
||||
|
||||
ImColor HyperColor = ImColor(48, 221, 114, 255).Value;
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
|
||||
imgui.text(label.c_str());
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
// click behavior
|
||||
if (ImGui::IsMouseHoveringRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), true)) {
|
||||
// underline
|
||||
ImVec2 lineEnd = ImGui::GetItemRectMax();
|
||||
lineEnd.y -= 2.0f;
|
||||
ImVec2 lineStart = lineEnd;
|
||||
lineStart.x = ImGui::GetItemRectMin().x;
|
||||
ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd, HyperColor);
|
||||
|
||||
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
|
||||
MessageDialog msg_dlg(nullptr, _L("Automatically re-slice according to the optimal filament arrangement, and the arrangement results will be displayed after slicing."), wxEmptyString, wxOK | wxCANCEL);
|
||||
if (msg_dlg.ShowModal() == wxID_OK) {
|
||||
PartPlateList &partplate_list = wxGetApp().plater()->get_partplate_list();
|
||||
PartPlate *plate = partplate_list.get_curr_plate();
|
||||
plate->set_filament_map_mode(FilamentMapMode::fmmAuto);
|
||||
Plater *plater = wxGetApp().plater();
|
||||
wxPostEvent(plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
////BBS Color Arrangement Recommendation
|
||||
|
||||
auto config = wxGetApp().plater()->get_partplate_list().get_current_fff_print().config();
|
||||
|
@ -4704,6 +4734,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
|||
ImGui::PopStyleVar(1);
|
||||
ImGui::Dummy({window_padding, window_padding});
|
||||
|
||||
bool is_optimal_group = true;
|
||||
if (filament_map_mode == fmmAuto) {
|
||||
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
|
||||
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
||||
|
@ -4716,6 +4747,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
|||
int more_time = stats_by_extruder.stats_by_multi_extruder_manual.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
||||
|
||||
if (more_cost > EPSILON || more_time > 0) {
|
||||
is_optimal_group = false;
|
||||
ImVec4 orangeColor = ImVec4(1.0f, 0.5f, 0.0f, 1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, orangeColor);
|
||||
imgui.text(_u8L("This arrangement is not optimal."));
|
||||
|
@ -4732,6 +4764,10 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
|||
}
|
||||
|
||||
ImGui::Dummy({window_padding, window_padding});
|
||||
if (!is_optimal_group) {
|
||||
link_text_set_to_optional(_u8L("Set to Optimal"));
|
||||
ImGui::SameLine();
|
||||
}
|
||||
link_text(_u8L("Rearrange filament"));
|
||||
|
||||
ImGui::EndChild();
|
||||
|
|
Loading…
Reference in New Issue