diff options
m--------- | resources/profiles | 0 | ||||
-rw-r--r-- | src/libslic3r/Preset.cpp | 1 | ||||
-rw-r--r-- | src/libslic3r/Preset.hpp | 1 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 48 | ||||
-rw-r--r-- | src/slic3r/GUI/3DBed.cpp | 37 | ||||
-rw-r--r-- | src/slic3r/GUI/3DBed.hpp | 3 | ||||
-rw-r--r-- | src/slic3r/GUI/Tab.cpp | 3 |
7 files changed, 74 insertions, 19 deletions
diff --git a/resources/profiles b/resources/profiles -Subproject 0b8261ae8bbd7c31d736f371323476d6aff3ef3 +Subproject 90f4b1c3026c5086b7eb416623512b26b158a6e diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 69236cfe3..c39a1b0da 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -227,6 +227,7 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem } model.bed_model = section.second.get<std::string>("bed_model", ""); model.bed_texture = section.second.get<std::string>("bed_texture", ""); + model.bed_with_grid = section.second.get<std::string>("bed_with_grid", "") == "1"; model.thumbnail = section.second.get<std::string>("thumbnail", ""); //save it diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index 306d7c923..09c20235a 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -57,6 +57,7 @@ public: // Vendor & Printer Model specific print bed model & texture. std::string bed_model; std::string bed_texture; + bool bed_with_grid; std::string thumbnail; PrinterVariant* variant(const std::string &name) { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e5c59b01b..69fab238b 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2443,7 +2443,7 @@ void PrintConfigDef::init_fff_params() def->ratio_over = "depends"; def->min = 0; def->mode = comExpert | comSuSi; - def->set_default_value(new ConfigOptionFloatOrPercent(30, false)); + def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); def = this->add("first_layer_min_speed", coFloat); def->label = L("Min"); @@ -6726,10 +6726,11 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va } if (opt_key == "seam_position") { if (value == "hidden") { - opt_key = "seam_travel_cost"; - value = "20%"; - }else if ("near" == value || "nearest" == value ) value = "cost"; + } else if ("near" == value || "nearest" == value) { + value = "cost"; + //FIXME can we change the cost? + } } if (opt_key == "perimeter_loop_seam") { if (value == "hidden") { @@ -6845,6 +6846,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va } // this is for extra things to add / modify from prusa that can't be handled otherwise. +// after handle_legacy std::map<std::string,std::string> PrintConfigDef::from_prusa(t_config_option_key& opt_key, std::string& value, const DynamicConfig& all_conf) { std::map<std::string, std::string> output; if ("toolchange_gcode" == opt_key) { @@ -6876,6 +6878,28 @@ std::map<std::string,std::string> PrintConfigDef::from_prusa(t_config_option_key output["brim_width_interior"] = all_conf.get_computed_value("brim_width"); } } + if ("support_material_contact_distance" == 0) { + output["support_material_contact_distance_type"] = "none"; + } + if (opt_key == "seam_position") { + if ("cost" == value ) { // eqauls to "near" == value || "nearest" == value + output["seam_angle_cost"] = "50%"; + output["seam_travel_cost"] = "50%"; + } + } + if ("bridge_type" == opt_key) { // seems like thick_bridge to 0 + if (value == "flow") { + output["bridge_overlap_min"] = "60%"; + output["bridge_overlap"] = "75%"; + } + } + if ("first_layer_height" == opt_key) { + if (!value.empty() && value.back() == '%') { + // A first_layer_height isn't a % of layer_height but from nozzle_diameter now! + // can't really convert right now, so put it at a safe value liek 50%. + value = "50%"; + } + } return output; } @@ -6884,6 +6908,7 @@ template<typename CONFIG_CLASS> void _convert_from_prusa(CONFIG_CLASS& conf, const DynamicPrintConfig& global_config) { //void convert_from_prusa(DynamicPrintConfig& conf, const DynamicPrintConfig & global_config) { //void convert_from_prusa(ModelConfigObject& conf, const DynamicPrintConfig& global_config) { + std::map<std::string, std::string> results; for (const t_config_option_key& opt_key : conf.keys()) { const ConfigOption* opt = conf.option(opt_key); std::string serialized = opt->serialize(); @@ -6897,13 +6922,14 @@ void _convert_from_prusa(CONFIG_CLASS& conf, const DynamicPrintConfig& global_co opt_new->deserialize(serialized); conf.set_key_value(key, opt_new); } - for (auto entry : result) { - const ConfigOptionDef* def = print_config_def.get(entry.first); - if (def) { - ConfigOption* opt_new = def->default_value.get()->clone(); - opt_new->deserialize(entry.second); - conf.set_key_value(entry.first, opt_new); - } + results.insert(result.begin(), result.end()); + } + for (auto entry : results) { + const ConfigOptionDef* def = print_config_def.get(entry.first); + if (def) { + ConfigOption* opt_new = def->default_value.get()->clone(); + opt_new->deserialize(entry.second); + conf.set_key_value(entry.first, opt_new); } } } diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 0670a76bd..48116d32f 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -201,10 +201,11 @@ bool Bed3D::set_shape(const Pointfs& bed_shape, const double max_print_height, c if (force_as_custom) type = Type::Custom; else { - auto [new_type, system_model, system_texture] = detect_type(bed_shape); + auto [new_type, system_model, system_texture, system_with_grid] = detect_type(bed_shape); type = new_type; model = system_model; texture = system_texture; + m_texture_with_grid = system_with_grid; } std::string texture_filename = custom_texture.empty() ? texture : custom_texture; @@ -365,16 +366,16 @@ void Bed3D::calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox) std::copy(contour_lines.begin(), contour_lines.end(), std::back_inserter(gridlines)); if (!m_gridlines.set_from_lines(gridlines, GROUND_Z)) - BOOST_LOG_TRIVIAL(error) << "Unable to create bed grid lines\n"; + BOOST_LOG_TRIVIAL(error) << "Unable to create bed grid lines"; if (!m_gridlines_big.set_from_lines(gridlines_big, GROUND_Z)) - printf("Unable to create bed grid lines\n"); + BOOST_LOG_TRIVIAL(error) << "Unable to create bed big grid lines"; if (!m_gridlines_small.set_from_lines(gridlines_small, GROUND_Z)) - printf("Unable to create bed grid lines\n"); + BOOST_LOG_TRIVIAL(error) << "Unable to create bed grid lines"; } // Try to match the print bed shape with the shape of an active profile. If such a match exists, // return the print bed model. -std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Pointfs& shape) +std::tuple<Bed3D::Type, std::string, std::string, bool> Bed3D::detect_type(const Pointfs& shape) { auto bundle = wxGetApp().preset_bundle; if (bundle != nullptr && bundle->printers.size() > bundle->printers.get_selected_idx()) { @@ -385,7 +386,7 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point std::string model_filename = PresetUtils::system_printer_bed_model(*curr); std::string texture_filename = PresetUtils::system_printer_bed_texture(*curr); if (!model_filename.empty() && !texture_filename.empty()) - return { Type::System, model_filename, texture_filename }; + return { Type::System, model_filename, texture_filename, PresetUtils::system_printer_model(*curr)->bed_with_grid }; } } @@ -393,7 +394,7 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point } } - return { Type::Custom, {}, {} }; + return { Type::Custom, {}, {}, true }; } void Bed3D::render_axes() const @@ -501,6 +502,28 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) const if (bottom) glsafe(::glFrontFace(GL_CW)); + if (this->m_texture_with_grid) { + glsafe(::glDisable(GL_DEPTH_TEST)); + glsafe(::glDisable(GL_BLEND)); + glsafe(::glEnableClientState(GL_VERTEX_ARRAY)); + if (!bottom) + glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 1.0f)); + else if (bottom) + glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.6f)); + glsafe(::glLineWidth(0.5f * m_scale_factor)); + glsafe(::glVertexPointer(3, GL_FLOAT, m_gridlines_small.get_vertex_data_size(), (GLvoid*)m_gridlines_small.get_vertices_data())); + glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines_small.get_vertices_count())); + glsafe(::glLineWidth(1.5f * m_scale_factor)); + glsafe(::glVertexPointer(3, GL_FLOAT, m_gridlines.get_vertex_data_size(), (GLvoid*)m_gridlines.get_vertices_data())); + glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count())); + glsafe(::glLineWidth(3.0f * m_scale_factor)); + glsafe(::glVertexPointer(3, GL_FLOAT, m_gridlines_big.get_vertex_data_size(), (GLvoid*)m_gridlines_big.get_vertices_data())); + glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines_big.get_vertices_count())); + glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); + glsafe(::glEnable(GL_DEPTH_TEST)); + glsafe(::glEnable(GL_BLEND)); + } + unsigned int stride = m_triangles.get_vertex_data_size(); GLint position_id = shader->get_attrib_location("v_position"); diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 9d30f0098..6aabc29d1 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -76,6 +76,7 @@ private: BuildVolume m_build_volume; Type m_type{ Type::Custom }; std::string m_texture_filename; + bool m_texture_with_grid = false; std::string m_model_filename; // Print volume bounding box exteded with axes and model. BoundingBoxf3 m_extended_bounding_box; @@ -132,7 +133,7 @@ private: BoundingBoxf3 calc_extended_bounding_box() const; void calc_triangles(const ExPolygon& poly); void calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); - static std::tuple<Type, std::string, std::string> detect_type(const Pointfs& shape); + static std::tuple<Type, std::string, std::string, bool> detect_type(const Pointfs& shape); void render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes, bool show_texture, bool picking); void render_axes() const; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 459cea4af..4d83a9e96 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2097,6 +2097,9 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page) } else if (boost::starts_with(params[i], "label$")) { + // store current label into full_label if no full_label to prevent rpoblem in the rest of the gui (all empty). + if (option.opt.full_label.empty()) + option.opt.full_label = option.opt.label; option.opt.label = (params[i].substr(6, params[i].size() - 6)); need_to_notified_search = true; } |