Synchronized mode of color_print data to/from 3mf/amf

+ Code refactoring " CustomGCode extracted to separate namespace and file
This commit is contained in:
YuSanka 2020-01-23 12:49:39 +01:00
parent 3d9ac0ada1
commit 1ed313ab79
19 changed files with 247 additions and 132 deletions

View file

@ -633,7 +633,7 @@ static int find_close_layer_idx(const std::vector<double>& zs, double &z, double
return -1;
}
void Preview::check_slider_values(std::vector<Model::CustomGCode>& ticks_from_model,
void Preview::check_slider_values(std::vector<CustomGCode::Item>& ticks_from_model,
const std::vector<double>& layers_z)
{
// All ticks that would end up outside the slider range should be erased.
@ -641,7 +641,7 @@ void Preview::check_slider_values(std::vector<Model::CustomGCode>& ticks_from_mo
// this function is e.g. not called when the last object is deleted
unsigned int old_size = ticks_from_model.size();
ticks_from_model.erase(std::remove_if(ticks_from_model.begin(), ticks_from_model.end(),
[layers_z](Model::CustomGCode val)
[layers_z](CustomGCode::Item val)
{
auto it = std::lower_bound(layers_z.begin(), layers_z.end(), val.print_z - DoubleSlider::epsilon());
return it == layers_z.end();
@ -669,7 +669,7 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
// Detect and set manipulation mode for double slider
update_double_slider_mode();
Model::CustomGCodeInfo &ticks_info_from_model = wxGetApp().plater()->model().custom_gcode_per_print_z;
CustomGCode::Info &ticks_info_from_model = wxGetApp().plater()->model().custom_gcode_per_print_z;
check_slider_values(ticks_info_from_model.gcodes, layers_z);
m_slider->SetSliderValues(layers_z);
@ -830,7 +830,7 @@ void Preview::load_print_as_fff(bool keep_z_range)
bool gcode_preview_data_valid = print->is_step_done(psGCodeExport) && ! m_gcode_preview_data->empty();
// Collect colors per extruder.
std::vector<std::string> colors;
std::vector<Model::CustomGCode> color_print_values = {};
std::vector<CustomGCode::Item> color_print_values = {};
// set color print values, if it si selected "ColorPrint" view type
if (m_gcode_preview_data->extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint)
{