Merge remote-tracking branch 'origin/master' into ys_new_features
This commit is contained in:
commit
e4d8c5410c
@ -1405,7 +1405,9 @@ void GCode::process_layer(
|
|||||||
m_colorprint_heights.erase(m_colorprint_heights.begin());
|
m_colorprint_heights.erase(m_colorprint_heights.begin());
|
||||||
colorprint_change = true;
|
colorprint_change = true;
|
||||||
}
|
}
|
||||||
if (colorprint_change && print.extruders().size()==1)
|
|
||||||
|
// we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count
|
||||||
|
if (colorprint_change && print./*extruders()*/config().nozzle_diameter.size()==1)
|
||||||
gcode += "M600\n";
|
gcode += "M600\n";
|
||||||
|
|
||||||
|
|
||||||
|
@ -547,9 +547,9 @@ TriangleMesh TriangleMesh::convex_hull_3d() const
|
|||||||
#if REALfloat
|
#if REALfloat
|
||||||
qhull.runQhull("", 3, (int)this->its.vertices.size(), (const realT*)(this->its.vertices.front().data()), "Qt");
|
qhull.runQhull("", 3, (int)this->its.vertices.size(), (const realT*)(this->its.vertices.front().data()), "Qt");
|
||||||
#else
|
#else
|
||||||
src_vertices.reserve(this->its.vertices() * 3);
|
src_vertices.reserve(this->its.vertices.size() * 3);
|
||||||
// We will now fill the vector with input points for computation:
|
// We will now fill the vector with input points for computation:
|
||||||
for (const stl_vertex &v : ths->its.vertices.size())
|
for (const stl_vertex &v : this->its.vertices)
|
||||||
for (int i = 0; i < 3; ++ i)
|
for (int i = 0; i < 3; ++ i)
|
||||||
src_vertices.emplace_back(v(i));
|
src_vertices.emplace_back(v(i));
|
||||||
qhull.runQhull("", 3, (int)src_vertices.size() / 3, src_vertices.data(), "Qt");
|
qhull.runQhull("", 3, (int)src_vertices.size() / 3, src_vertices.data(), "Qt");
|
||||||
|
@ -44,8 +44,8 @@ public:
|
|||||||
const float* get_vertices_data() const;
|
const float* get_vertices_data() const;
|
||||||
unsigned int get_vertices_data_size() const { return (unsigned int)m_vertices.size() * get_vertex_data_size(); }
|
unsigned int get_vertices_data_size() const { return (unsigned int)m_vertices.size() * get_vertex_data_size(); }
|
||||||
unsigned int get_vertex_data_size() const { return (unsigned int)(5 * sizeof(float)); }
|
unsigned int get_vertex_data_size() const { return (unsigned int)(5 * sizeof(float)); }
|
||||||
unsigned int get_position_offset() const { return 0; }
|
size_t get_position_offset() const { return 0; }
|
||||||
unsigned int get_tex_coords_offset() const { return (unsigned int)(3 * sizeof(float)); }
|
size_t get_tex_coords_offset() const { return (size_t)(3 * sizeof(float)); }
|
||||||
unsigned int get_vertices_count() const { return (unsigned int)m_vertices.size(); }
|
unsigned int get_vertices_count() const { return (unsigned int)m_vertices.size(); }
|
||||||
#else
|
#else
|
||||||
const float* get_vertices() const { return m_vertices.data(); }
|
const float* get_vertices() const { return m_vertices.data(); }
|
||||||
|
@ -53,15 +53,12 @@ void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||||||
|
|
||||||
void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
||||||
{
|
{
|
||||||
// on_change(nullptr);
|
auto sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, _(L("Shape")));
|
||||||
|
|
||||||
auto box = new wxStaticBox(this, wxID_ANY, _(L("Shape")));
|
|
||||||
auto sbsizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
|
||||||
|
|
||||||
// shape options
|
// shape options
|
||||||
m_shape_options_book = new wxChoicebook(this, wxID_ANY, wxDefaultPosition,
|
m_shape_options_book = new wxChoicebook(this, wxID_ANY, wxDefaultPosition,
|
||||||
wxSize(25*wxGetApp().em_unit(), -1), wxCHB_TOP);
|
wxSize(25*wxGetApp().em_unit(), -1), wxCHB_TOP);
|
||||||
sbsizer->Add(m_shape_options_book);
|
sbsizer->Add(m_shape_options_book);
|
||||||
|
|
||||||
auto optgroup = init_shape_options_page(_(L("Rectangular")));
|
auto optgroup = init_shape_options_page(_(L("Rectangular")));
|
||||||
ConfigOptionDef def;
|
ConfigOptionDef def;
|
||||||
@ -92,13 +89,15 @@ void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
|||||||
Line line{ "", "" };
|
Line line{ "", "" };
|
||||||
line.full_width = 1;
|
line.full_width = 1;
|
||||||
line.widget = [this](wxWindow* parent) {
|
line.widget = [this](wxWindow* parent) {
|
||||||
auto btn = new wxButton(parent, wxID_ANY, _(L("Load shape from STL...")), wxDefaultPosition, wxDefaultSize);
|
auto shape_btn = new wxButton(parent, wxID_ANY, _(L("Load shape from STL...")));
|
||||||
|
wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
shape_sizer->Add(shape_btn, 1, wxEXPAND);
|
||||||
sizer->Add(btn);
|
|
||||||
|
|
||||||
btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e)
|
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
{
|
sizer->Add(shape_sizer, 1, wxEXPAND);
|
||||||
|
|
||||||
|
shape_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e)
|
||||||
|
{
|
||||||
load_stl();
|
load_stl();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -106,8 +105,8 @@ void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
|||||||
};
|
};
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
|
||||||
Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent e)
|
Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
update_shape();
|
update_shape();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -117,8 +116,8 @@ void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
|||||||
|
|
||||||
// main sizer
|
// main sizer
|
||||||
auto top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
top_sizer->Add(sbsizer, 0, wxEXPAND | wxLeft | wxTOP | wxBOTTOM, 10);
|
top_sizer->Add(sbsizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 10);
|
||||||
if (m_canvas)
|
if (m_canvas)
|
||||||
top_sizer->Add(m_canvas, 1, wxEXPAND | wxALL, 10) ;
|
top_sizer->Add(m_canvas, 1, wxEXPAND | wxALL, 10) ;
|
||||||
|
|
||||||
SetSizerAndFit(top_sizer);
|
SetSizerAndFit(top_sizer);
|
||||||
@ -135,8 +134,7 @@ void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
|
|||||||
// Create a panel for a rectangular / circular / custom bed shape.
|
// Create a panel for a rectangular / circular / custom bed shape.
|
||||||
ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& title)
|
ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& title)
|
||||||
{
|
{
|
||||||
|
auto panel = new wxPanel(m_shape_options_book);
|
||||||
auto panel = new wxPanel(m_shape_options_book);
|
|
||||||
ConfigOptionsGroupShp optgroup;
|
ConfigOptionsGroupShp optgroup;
|
||||||
optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Settings")));
|
optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Settings")));
|
||||||
|
|
||||||
@ -234,8 +232,8 @@ void BedShapePanel::set_shape(ConfigOptionPoints* points)
|
|||||||
// This is a custom bed shape, use the polygon provided.
|
// This is a custom bed shape, use the polygon provided.
|
||||||
m_shape_options_book->SetSelection(SHAPE_CUSTOM);
|
m_shape_options_book->SetSelection(SHAPE_CUSTOM);
|
||||||
// Copy the polygon to the canvas, make a copy of the array.
|
// Copy the polygon to the canvas, make a copy of the array.
|
||||||
m_canvas->m_bed_shape = points->values;
|
m_loaded_bed_shape = points->values;
|
||||||
update_shape();
|
update_shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BedShapePanel::update_preview()
|
void BedShapePanel::update_preview()
|
||||||
|
@ -912,7 +912,8 @@ GLCanvas3D::LegendTexture::LegendTexture()
|
|||||||
void GLCanvas3D::LegendTexture::fill_color_print_legend_values(const GCodePreviewData& preview_data, const GLCanvas3D& canvas,
|
void GLCanvas3D::LegendTexture::fill_color_print_legend_values(const GCodePreviewData& preview_data, const GLCanvas3D& canvas,
|
||||||
std::vector<std::pair<double, double>>& cp_legend_values)
|
std::vector<std::pair<double, double>>& cp_legend_values)
|
||||||
{
|
{
|
||||||
if (preview_data.extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint)
|
if (preview_data.extrusion.view_type == GCodePreviewData::Extrusion::ColorPrint &&
|
||||||
|
wxGetApp().extruders_edited_cnt() == 1) // show color change legend only for single-material presets
|
||||||
{
|
{
|
||||||
auto& config = wxGetApp().preset_bundle->project_config;
|
auto& config = wxGetApp().preset_bundle->project_config;
|
||||||
const std::vector<double>& color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
|
const std::vector<double>& color_print_values = config.option<ConfigOptionFloats>("colorprint_heights")->values;
|
||||||
|
@ -541,6 +541,26 @@ void Preview::on_checkbox_shells(wxCommandEvent& evt)
|
|||||||
refresh_print();
|
refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preview::update_view_type()
|
||||||
|
{
|
||||||
|
const DynamicPrintConfig& config = wxGetApp().preset_bundle->project_config;
|
||||||
|
|
||||||
|
const wxString& choice = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty() &&
|
||||||
|
wxGetApp().extruders_edited_cnt()==1 ?
|
||||||
|
_(L("Color Print")) :
|
||||||
|
config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1 ?
|
||||||
|
_(L("Tool")) :
|
||||||
|
_(L("Feature type"));
|
||||||
|
|
||||||
|
int type = m_choice_view_type->FindString(choice);
|
||||||
|
if (m_choice_view_type->GetSelection() != type) {
|
||||||
|
m_choice_view_type->SetSelection(type);
|
||||||
|
if (0 <= type && type < (int)GCodePreviewData::Extrusion::Num_View_Types)
|
||||||
|
m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
|
||||||
|
m_preferred_color_mode = "feature";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Preview::create_double_slider()
|
void Preview::create_double_slider()
|
||||||
{
|
{
|
||||||
m_slider = new DoubleSlider(this, wxID_ANY, 0, 0, 0, 100);
|
m_slider = new DoubleSlider(this, wxID_ANY, 0, 0, 0, 100);
|
||||||
@ -553,23 +573,13 @@ void Preview::create_double_slider()
|
|||||||
|
|
||||||
|
|
||||||
Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) {
|
Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) {
|
||||||
auto& config = wxGetApp().preset_bundle->project_config;
|
wxGetApp().preset_bundle->project_config.option<ConfigOptionFloats>("colorprint_heights")->values = m_slider->GetTicksValues();
|
||||||
((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues());
|
m_schedule_background_process();
|
||||||
m_schedule_background_process();
|
|
||||||
|
|
||||||
const wxString& choise = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty() ? _(L("Color Print")) :
|
update_view_type();
|
||||||
config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1 ?
|
|
||||||
_(L("Tool")) : _(L("Feature type"));
|
|
||||||
|
|
||||||
int type = m_choice_view_type->FindString(choise);
|
reload_print();
|
||||||
if (m_choice_view_type->GetSelection() != type) {
|
});
|
||||||
m_choice_view_type->SetSelection(type);
|
|
||||||
if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types))
|
|
||||||
m_gcode_preview_data->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
|
|
||||||
m_preferred_color_mode = "feature";
|
|
||||||
}
|
|
||||||
reload_print();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find an index of a value in a sorted vector, which is in <z-eps, z+eps>.
|
// Find an index of a value in a sorted vector, which is in <z-eps, z+eps>.
|
||||||
@ -787,9 +797,14 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
|||||||
// Load the real G-code preview.
|
// Load the real G-code preview.
|
||||||
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
} else
|
} else {
|
||||||
|
// disable color change information for multi-material presets
|
||||||
|
if (wxGetApp().extruders_edited_cnt() > 1)
|
||||||
|
color_print_values.clear();
|
||||||
|
|
||||||
// Load the initial preview based on slices, not the final G-code.
|
// Load the initial preview based on slices, not the final G-code.
|
||||||
m_canvas->load_preview(colors, color_print_values);
|
m_canvas->load_preview(colors, color_print_values);
|
||||||
|
}
|
||||||
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
|
||||||
// recalculates zs and update sliders accordingly
|
// recalculates zs and update sliders accordingly
|
||||||
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
std::vector<double> zs = m_canvas->get_current_print_zs(true);
|
||||||
|
@ -127,6 +127,8 @@ public:
|
|||||||
void move_double_slider(wxKeyEvent& evt);
|
void move_double_slider(wxKeyEvent& evt);
|
||||||
void edit_double_slider(wxKeyEvent& evt);
|
void edit_double_slider(wxKeyEvent& evt);
|
||||||
|
|
||||||
|
void update_view_type();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model);
|
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model);
|
||||||
|
|
||||||
|
@ -3970,6 +3970,9 @@ void Plater::reslice()
|
|||||||
}
|
}
|
||||||
else if (!p->background_process.empty() && !p->background_process.idle())
|
else if (!p->background_process.empty() && !p->background_process.idle())
|
||||||
p->show_action_buttons(true);
|
p->show_action_buttons(true);
|
||||||
|
|
||||||
|
// update type of preview
|
||||||
|
p->preview->update_view_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::reslice_SLA_supports(const ModelObject &object)
|
void Plater::reslice_SLA_supports(const ModelObject &object)
|
||||||
|
@ -2225,6 +2225,9 @@ void DoubleSlider::draw_thumbs(wxDC& dc, const wxCoord& lower_pos, const wxCoord
|
|||||||
|
|
||||||
void DoubleSlider::draw_ticks(wxDC& dc)
|
void DoubleSlider::draw_ticks(wxDC& dc)
|
||||||
{
|
{
|
||||||
|
if (!m_is_enabled_tick_manipulation)
|
||||||
|
return;
|
||||||
|
|
||||||
dc.SetPen(m_is_enabled_tick_manipulation ? DARK_GREY_PEN : LIGHT_GREY_PEN );
|
dc.SetPen(m_is_enabled_tick_manipulation ? DARK_GREY_PEN : LIGHT_GREY_PEN );
|
||||||
int height, width;
|
int height, width;
|
||||||
get_size(&width, &height);
|
get_size(&width, &height);
|
||||||
@ -2242,6 +2245,9 @@ void DoubleSlider::draw_ticks(wxDC& dc)
|
|||||||
|
|
||||||
void DoubleSlider::draw_colored_band(wxDC& dc)
|
void DoubleSlider::draw_colored_band(wxDC& dc)
|
||||||
{
|
{
|
||||||
|
if (!m_is_enabled_tick_manipulation)
|
||||||
|
return;
|
||||||
|
|
||||||
int height, width;
|
int height, width;
|
||||||
get_size(&width, &height);
|
get_size(&width, &height);
|
||||||
|
|
||||||
@ -2311,7 +2317,7 @@ void DoubleSlider::draw_one_layer_icon(wxDC& dc)
|
|||||||
|
|
||||||
void DoubleSlider::draw_revert_icon(wxDC& dc)
|
void DoubleSlider::draw_revert_icon(wxDC& dc)
|
||||||
{
|
{
|
||||||
if (m_ticks.empty())
|
if (m_ticks.empty() || !m_is_enabled_tick_manipulation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
@ -2416,7 +2422,7 @@ void DoubleSlider::OnLeftDown(wxMouseEvent& event)
|
|||||||
m_selection == ssLower ? correct_lower_value() : correct_higher_value();
|
m_selection == ssLower ? correct_lower_value() : correct_higher_value();
|
||||||
if (!m_selection) m_selection = ssHigher;
|
if (!m_selection) m_selection = ssHigher;
|
||||||
}
|
}
|
||||||
else if (is_point_in_rect(pos, m_rect_revert_icon)) {
|
else if (is_point_in_rect(pos, m_rect_revert_icon) && m_is_enabled_tick_manipulation) {
|
||||||
// discard all color changes
|
// discard all color changes
|
||||||
SetLowerValue(m_min_value);
|
SetLowerValue(m_min_value);
|
||||||
SetHigherValue(m_max_value);
|
SetHigherValue(m_max_value);
|
||||||
|
@ -402,15 +402,8 @@ Updates PresetUpdater::priv::get_config_updates() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_file_fix(idx.path(), bundle_path_idx);
|
|
||||||
|
|
||||||
const auto ver_current = idx.find(vp.config_version);
|
const auto ver_current = idx.find(vp.config_version);
|
||||||
const bool ver_current_found = ver_current != idx.end();
|
const bool ver_current_found = ver_current != idx.end();
|
||||||
if (! ver_current_found) {
|
|
||||||
auto message = (boost::format("Preset bundle `%1%` version not found in index: %2%") % idx.vendor() % vp.config_version.to_string()).str();
|
|
||||||
BOOST_LOG_TRIVIAL(error) << message;
|
|
||||||
GUI::show_error(nullptr, GUI::from_u8(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << boost::format("Vendor: %1%, version installed: %2%%3%, version cached: %4%")
|
BOOST_LOG_TRIVIAL(debug) << boost::format("Vendor: %1%, version installed: %2%%3%, version cached: %4%")
|
||||||
% vp.name
|
% vp.name
|
||||||
@ -418,6 +411,13 @@ Updates PresetUpdater::priv::get_config_updates() const
|
|||||||
% (ver_current_found ? "" : " (not found in index!)")
|
% (ver_current_found ? "" : " (not found in index!)")
|
||||||
% recommended->config_version.to_string();
|
% recommended->config_version.to_string();
|
||||||
|
|
||||||
|
if (! ver_current_found) {
|
||||||
|
auto message = (boost::format("Preset bundle `%1%` version not found in index: %2%") % idx.vendor() % vp.config_version.to_string()).str();
|
||||||
|
BOOST_LOG_TRIVIAL(error) << message;
|
||||||
|
GUI::show_error(nullptr, GUI::from_u8(message));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ver_current_found && !ver_current->is_current_slic3r_supported()) {
|
if (ver_current_found && !ver_current->is_current_slic3r_supported()) {
|
||||||
BOOST_LOG_TRIVIAL(warning) << "Current Slic3r incompatible with installed bundle: " << bundle_path.string();
|
BOOST_LOG_TRIVIAL(warning) << "Current Slic3r incompatible with installed bundle: " << bundle_path.string();
|
||||||
updates.incompats.emplace_back(std::move(bundle_path), *ver_current, vp.name);
|
updates.incompats.emplace_back(std::move(bundle_path), *ver_current, vp.name);
|
||||||
@ -459,10 +459,16 @@ Updates PresetUpdater::priv::get_config_updates() const
|
|||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! found)
|
|
||||||
|
if (found) {
|
||||||
|
// 'Install' the index in the vendor directory. This is used to memoize
|
||||||
|
// offered updates and to not offer the same update again if it was cancelled by the user.
|
||||||
|
copy_file_fix(idx.path(), bundle_path_idx);
|
||||||
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update (%2%) but the new bundle was found neither in cache nor resources")
|
BOOST_LOG_TRIVIAL(warning) << boost::format("Index for vendor %1% indicates update (%2%) but the new bundle was found neither in cache nor resources")
|
||||||
% idx.vendor()
|
% idx.vendor()
|
||||||
% recommended->config_version.to_string();
|
% recommended->config_version.to_string();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user