Auto color change improvements: Show info notification just ones, if there is new print

This commit is contained in:
YuSanka 2021-03-17 17:10:19 +01:00
parent e054fe231e
commit a6cf840540
3 changed files with 24 additions and 4 deletions

View file

@ -424,6 +424,22 @@ void Control::SetExtruderColors( const std::vector<std::string>& extruder_colors
m_extruder_colors = extruder_colors;
}
bool Control::IsNewPrint()
{
if (GUI::wxGetApp().plater()->printer_technology() == ptSLA)
return false;
const Print& print = GUI::wxGetApp().plater()->fff_print();
std::string idxs;
for (auto object : print.objects())
idxs += std::to_string(object->id().id) + "_";
if (idxs == m_print_obj_idxs)
return false;
m_print_obj_idxs = idxs;
return true;
}
void Control::get_lower_and_higher_position(int& lower_pos, int& higher_pos)
{
const double step = get_scroll_step();

View file

@ -233,6 +233,8 @@ public:
void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder);
void SetExtruderColors(const std::vector<std::string>& extruder_colors);
bool IsNewPrint();
void set_render_as_disabled(bool value) { m_render_as_disabled = value; }
bool is_rendering_as_disabled() const { return m_render_as_disabled; }
@ -395,6 +397,7 @@ private:
TickCodeInfo m_ticks;
std::vector<double> m_layers_times;
std::vector<std::string> m_extruder_colors;
std::string m_print_obj_idxs;
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
std::vector<double> m_alternate_values;

View file

@ -1,3 +1,4 @@
//#include "stdlib.h"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Layer.hpp"
#include "GUI_Preview.hpp"
@ -642,10 +643,10 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
m_layers_slider->SetLayersTimes(m_gcode_result->time_statistics.modes.front().layers_times);
// Suggest the auto color change, if model looks like sign
if (ticks_info_from_model.gcodes.empty())
if (m_layers_slider->IsNewPrint())
{
NotificationManager* notif_mngr = wxGetApp().plater()->get_notification_manager();
notif_mngr->close_notification_of_type(NotificationType::SignDetected);
// notif_mngr->close_notification_of_type(NotificationType::SignDetected);
const Print& print = wxGetApp().plater()->fff_print();
double delta_area = scale_(scale_(25)); // equal to 25 mm2
@ -658,8 +659,8 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
continue;
const ExPolygons& bottom = object->get_layer(0)->lslices;
if (bottom.size() > 1 || !bottom[0].holes.empty())
continue;
//if (bottom.size() > 1 || !bottom[0].holes.empty())
// continue;
double bottom_area = area(bottom);
int i;