diff --git a/resources/profiles/PrusaResearch.idx b/resources/profiles/PrusaResearch.idx index 9ee9035631..d63336c2ef 100644 --- a/resources/profiles/PrusaResearch.idx +++ b/resources/profiles/PrusaResearch.idx @@ -1,4 +1,5 @@ min_slic3r_version = 2.4.0-rc +1.4.4 Added multiple Fiberlogy filament profiles. Updated Extrudr filament profiles. 1.4.3 Added new filament profiles and SLA materials. 1.4.2 Added SLA material profiles. 1.4.1 Updated firmware version. diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index 3182eba6bb..4af1e35ed1 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -5,7 +5,7 @@ name = Prusa Research # Configuration version of this file. Config file will only be installed, if the config_version differs. # This means, the server may force the PrusaSlicer configuration to be downgraded. -config_version = 1.4.3 +config_version = 1.4.4 # Where to get the updates from? config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaResearch/ changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1% @@ -2050,7 +2050,7 @@ compatible_printers_condition = nozzle_diameter[0]!=0.8 and printer_model!="MK2S inherits = Fillamentum ASA filament_vendor = Extrudr bed_temperature = 90 -filament_cost = 25.98 +filament_cost = 34.64 filament_density = 1.05 filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=120" first_layer_bed_temperature = 90 @@ -2083,8 +2083,8 @@ filament_vendor = Extrudr [filament:Extrudr XPETG CF] inherits = Extrudr PETG -filament_cost = 49.99 -filament_density = 1.41 +filament_cost = 62.49 +filament_density = 1.29 filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=198" first_layer_temperature = 235 temperature = 235 @@ -2125,7 +2125,7 @@ filament_spool_weight = 230 [filament:Extrudr Flax] inherits = *PLA* filament_vendor = Extrudr -filament_cost = 56.23 +filament_cost = 50.91 filament_density = 1.45 filament_notes = "High Performance Filament for decorative parts.\nPrints as easily as PLA with much higher strength and temperature resistance.\nFully biodegradable with a nice matt finish.\n\nhttps://www.extrudr.com/en/products/catalogue/?material=131" first_layer_temperature = 190 @@ -2140,13 +2140,13 @@ filament_spool_weight = 262 [filament:Extrudr GreenTEC] inherits = *PLA* filament_vendor = Extrudr -filament_cost = 56 +filament_cost = 50.91 filament_density = 1.3 -filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=106" +filament_notes = "https://www.extrudr.com/en/products/catalogue/?ignorechildren=1&material=106" first_layer_temperature = 208 temperature = 208 slowdown_below_layer_time = 20 -filament_spool_weight = 230 +filament_spool_weight = 262 [filament:Extrudr GreenTEC Pro] inherits = *PLA* @@ -2164,7 +2164,7 @@ filament_spool_weight = 230 [filament:Extrudr GreenTEC Pro Carbon] inherits = *PLA* filament_vendor = Extrudr -filament_cost = 56.23 +filament_cost = 62.49 filament_density = 1.2 filament_notes = "High Performance Filament for technical parts.\nPrints as easily as PLA with much higher stregnth and temperature resistance.\nFully biodegradable with a nice matt finish.\n\nhttps://www.extrudr.com/en/products/catalogue/?material=138" first_layer_temperature = 225 @@ -2221,8 +2221,8 @@ extrusion_multiplier = 1.2 filament_cost = 39.98 filament_density = 1.19 filament_deretract_speed = nil -filament_max_volumetric_speed = 2 -filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=115" +filament_max_volumetric_speed = 3 +filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=117" filament_retract_length = 0.4 filament_wipe = nil filament_spool_weight = 230 @@ -2236,8 +2236,8 @@ extrusion_multiplier = 1.2 filament_cost = 39.98 filament_density = 1.18 filament_deretract_speed = nil -filament_max_volumetric_speed = 1.2 -filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=115" +filament_max_volumetric_speed = 1.8 +filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=116" filament_retract_length = 0.4 filament_wipe = nil filament_spool_weight = 230 @@ -3511,13 +3511,6 @@ filament_density = 1.27 filament_spool_weight = 235 compatible_printers_condition = nozzle_diameter[0]!=0.6 and printer_model!="MK2SMM" and printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) -[filament:Fiberlogy PETG] -inherits = *PET* -filament_vendor = Fiberlogy -filament_cost = 21.50 -filament_density = 1.27 -compatible_printers_condition = nozzle_diameter[0]!=0.6 and printer_model!="MK2SMM" and printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) - [filament:Prusament PETG] inherits = *PET* filament_vendor = Prusa Polymers @@ -3580,8 +3573,9 @@ filament_density = 1.27 filament_spool_weight = 235 filament_type = PETG -[filament:Fiberlogy PETG @0.6 nozzle] +[filament:Fiberlogy Easy PET-G @0.6 nozzle] inherits = *PET06* +renamed_from = Fiberlogy PETG @0.6 nozzle filament_vendor = Fiberlogy first_layer_temperature = 230 temperature = 240 @@ -3673,11 +3667,297 @@ filament_density = 1.24 filament_spool_weight = 230 compatible_printers_condition = nozzle_diameter[0]!=0.8 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) -[filament:Fiberlogy PLA] +[filament:Fiberlogy Easy PLA] inherits = *PLA* +renamed_from = Fiberlogy PLA filament_vendor = Fiberlogy -filament_cost = 25.4 +filament_cost = 20 filament_density = 1.24 +first_layer_temperature = 220 +temperature = 220 +filament_spool_weight = 330 + +[filament:Fiberlogy Easy PET-G] +inherits = *PET* +renamed_from = Fiberlogy PETG +filament_vendor = Fiberlogy +filament_spool_weight = 330 +filament_cost = 20 +filament_density = 1.27 +compatible_printers_condition = nozzle_diameter[0]!=0.6 and printer_model!="MK2SMM" and printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) +first_layer_bed_temperature = 80 +bed_temperature = 80 +first_layer_temperature = 235 +temperature = 235 +min_fan_speed = 15 +max_fan_speed = 30 +bridge_fan_speed = 60 +disable_fan_first_layers = 5 +full_fan_speed_layer = 5 +slowdown_below_layer_time = 15 + +[filament:Fiberlogy ASA] +inherits = *ABS* +filament_vendor = Fiberlogy +filament_cost = 33 +filament_density = 1.07 +filament_spool_weight = 330 +fan_always_on = 0 +cooling = 1 +min_fan_speed = 10 +max_fan_speed = 15 +bridge_fan_speed = 30 +min_print_speed = 15 +slowdown_below_layer_time = 15 +first_layer_temperature = 260 +temperature = 260 +first_layer_bed_temperature = 105 +bed_temperature = 110 +filament_type = ASA +fan_below_layer_time = 30 +disable_fan_first_layers = 5 + +[filament:Fiberlogy ASA @MINI] +inherits = Fiberlogy ASA; *ABSMINI* + +[filament:Fiberlogy Easy ABS] +inherits = Fiberlogy ASA +filament_cost = 22.67 +filament_density = 1.09 +fan_always_on = 0 +cooling = 1 +min_fan_speed = 10 +max_fan_speed = 15 +min_print_speed = 15 +slowdown_below_layer_time = 15 +first_layer_temperature = 250 +temperature = 250 +first_layer_bed_temperature = 100 +bed_temperature = 100 +filament_type = ABS +fan_below_layer_time = 25 +disable_fan_first_layers = 5 + +[filament:Fiberlogy Easy ABS @MINI] +inherits = Fiberlogy Easy ABS; *ABSMINI* + +[filament:Fiberlogy CPE HT] +inherits = *PET* +filament_vendor = Fiberlogy +filament_cost = 42.67 +filament_density = 1.18 +extrusion_multiplier = 0.98 +filament_spool_weight = 330 +fan_always_on = 1 +cooling = 1 +min_fan_speed = 0 +max_fan_speed = 0 +bridge_fan_speed = 50 +min_print_speed = 15 +first_layer_temperature = 275 +temperature = 275 +first_layer_bed_temperature = 105 +bed_temperature = 110 +filament_type = CPE +fan_below_layer_time = 20 +slowdown_below_layer_time = 15 +disable_fan_first_layers = 5 + +[filament:Fiberlogy PCTG] +inherits = Fiberlogy CPE HT +filament_vendor = Fiberlogy +filament_cost = 29.41 +filament_density = 1.23 +extrusion_multiplier = 0.98 +min_fan_speed = 10 +max_fan_speed = 15 +bridge_fan_speed = 50 +min_print_speed = 15 +first_layer_temperature = 265 +temperature = 265 +first_layer_bed_temperature = 90 +bed_temperature = 90 +filament_type = CPE +fan_below_layer_time = 20 +slowdown_below_layer_time = 15 +disable_fan_first_layers = 5 + +[filament:Fiberlogy FiberFlex 40D] +inherits = *FLEX* +filament_vendor = Fiberlogy +fan_always_on = 1 +filament_max_volumetric_speed = 1.5 +extrusion_multiplier = 1.12 +first_layer_temperature = 230 +first_layer_bed_temperature = 60 +temperature = 230 +bed_temperature = 60 +bridge_fan_speed = 75 +min_fan_speed = 25 +max_fan_speed = 75 +filament_retract_before_travel = 2 +filament_cost = 39.41 +filament_density = 1.16 +filament_retract_length = 1.2 +filament_retract_speed = nil +filament_deretract_speed = 20 +filament_retract_lift = 0 +filament_wipe = 0 +disable_fan_first_layers = 5 +full_fan_speed_layer = 5 +min_print_speed = 15 +cooling = 1 +filament_spool_weight = 330 + +[filament:Fiberlogy FiberFlex 40D @MINI] +inherits = *FLEXMINI* +filament_vendor = Fiberlogy +filament_max_volumetric_speed = 1.5 +fan_always_on = 1 +first_layer_temperature = 240 +first_layer_bed_temperature = 60 +temperature = 240 +bed_temperature = 60 +filament_retract_length = 4 +filament_retract_before_travel = 5 +bridge_fan_speed = 80 +min_fan_speed = 25 +max_fan_speed = 60 +min_print_speed = 15 +slowdown_below_layer_time = 10 +cooling = 1 +filament_cost = 84.68 + +[filament:Fiberlogy MattFlex 40D] +inherits = Fiberlogy FiberFlex 40D +filament_vendor = Fiberlogy +fan_always_on = 1 +filament_max_volumetric_speed = 1.35 +extrusion_multiplier = 1.1 +filament_retract_before_travel = 2 +filament_cost = 49.11 +filament_retract_length = 1.2 + +[filament:Fiberlogy FiberFlex 30D] +inherits = Fiberlogy FiberFlex 40D +filament_max_volumetric_speed = 1.2 +extrusion_multiplier = 1.15 +first_layer_temperature = 240 +temperature = 240 +min_fan_speed = 25 +max_fan_speed = 60 +filament_density = 1.07 +filament_retract_length = 1.2 + +[filament:Fiberlogy FiberSatin] +inherits = Fiberlogy Easy PLA +first_layer_temperature = 215 +temperature = 215 +extrusion_multiplier = 1.03 +filament_density = 1.2 +filament_cost = 32.35 + +[filament:Fiberlogy FiberSilk] +inherits = Fiberlogy FiberSatin +first_layer_temperature = 230 +temperature = 230 +extrusion_multiplier = 0.97 +filament_density = 1.22 +filament_cost = 32.35 + +[filament:Fiberlogy FiberWood] +inherits = Fiberlogy Easy PLA +first_layer_temperature = 185 +temperature = 185 +extrusion_multiplier = 1 +filament_density = 1.23 +filament_cost = 38.66 +filament_max_volumetric_speed = 8 + +[filament:Fiberlogy HD PLA] +inherits = Fiberlogy Easy PLA +first_layer_temperature = 230 +temperature = 230 +extrusion_multiplier = 1 +filament_density = 1.24 +filament_cost = 30.59 + +[filament:Fiberlogy PLA Mineral] +inherits = Fiberlogy Easy PLA +first_layer_temperature = 195 +temperature = 190 +extrusion_multiplier = 0.98 +filament_density = 1.38 +filament_cost = 37.64 +filament_max_volumetric_speed = 10 + +[filament:Fiberlogy Impact PLA] +inherits = Fiberlogy HD PLA +filament_density = 1.22 +filament_cost = 27.65 + +[filament:Fiberlogy Nylon PA12] +inherits = Fiberlogy ASA +filament_type = NYLON +filament_density = 1.01 +filament_cost = 48 +first_layer_bed_temperature = 105 +bed_temperature = 110 +first_layer_temperature = 265 +temperature = 265 +min_fan_speed = 10 +max_fan_speed = 15 +fan_below_layer_time = 20 +bridge_fan_speed = 30 +fan_always_on = 0 +filament_retract_lift = 0.2 +filament_max_volumetric_speed = 6 +start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.6}0.12{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.8}0.06{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/}0.2{elsif nozzle_diameter[0]==0.8}0.02{elsif nozzle_diameter[0]==0.6}0.04{else}0.08{endif} ; Filament gcode LA 1.5\n{if printer_notes=~/.*PRINTER_MODEL_MINI.*/};{elsif printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}M900 K200{elsif nozzle_diameter[0]==0.6}M900 K26{elsif nozzle_diameter[0]==0.8};{else}M900 K45{endif} ; Filament gcode LA 1.0" + +[filament:Fiberlogy Nylon PA12+CF15] +inherits = Fiberlogy Nylon PA12 +extrusion_multiplier = 0.97 +filament_density = 1.07 +filament_cost = 87.5 +first_layer_bed_temperature = 105 +bed_temperature = 110 +first_layer_temperature = 265 +temperature = 265 +min_fan_speed = 10 +max_fan_speed = 15 +fan_below_layer_time = 20 +bridge_fan_speed = 30 +fan_always_on = 0 +filament_max_volumetric_speed = 8 +compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model!="MK2SMM" and printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material) + +[filament:Fiberlogy Nylon PA12+GF15] +inherits = Fiberlogy Nylon PA12+CF15 +filament_density = 1.13 +filament_max_volumetric_speed = 8 + +[filament:Fiberlogy PP] +inherits = *ABS* +filament_vendor = Fiberlogy +filament_cost = 36.67 +filament_density = 1.05 +extrusion_multiplier = 1.05 +filament_spool_weight = 330 +fan_always_on = 1 +cooling = 1 +min_fan_speed = 0 +max_fan_speed = 25 +bridge_fan_speed = 70 +min_print_speed = 15 +slowdown_below_layer_time = 15 +first_layer_temperature = 245 +temperature = 245 +first_layer_bed_temperature = 0 +bed_temperature = 0 +filament_type = PP +fan_below_layer_time = 100 +disable_fan_first_layers = 5 +filament_max_volumetric_speed = 5 [filament:Filament PM PLA] inherits = *PLA* @@ -3736,7 +4016,7 @@ filament_density = 1.24 inherits = *PLA* filament_vendor = Prusa Polymers temperature = 215 -filament_cost = 30.24 +filament_cost = 36.29 filament_density = 1.24 filament_spool_weight = 201 filament_notes = "Affordable filament for everyday printing in premium quality manufactured in-house by Josef Prusa" @@ -3790,7 +4070,7 @@ filament_spool_weight = 230 [filament:Prusament PLA @MMU2] inherits = *PLA MMU2* filament_vendor = Prusa Polymers -filament_cost = 30.24 +filament_cost = 36.29 filament_density = 1.24 filament_spool_weight = 201 @@ -4124,8 +4404,9 @@ renamed_from = "Plasty Mladec PETG @MMU1" [filament:Verbatim PETG @MMU1] inherits = Verbatim PETG; *PETMMU1* -[filament:Fiberlogy PETG @MMU1] -inherits = Fiberlogy PETG; *PETMMU1* +[filament:Fiberlogy Easy PET-G @MMU1] +inherits = Fiberlogy Easy PET-G; *PETMMU1* +renamed_from = Fiberlogy PETG @MMU1 [filament:Prusa PETG @MMU1] inherits = Prusa PETG; *PETMMU1* @@ -4215,8 +4496,9 @@ compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0. inherits = Verbatim PETG; *PETMINI* compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.6 -[filament:Fiberlogy PETG @MINI] -inherits = Fiberlogy PETG; *PETMINI* +[filament:Fiberlogy Easy PET-G @MINI] +inherits = Fiberlogy Easy PET-G; *PETMINI* +renamed_from = Fiberlogy PETG @MINI compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.6 [filament:Generic ABS @MINI] @@ -4303,8 +4585,9 @@ renamed_from = "Plasty Mladec PETG @0.6 nozzle MINI" [filament:Verbatim PETG @0.6 nozzle MINI] inherits = Verbatim PETG; *PETMINI06* -[filament:Fiberlogy PETG @0.6 nozzle MINI] -inherits = Fiberlogy PETG; *PETMINI06* +[filament:Fiberlogy Easy PET-G @0.6 nozzle MINI] +inherits = Fiberlogy Easy PET-G; *PETMINI06* +renamed_from = Fiberlogy PETG @0.6 nozzle MINI [filament:Prusament ASA @MINI] inherits = Prusament ASA; *ABSMINI* diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 51c26209e9..01d3c592a6 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -8,7 +8,7 @@ namespace Slic3r { -static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_polyline, ExtrusionRole role, const Flow &flow, const float tolerance) +static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_polyline, ExtrusionRole role, const Flow &flow, const float tolerance, const float merge_tolerance) { ExtrusionPaths paths; ExtrusionPath path(role); @@ -71,7 +71,7 @@ static ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thi path.height = new_flow.height(); } else { thickness_delta = fabs(scale_(flow.width()) - w); - if (thickness_delta <= tolerance) { + if (thickness_delta <= merge_tolerance) { // the width difference between this line and the current flow width is // within the accepted tolerance path.polyline.append(line.b); @@ -95,7 +95,7 @@ static void variable_width(const ThickPolylines& polylines, ExtrusionRole role, // of segments, and any pruning shall be performed before we apply this tolerance. const float tolerance = float(scale_(0.05)); for (const ThickPolyline &p : polylines) { - ExtrusionPaths paths = thick_polyline_to_extrusion_paths(p, role, flow, tolerance); + ExtrusionPaths paths = thick_polyline_to_extrusion_paths(p, role, flow, tolerance, tolerance); // Append paths to collection. if (! paths.empty()) { if (paths.front().first_point() == paths.back().last_point()) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e3258117e3..2404b41cad 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3438,6 +3438,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) #endif // !ENABLE_NEW_RECTANGLE_SELECTION else { #if ENABLE_NEW_RECTANGLE_SELECTION + const bool rectangle_selection_dragging = m_rectangle_selection.is_dragging(); if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled) { if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports && m_gizmos.get_current_type() != GLGizmosManager::FdmSupports && @@ -3454,8 +3455,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // during the scene manipulation. #if ENABLE_NEW_RECTANGLE_SELECTION - if (m_picking_enabled && (!any_gizmo_active || !evt.ShiftDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled()) && - !m_rectangle_selection.is_dragging()) { + if (m_picking_enabled && !any_gizmo_active && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled()) && !rectangle_selection_dragging) { #else if (m_picking_enabled && (!any_gizmo_active || !evt.CmdDown()) && (!m_hover_volume_idxs.empty() || !is_layers_editing_enabled())) { #endif // ENABLE_NEW_RECTANGLE_SELECTION @@ -3599,9 +3599,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } // do not process the dragging if the left mouse was set down in another canvas #if ENABLE_NEW_CAMERA_MOVEMENTS - else if (evt.LeftIsDown() || evt.MiddleIsDown()) { + else if (evt.LeftIsDown()) { // if dragging over blank area with left button, rotate - if ((any_gizmo_active || evt.CmdDown() || evt.MiddleIsDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { + if ((any_gizmo_active || evt.CmdDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { #else // if dragging over blank area with left button, rotate else if (evt.LeftIsDown()) { @@ -3625,13 +3625,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } m_mouse.drag.start_position_3D = Vec3d((double)pos.x(), (double)pos.y(), 0.0); } -#if ENABLE_NEW_CAMERA_MOVEMENTS - else if (evt.RightIsDown()) { - // If dragging with right button, pan. -#else else if (evt.MiddleIsDown() || evt.RightIsDown()) { - // If dragging over blank area with right button, pan. -#endif // ENABLE_NEW_CAMERA_MOVEMENTS + // If dragging over blank area with right/middle button, pan. if (m_mouse.is_start_position_2D_defined()) { // get point in model space at Z = 0 float z = 0.0f; @@ -6072,35 +6067,34 @@ void GLCanvas3D::_render_camera_target() #if ENABLE_LEGACY_OPENGL_REMOVAL const Vec3f& target = wxGetApp().plater()->get_camera().get_target().cast(); - bool target_changed = !m_camera_target.target.isApprox(target.cast()); m_camera_target.target = target.cast(); for (int i = 0; i < 3; ++i) { - if (!m_camera_target.axis[i].is_initialized() || target_changed) { + if (!m_camera_target.axis[i].is_initialized()) { m_camera_target.axis[i].reset(); GLModel::Geometry init_data; - init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P3, GLModel::Geometry::EIndexType::USHORT }; + init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P3 }; init_data.color = (i == X) ? ColorRGBA::X() : ((i == Y) ? ColorRGBA::Y() : ColorRGBA::Z()); init_data.reserve_vertices(2); init_data.reserve_indices(2); // vertices if (i == X) { - init_data.add_vertex(Vec3f(target.x() - half_length, target.y(), target.z())); - init_data.add_vertex(Vec3f(target.x() + half_length, target.y(), target.z())); + init_data.add_vertex(Vec3f(-half_length, 0.0f, 0.0f)); + init_data.add_vertex(Vec3f(+half_length, 0.0f, 0.0f)); } else if (i == Y) { - init_data.add_vertex(Vec3f(target.x(), target.y() - half_length, target.z())); - init_data.add_vertex(Vec3f(target.x(), target.y() + half_length, target.z())); + init_data.add_vertex(Vec3f(0.0f, -half_length, 0.0f)); + init_data.add_vertex(Vec3f(0.0f, +half_length, 0.0f)); } else { - init_data.add_vertex(Vec3f(target.x(), target.y(), target.z() - half_length)); - init_data.add_vertex(Vec3f(target.x(), target.y(), target.z() + half_length)); + init_data.add_vertex(Vec3f(0.0f, 0.0f, -half_length)); + init_data.add_vertex(Vec3f(0.0f, 0.0f, +half_length)); } // indices - init_data.add_ushort_line(0, 1); + init_data.add_line(0, 1); m_camera_target.axis[i].init_from(std::move(init_data)); } @@ -6115,7 +6109,7 @@ void GLCanvas3D::_render_camera_target() shader->start_using(); #if ENABLE_GL_SHADERS_ATTRIBUTES const Camera& camera = wxGetApp().plater()->get_camera(); - shader->set_uniform("view_model_matrix", camera.get_view_matrix()); + shader->set_uniform("view_model_matrix", camera.get_view_matrix() * Geometry::assemble_transform(m_camera_target.target)); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); #if ENABLE_GL_CORE_PROFILE const std::array& viewport = camera.get_viewport(); diff --git a/src/slic3r/GUI/GLModel.cpp b/src/slic3r/GUI/GLModel.cpp index c532167c26..aad77eade8 100644 --- a/src/slic3r/GUI/GLModel.cpp +++ b/src/slic3r/GUI/GLModel.cpp @@ -1172,6 +1172,7 @@ bool GLModel::send_to_gpu() glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_count * sizeof(unsigned short), reduced_indices.data(), GL_STATIC_DRAW)); } else { + data.index_type = Geometry::EIndexType::UINT; glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.indices_size_bytes(), data.indices.data(), GL_STATIC_DRAW)); } diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 6c52a79a85..72b8283074 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #if __APPLE__ #import diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp index 2eb99e7bc7..cb7cf54874 100644 --- a/src/slic3r/GUI/GUI.hpp +++ b/src/slic3r/GUI/GUI.hpp @@ -13,6 +13,7 @@ class wxWindow; class wxMenuBar; class wxComboCtrl; class wxFileDialog; +class wxArrayString; class wxTopLevelWindow; namespace Slic3r { diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 27c374b3f8..4370a2f644 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -821,7 +821,7 @@ void ObjectList::paste_objects_into_list(const std::vector& object_idxs) wxDataViewItemArray items; for (const size_t object : object_idxs) { - add_object_to_list(object); + add_object_to_list(object, false); items.Add(m_objects_model->GetItemById(object)); } diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index fc9e5f49c8..fc20e43f5d 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -318,7 +318,8 @@ void NotificationManager::PopNotification::count_lines() } m_lines_count++; } - // hypertext calculation + // original hypertext calculation (when there was no text2) + /* if (!m_hypertext.empty()) { int prev_end = m_endlines.size() > 1 ? m_endlines[m_endlines.size() - 2] : 0; // m_endlines.size() - 2 because we are fitting hypertext instead of last endline if (ImGui::CalcTextSize((escape_string_cstyle(text.substr(prev_end, last_end - prev_end)) + m_hypertext).c_str()).x > m_window_width - m_window_width_offset) { @@ -326,9 +327,84 @@ void NotificationManager::PopNotification::count_lines() m_lines_count++; } } + */ + int prev_end = m_endlines.size() > 1 ? m_endlines[m_endlines.size() - 2] : 0; + int size_of_last_line = ImGui::CalcTextSize(text.substr(prev_end, last_end - prev_end).c_str()).x; + // hypertext calculation + if (!m_hypertext.empty()) { + if (size_of_last_line + ImGui::CalcTextSize(m_hypertext.c_str()).x > m_window_width - m_window_width_offset) { + // hypertext on new line + size_of_last_line = ImGui::CalcTextSize((m_hypertext + " ").c_str()).x; + m_endlines.push_back(last_end); + m_lines_count++; + } + else { + size_of_last_line += ImGui::CalcTextSize((m_hypertext + " ").c_str()).x; + } + } + // text after hypertext calculation + if (!m_text2.empty()) { + text = m_text2; + last_end = 0; + m_endlines2.clear(); + // if size_of_last_line too large to fit anything + size_t first_end = std::min(text.find_first_of('\n'), text.find_first_of(' ')); + if (size_of_last_line >= m_window_width - m_window_width_offset - ImGui::CalcTextSize(text.substr(0, first_end).c_str()).x) { + m_endlines2.push_back(0); + size_of_last_line = 0; + } + while (last_end < text.length() - 1) + { + size_t next_hard_end = text.find_first_of('\n', last_end); + if (next_hard_end != std::string::npos && ImGui::CalcTextSize(text.substr(last_end, next_hard_end - last_end).c_str()).x < m_window_width - m_window_width_offset - size_of_last_line) { + //next line is ended by '/n' + m_endlines2.push_back(next_hard_end); + last_end = next_hard_end + 1; + } + else { + // find next suitable endline + if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - m_window_width_offset - size_of_last_line) { + // more than one line till end + size_t next_space = text.find_first_of(' ', last_end); + if (next_space > 0) { + size_t next_space_candidate = text.find_first_of(' ', next_space + 1); + while (next_space_candidate > 0 && ImGui::CalcTextSize(text.substr(last_end, next_space_candidate - last_end).c_str()).x < m_window_width - m_window_width_offset - size_of_last_line) { + next_space = next_space_candidate; + next_space_candidate = text.find_first_of(' ', next_space + 1); + } + } + else { + next_space = text.length(); + } + // when one word longer than line. + if (ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x > m_window_width - m_window_width_offset - size_of_last_line || + ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x + size_of_last_line < (m_window_width - m_window_width_offset) / 5 * 3 + ) { + float width_of_a = ImGui::CalcTextSize("a").x; + int letter_count = (int)((m_window_width - m_window_width_offset - size_of_last_line) / width_of_a); + while (last_end + letter_count < text.size() && ImGui::CalcTextSize(text.substr(last_end, letter_count).c_str()).x < m_window_width - m_window_width_offset - size_of_last_line) { + letter_count += get_utf8_sequence_length(text, last_end + letter_count); + } + m_endlines2.push_back(last_end + letter_count); + last_end += letter_count; + } + else { + m_endlines2.push_back(next_space); + last_end = next_space + 1; + } + } + else { + m_endlines2.push_back(text.length()); + last_end = text.length(); + } - // m_text_2 (text after hypertext) is not used for regular notifications right now. - // its caluculation is in HintNotification::count_lines() + } + if (size_of_last_line == 0) // if first line is continuation of previous text, do not add to line count. + m_lines_count++; + size_of_last_line = 0; // should countain value only for first line (with hypertext) + + } + } } void NotificationManager::PopNotification::init() @@ -394,8 +470,29 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons render_hypertext(imgui, x_offset + ImGui::CalcTextSize((line + (line.empty() ? "" : " ")).c_str()).x, starting_y + (m_endlines.size() - 1) * shift_y, m_hypertext); } - // text2 (text after hypertext) is not rendered for regular notifications - // its rendering is in HintNotification::render_text + // text2 + if (!m_text2.empty() && (m_multiline|| m_lines_count <= 2)) { + starting_y += (m_endlines.size() - 1) * shift_y; + last_end = 0; + for (size_t i = 0; i < (m_multiline ? m_endlines2.size() : 2); i++) { + if (i == 0) //first line X is shifted by hypertext + ImGui::SetCursorPosX(x_offset + ImGui::CalcTextSize((line + m_hypertext + (line.empty() ? " " : " ")).c_str()).x); + else + ImGui::SetCursorPosX(x_offset); + + ImGui::SetCursorPosY(starting_y + i * shift_y); + line.clear(); + if (m_endlines2.size() > i && m_text2.size() >= m_endlines2[i]) { + + // regular line + line = m_text2.substr(last_end, m_endlines2[i] - last_end); + last_end = m_endlines2[i]; + if (m_text2.size() > m_endlines2[i]) + last_end += (m_text2[m_endlines2[i]] == '\n' || m_text2[m_endlines2[i]] == ' ' ? 1 : 0); + imgui.text(line.c_str()); + } + } + } } void NotificationManager::PopNotification::render_hypertext(ImGuiWrapper& imgui, const float text_x, const float text_y, const std::string text, bool more) @@ -1541,10 +1638,11 @@ void NotificationManager::push_notification(NotificationType type, const std::string& text, const std::string& hypertext, std::function callback, + const std::string& text_after, int timestamp) { int duration = get_standard_duration(level); - push_notification_data({ type, level, duration, text, hypertext, callback }, timestamp); + push_notification_data({ type, level, duration, text, hypertext, callback, text_after }, timestamp); } void NotificationManager::push_delayed_notification(const NotificationType type, std::function condition_callback, int64_t initial_delay, int64_t delay_interval) diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 72889c8549..c6a24d997d 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -154,7 +154,7 @@ public: // Push a NotificationType::CustomNotification with provided notification level and 10s for RegularNotificationLevel. // ErrorNotificationLevel are never faded out. void push_notification(NotificationType type, NotificationLevel level, const std::string& text, const std::string& hypertext = "", - std::function callback = std::function(), int timestamp = 0); + std::function callback = std::function(), const std::string& text_after = "", int timestamp = 0); // Pushes basic_notification with delay. See push_delayed_notification_data. void push_delayed_notification(const NotificationType type, std::function condition_callback, int64_t initial_delay, int64_t delay_interval); // Removes all notifications of type from m_waiting_notifications diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index df593f1300..3a5a49fd9e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2217,7 +2217,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1"; sidebar->collapse(is_collapsed); } -} + } Plater::priv::~priv() { diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp index 531e99ea25..0441e866f3 100644 --- a/src/slic3r/GUI/UpdateDialogs.cpp +++ b/src/slic3r/GUI/UpdateDialogs.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include diff --git a/src/slic3r/GUI/UpdateDialogs.hpp b/src/slic3r/GUI/UpdateDialogs.hpp index 3d9ab5a535..2eb4ff8d4f 100644 --- a/src/slic3r/GUI/UpdateDialogs.hpp +++ b/src/slic3r/GUI/UpdateDialogs.hpp @@ -6,6 +6,8 @@ #include #include +#include + #include "libslic3r/Semver.hpp" #include "MsgDialog.hpp" diff --git a/tests/libslic3r/test_voronoi.cpp b/tests/libslic3r/test_voronoi.cpp index db12e2fec1..7f25797f56 100644 --- a/tests/libslic3r/test_voronoi.cpp +++ b/tests/libslic3r/test_voronoi.cpp @@ -2055,6 +2055,50 @@ TEST_CASE("Voronoi missing vertex 3", "[VoronoiMissingVertex3]") // REQUIRE(!has_missing_voronoi_vertices(poly, vd)); } +TEST_CASE("Voronoi missing vertex 4", "[VoronoiMissingVertex4]") +{ + // Probably the reason why Voronoi vertex is missing is that 19299999 and 19300000 are very close. + Polygon polygon_1 = { + Point(27000000, -18900000), + Point(27000000, 20000000), + Point(19000000, 20000000), + Point(19000000, 19299999), + Point(26000000, -18000000), + Point(-19000000, -18000000), + Point(-27000000, 19300000), + Point(-19000000, 19300000), + Point(-19000000, 20000000), + Point(-28000000, 20000000), + Point(-20000000, -18900000), + }; + + // Maybe this is the same case as the previous, but the missing Voronoi vertex is different. + Polygon polygon_2 = { + Point(27000000, -18900000), + Point(27000000, 20000000), + Point(19000000, 20000000), + Point(19000000, 19299999), + Point(19000000, -18000000), // Just this point is different other points are the same as previous. + Point(-19000000, -18000000), + Point(-27000000, 19300000), + Point(-19000000, 19300000), + Point(-19000000, 20000000), + Point(-28000000, 20000000), + Point(-20000000, -18900000), + }; + + Geometry::VoronoiDiagram vd_1; + Geometry::VoronoiDiagram vd_2; + Lines lines_1 = to_lines(polygon_1); + Lines lines_2 = to_lines(polygon_2); + construct_voronoi(lines_1.begin(), lines_1.end(), &vd_1); + construct_voronoi(lines_2.begin(), lines_2.end(), &vd_2); +#ifdef VORONOI_DEBUG_OUT + dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex4-1-out.svg").c_str(), vd_1, Points(), lines_1); + dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex4-2-out.svg").c_str(), vd_2, Points(), lines_2); +#endif +} + // In this case, the Voronoi vertex (146873, -146873) is included twice. // Also, near to those duplicate Voronoi vertices is another Voronoi vertex (146872, -146872). // Rotating the polygon will help solve this problem, but then there arise three very close Voronoi vertices.