diff --git a/resources/profiles/Creality.ini b/resources/profiles/Creality.ini index 340235aed1..4ebf99d328 100644 --- a/resources/profiles/Creality.ini +++ b/resources/profiles/Creality.ini @@ -259,9 +259,8 @@ inherits = *PLA* # alias = Generic PLA filament_vendor = Generic -[filament:Generic PET @ENDER3] +[filament:Generic PETG @ENDER3] inherits = *PET* -# alias = Generic PET filament_vendor = Generic [filament:Generic ABS @ENDER3] @@ -280,9 +279,9 @@ bed_temperature = 40 first_layer_temperature = 210 first_layer_bed_temperature =40 -[filament:Creality PET @ENDER3] +[filament:Creality PETG @ENDER3] inherits = *PET* -# alias = Creality PET +# alias = Creality PETG filament_vendor = Creality temperature = 240 bed_temperature = 70 @@ -303,7 +302,7 @@ first_layer_bed_temperature =90 [filament:Prusament PLA @ENDER3] inherits = *PLA* # alias = Prusament PLA -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers temperature = 215 bed_temperature = 40 first_layer_temperature = 215 @@ -314,7 +313,7 @@ filament_density = 1.24 [filament:Prusament PETG @ENDER3] inherits = *PET* # alias = Prusament PETG -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers temperature = 245 bed_temperature = 70 first_layer_temperature = 245 diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index 9d3277d8d3..aefff5c856 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -1715,7 +1715,7 @@ filament_type = ASA [filament:Prusament ASA] inherits = *ABS* -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers filament_cost = 35.28 filament_density = 1.07 fan_always_on = 1 @@ -1763,14 +1763,36 @@ inherits = *ABS* filament_vendor = Generic filament_cost = 27.82 filament_density = 1.04 -filament_notes = "List of materials tested with standard ABS print settings:\n\nEsun ABS\nFil-A-Gehr ABS\nHatchboxABS\nPlasty Mladec ABS" -[filament:Generic PET] +[filament:Esun ABS] +inherits = *ABS* +filament_vendor = Esun +filament_cost = 27.82 +filament_density = 1.04 + +[filament:Hatchbox ABS] +inherits = *ABS* +filament_vendor = Hatchbox +filament_cost = 27.82 +filament_density = 1.04 + +[filament:Plasty Mladec ABS] +inherits = *ABS* +filament_vendor = Plasty Mladec +filament_cost = 27.82 +filament_density = 1.04 + +[filament:Generic PETG] inherits = *PET* filament_vendor = Generic filament_cost = 27.82 filament_density = 1.27 -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nFillamentum CPE GH100\nPlasty Mladec PETG" + +[filament:Plasty Mladec PETG] +inherits = *PET* +filament_vendor = Plasty Mladec +filament_cost = 27.82 +filament_density = 1.27 [filament:Generic PLA] inherits = *PLA* @@ -1899,7 +1921,7 @@ filament_vendor = Generic [filament:Prusament ASA @MMU2] inherits = *ABS MMU2* # alias = Prusament ASA -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers filament_cost = 35.28 filament_density = 1.07 fan_always_on = 1 @@ -1925,6 +1947,10 @@ inherits = *ABS MMU2* # alias = Prusa ABS filament_vendor = Made for Prusa +[filament:Plasty Mladec ABS @MMU2] +inherits = *ABS MMU2* +filament_vendor = Plasty Mladec + [filament:Prusa HIPS] inherits = *ABS* filament_vendor = Made for Prusa @@ -1944,17 +1970,17 @@ min_fan_speed = 20 start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_MODEL_MINI.*/}0{elsif printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}0{else}10{endif}; Filament gcode" temperature = 220 -[filament:Prusa PET] +[filament:Prusa PETG] inherits = *PET* filament_vendor = Made for Prusa filament_cost = 27.82 filament_density = 1.27 -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nPlasty Mladec PETG" +filament_notes = "List of manufacturers tested with standard PETG print settings:\n\nE3D Edge\nPlasty Mladec PETG" 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 Research +filament_vendor = Prusa Polymers first_layer_temperature = 240 temperature = 250 filament_cost = 24.99 @@ -1962,18 +1988,26 @@ filament_density = 1.27 filament_type = PETG 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:Prusa PET @0.6 nozzle] +[filament:Prusa PETG @0.6 nozzle] inherits = *PET06* -# alias = Prusa PET +# alias = Prusa PETG filament_vendor = Made for Prusa filament_cost = 27.82 filament_density = 1.27 -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nPlasty Mladec PETG" +filament_notes = "List of manufacturers tested with standard PETG print settings:\n\nE3D Edge\nPlasty Mladec PETG" [filament:Prusament PETG @0.6 nozzle] inherits = *PET06* -# alias = Prusament PETG -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers +first_layer_temperature = 240 +temperature = 250 +filament_cost = 24.99 +filament_density = 1.27 +filament_type = PETG + +[filament:Plasty Mladec PETG @0.6 nozzle] +inherits = *PET06* +filament_vendor = Plasty Mladec first_layer_temperature = 240 temperature = 250 filament_cost = 24.99 @@ -1981,7 +2015,7 @@ filament_density = 1.27 filament_type = PETG [filament:*PET MMU2*] -inherits = Prusa PET +inherits = Prusa PETG compatible_printers_condition = nozzle_diameter[0]!=0.6 and printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material temperature = 230 first_layer_temperature = 230 @@ -2004,48 +2038,105 @@ inherits = *PET MMU2* compatible_printers_condition = nozzle_diameter[0]==0.6 and printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material filament_max_volumetric_speed = 13 -[filament:Generic PET @MMU2] +[filament:Generic PETG @MMU2] inherits = *PET MMU2* -# alias = Generic PET +# alias = Generic PETG filament_vendor = Generic -[filament:Prusa PET @MMU2] +[filament:Plasty Mladec PETG @MMU2] inherits = *PET MMU2* -# alias = Prusa PET +filament_vendor = Plasty Mladec + +[filament:Prusa PETG @MMU2] +inherits = *PET MMU2* +# alias = Prusa PETG filament_vendor = Made for Prusa [filament:Prusament PETG @MMU2] inherits = *PET MMU2* filament_type = PETG # alias = Prusament PETG -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers -[filament:Generic PET @MMU2 0.6 nozzle] +[filament:Generic PETG @MMU2 0.6 nozzle] inherits = *PET MMU2 06* -# alias = Generic PET +# alias = Generic PETG filament_vendor = Generic -[filament:Prusa PET @MMU2 0.6 nozzle] +[filament:Prusa PETG @MMU2 0.6 nozzle] inherits = *PET MMU2 06* -# alias = Prusa PET +# alias = Prusa PETG filament_vendor = Made for Prusa [filament:Prusament PETG @MMU2 0.6 nozzle] inherits = *PET MMU2 06* filament_type = PETG # alias = Prusament PETG -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers + +[filament:Plasty Mladec PETG @MMU2 0.6 nozzle] +inherits = *PET MMU2 06* +filament_type = PETG +# alias = Prusament PETG +filament_vendor = Plasty Mladec [filament:Prusa PLA] inherits = *PLA* filament_vendor = Made for Prusa filament_cost = 25.4 filament_density = 1.24 -filament_notes = "List of materials tested with standard PLA print settings:\n\nDas Filament\nEsun PLA\nEUMAKERS PLA\nFiberlogy HD-PLA\nFiberlogy PLA\nFloreon3D\nHatchbox PLA\nPlasty Mladec PLA\nPrimavalue PLA\nProto pasta Matte Fiber\nAmazonBasics PLA" + +[filament:Fiberlogy PLA] +inherits = *PLA* +filament_vendor = Fiberlogy +filament_cost = 25.4 +filament_density = 1.24 + +[filament:Plasty Mladec PLA] +inherits = *PLA* +filament_vendor = Plasty Mladec +filament_cost = 25.4 +filament_density = 1.24 + +[filament:AmazonBasics PLA] +inherits = *PLA* +filament_vendor = AmazonBasics +filament_cost = 25.4 +filament_density = 1.24 + +[filament:Hatchbox PLA] +inherits = *PLA* +filament_vendor = Hatchbox +filament_cost = 25.4 +filament_density = 1.24 + +[filament:Esun PLA] +inherits = *PLA* +filament_vendor = Esun +filament_cost = 25.4 +filament_density = 1.24 + +[filament:Das Filament PLA] +inherits = *PLA* +filament_vendor = Das Filament +filament_cost = 25.4 +filament_density = 1.24 + +[filament:EUMAKERS PLA] +inherits = *PLA* +filament_vendor = EUMAKERS +filament_cost = 25.4 +filament_density = 1.24 + +[filament:Floreon3D PLA] +inherits = *PLA* +filament_vendor = Floreon3D +filament_cost = 25.4 +filament_density = 1.24 [filament:Prusament PLA] inherits = *PLA* -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers temperature = 215 filament_cost = 24.99 filament_density = 1.24 @@ -2077,7 +2168,7 @@ filament_vendor = Made for Prusa [filament:Prusament PLA @MMU2] inherits = *PLA MMU2* -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers [filament:SemiFlex or Flexfill 98A] inherits = *FLEX* @@ -2300,7 +2391,7 @@ filament_vendor = E3D filament_cost = 56.9 filament_density = 1.26 filament_type = EDGE -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nFillamentum CPE GH100\nPlasty Mladec PETG" +filament_notes = "List of manufacturers tested with standard PETG print settings:\n\nE3D Edge\nFillamentum CPE GH100\nPlasty Mladec PETG" [filament:Fillamentum CPE @MMU1] inherits = *PETMMU1* @@ -2315,26 +2406,32 @@ max_fan_speed = 50 min_fan_speed = 50 temperature = 275 -[filament:Generic PET @MMU1] +[filament:Generic PETG @MMU1] inherits = *PETMMU1* -# alias = Generic PET +# alias = Generic PETG filament_vendor = Generic filament_cost = 27.82 filament_density = 1.27 -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nFillamentum CPE GH100\nPlasty Mladec PETG" -[filament:Prusa PET @MMU1] +[filament:Plasty Mladec PETG @MMU1] inherits = *PETMMU1* -# alias = Prusa PET +# alias = Generic PETG +filament_vendor = Plasty Mladec +filament_cost = 27.82 +filament_density = 1.27 + +[filament:Prusa PETG @MMU1] +inherits = *PETMMU1* +# alias = Prusa PETG filament_vendor = Made for Prusa filament_cost = 27.82 filament_density = 1.27 -filament_notes = "List of manufacturers tested with standard PET print settings:\n\nE3D Edge\nPlasty Mladec PETG" +filament_notes = "List of manufacturers tested with standard PETG print settings:\n\nE3D Edge\nPlasty Mladec PETG" [filament:Prusament PETG @MMU1] inherits = *PETMMU1* # alias = Prusament PETG -filament_vendor = Prusa Research +filament_vendor = Prusa Polymers first_layer_temperature = 240 temperature = 250 filament_cost = 24.99 @@ -2381,21 +2478,49 @@ compatible_printers_condition = printer_model=="MK2SMM" ## Filaments MINI -[filament:Generic PET @MINI] -inherits = Generic PET; *PETMINI* -# alias = Generic PET +[filament:Generic PETG @MINI] +inherits = Generic PETG; *PETMINI* +filament_vendor = Generic +# alias = Generic PETG +filament_cost = 27.82 +filament_density = 1.27 +compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.6 + +[filament:Plasty Mladec PETG @MINI] +inherits = Generic PETG; *PETMINI* +filament_vendor = Plasty Mladec filament_cost = 27.82 filament_density = 1.27 compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.6 [filament:Generic ABS @MINI] inherits = Generic ABS; *ABSMINI* +filament_vendor = Generic # alias = Generic ABS filament_cost = 27.82 filament_density = 1.08 +[filament:Esun ABS @MINI] +inherits = Generic ABS; *ABSMINI* +filament_vendor = Esun +filament_cost = 27.82 +filament_density = 1.08 + +[filament:Hatchbox ABS @MINI] +inherits = Generic ABS; *ABSMINI* +filament_vendor = Hatchbox +filament_cost = 27.82 +filament_density = 1.08 + +[filament:Plasty Mladec ABS @MINI] +inherits = Generic ABS; *ABSMINI* +filament_vendor = Plasty Mladec +filament_cost = 27.82 +filament_density = 1.08 + [filament:Prusament PETG @MINI] inherits = Prusament PETG; *PETMINI* +filament_vendor = Prusa Polymers # alias = Prusament PETG first_layer_temperature = 240 temperature = 250 @@ -2411,9 +2536,14 @@ temperature = 250 filament_density = 1.27 filament_cost = 24.99 -[filament:Generic PET @0.6 nozzle MINI] -inherits = Generic PET; *PETMINI06* -# alias = Generic PET +[filament:Generic PETG @0.6 nozzle MINI] +inherits = Generic PETG; *PETMINI06* +# alias = Generic PETG + +[filament:Plasty Mladec PETG @0.6 nozzle MINI] +inherits = Generic PETG; *PETMINI06* +filament_vendor = Plasty Mladec +# alias = Generic PETG [filament:Prusament ASA @MINI] inherits = Prusament ASA; *ABSMINI* @@ -2684,17 +2814,17 @@ filament_cost = 56.9 filament_density = 1.26 filament_type = EDGE -[filament:Prusa PET @MINI] +[filament:Prusa PETG @MINI] inherits = *PETMINI* -# alias = Prusa PET +# alias = Prusa PETG filament_vendor = Made for Prusa filament_cost = 27.82 filament_density = 1.27 compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.6 -[filament:Prusa PET @0.6 nozzle MINI] +[filament:Prusa PETG @0.6 nozzle MINI] inherits = *PETMINI06* -# alias = Prusa PET +# alias = Prusa PETG filament_vendor = Made for Prusa filament_cost = 27.82 filament_density = 1.27 diff --git a/src/admesh/connect.cpp b/src/admesh/connect.cpp index d6de6ce6a4..c266c724c4 100644 --- a/src/admesh/connect.cpp +++ b/src/admesh/connect.cpp @@ -601,11 +601,12 @@ void stl_remove_unconnected_facets(stl_file *stl) stl->neighbors_start[facet].which_vertex_not[edge[1]], stl->neighbors_start[facet].which_vertex_not[edge[2]] }; + // Update statistics on edge connectivity. - if (neighbor[0] == -1) - stl_update_connects_remove_1(neighbor[1]); - if (neighbor[1] == -1) - stl_update_connects_remove_1(neighbor[0]); + if ((neighbor[0] == -1) && (neighbor[1] != -1)) + stl_update_connects_remove_1(neighbor[1]); + if ((neighbor[1] == -1) && (neighbor[0] != -1)) + stl_update_connects_remove_1(neighbor[0]); if (neighbor[0] >= 0) { if (neighbor[1] >= 0) { diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 38a009319f..b26b2cae8d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -803,6 +803,7 @@ void GCode::_do_export(Print& print, FILE* file) // resets time estimators m_normal_time_estimator.reset(); m_normal_time_estimator.set_dialect(print.config().gcode_flavor); + m_normal_time_estimator.set_extrusion_axis(print.config().get_extrusion_axis()[0]); m_silent_time_estimator_enabled = (print.config().gcode_flavor == gcfMarlin) && print.config().silent_mode; // Until we have a UI support for the other firmwares than the Marlin, use the hardcoded default values @@ -832,6 +833,7 @@ void GCode::_do_export(Print& print, FILE* file) { m_silent_time_estimator.reset(); m_silent_time_estimator.set_dialect(print.config().gcode_flavor); + m_silent_time_estimator.set_extrusion_axis(print.config().get_extrusion_axis()[0]); /* "Stealth mode" values can be just a copy of "normal mode" values * (when they aren't input for a printer preset). * Thus, use back value from values, instead of second one, which could be absent @@ -881,6 +883,9 @@ void GCode::_do_export(Print& print, FILE* file) } m_analyzer.set_extruder_offsets(extruder_offsets); + // tell analyzer about the extrusion axis + m_analyzer.set_extrusion_axis(print.config().get_extrusion_axis()[0]); + // send extruders count to analyzer to allow it to detect invalid extruder idxs const ConfigOptionStrings* extruders_opt = dynamic_cast(print.config().option("extruder_colour")); const ConfigOptionStrings* filamemts_opt = dynamic_cast(print.config().option("filament_colour")); diff --git a/src/libslic3r/GCode/Analyzer.cpp b/src/libslic3r/GCode/Analyzer.cpp index f73f4b4ba1..7b8004ab05 100644 --- a/src/libslic3r/GCode/Analyzer.cpp +++ b/src/libslic3r/GCode/Analyzer.cpp @@ -108,16 +108,6 @@ GCodeAnalyzer::GCodeMove::GCodeMove(GCodeMove::EType type, const GCodeAnalyzer:: { } -GCodeAnalyzer::GCodeAnalyzer() -{ - reset(); -} - -void GCodeAnalyzer::set_extruder_offsets(const GCodeAnalyzer::ExtruderOffsetsMap& extruder_offsets) -{ - m_extruder_offsets = extruder_offsets; -} - void GCodeAnalyzer::set_extruders_count(unsigned int count) { m_extruders_count = count; @@ -125,11 +115,6 @@ void GCodeAnalyzer::set_extruders_count(unsigned int count) m_extruder_color[i] = i; } -void GCodeAnalyzer::set_gcode_flavor(const GCodeFlavor& flavor) -{ - m_gcode_flavor = flavor; -} - void GCodeAnalyzer::reset() { _set_units(Millimeters); diff --git a/src/libslic3r/GCode/Analyzer.hpp b/src/libslic3r/GCode/Analyzer.hpp index 4ca9b1e161..781c3f265f 100644 --- a/src/libslic3r/GCode/Analyzer.hpp +++ b/src/libslic3r/GCode/Analyzer.hpp @@ -123,12 +123,14 @@ private: std::string m_process_output; public: - GCodeAnalyzer(); + GCodeAnalyzer() { reset(); } - void set_extruder_offsets(const ExtruderOffsetsMap& extruder_offsets); + void set_extruder_offsets(const ExtruderOffsetsMap& extruder_offsets) { m_extruder_offsets = extruder_offsets; } void set_extruders_count(unsigned int count); - void set_gcode_flavor(const GCodeFlavor& flavor); + void set_extrusion_axis(char axis) { m_parser.set_extrusion_axis(axis); } + + void set_gcode_flavor(const GCodeFlavor& flavor) { m_gcode_flavor = flavor; } // Reinitialize the analyzer void reset(); diff --git a/src/libslic3r/GCodeReader.hpp b/src/libslic3r/GCodeReader.hpp index 24f9792675..fea581e203 100644 --- a/src/libslic3r/GCodeReader.hpp +++ b/src/libslic3r/GCodeReader.hpp @@ -119,6 +119,7 @@ public: float f() const { return m_position[F]; } char extrusion_axis() const { return m_extrusion_axis; } + void set_extrusion_axis(char axis) { m_extrusion_axis = axis; } private: const char* parse_line_internal(const char *ptr, GCodeLine &gline, std::pair &command); diff --git a/src/libslic3r/GCodeTimeEstimator.hpp b/src/libslic3r/GCodeTimeEstimator.hpp index 0219c87d1e..bd997a0470 100644 --- a/src/libslic3r/GCodeTimeEstimator.hpp +++ b/src/libslic3r/GCodeTimeEstimator.hpp @@ -342,6 +342,8 @@ namespace Slic3r { void increment_g1_line_id(); void reset_g1_line_id(); + void set_extrusion_axis(char axis) { m_parser.set_extrusion_axis(axis); } + void set_extruder_id(unsigned int id); unsigned int get_extruder_id() const; void reset_extruder_id(); diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 3a87439c2b..7f2fae7aa0 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -46,4 +46,10 @@ // Enable adaptive layer height profile #define ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE (1 && ENABLE_2_2_0_ALPHA1) +// Enable grayed variant for gizmos icons in non activable state +#define ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE (1 && ENABLE_2_2_0_ALPHA1) + +// Enable fix for view toolbar background not showing up on Mac with dark mode +#define ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX (1 && ENABLE_2_2_0_ALPHA1) + #endif // _technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index df5900d08e..a8826402fe 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1337,7 +1337,9 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const } } +#if !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX wxDEFINE_EVENT(EVT_GLCANVAS_INIT, SimpleEvent); +#endif // !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, RBtnEvent); @@ -1378,7 +1380,6 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar , m_retina_helper(nullptr) #endif , m_in_render(false) - , m_render_enabled(true) , m_bed(bed) , m_camera(camera) , m_view_toolbar(view_toolbar) @@ -1508,7 +1509,9 @@ bool GLCanvas3D::init() if (m_selection.is_enabled() && !m_selection.init()) return false; +#if !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX post_event(SimpleEvent(EVT_GLCANVAS_INIT)); +#endif // !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX m_initialized = true; @@ -1791,7 +1794,7 @@ void GLCanvas3D::update_volumes_colors_by_extruder() void GLCanvas3D::render() { - if (!m_render_enabled || m_in_render) + if (m_in_render) { // if called recursively, return m_dirty = true; @@ -4217,6 +4220,11 @@ bool GLCanvas3D::_init_toolbars() if (!_init_undoredo_toolbar()) return false; +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + if (!_init_view_toolbar()) + return false; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + return true; } @@ -4474,6 +4482,13 @@ bool GLCanvas3D::_init_undoredo_toolbar() return true; } +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX +bool GLCanvas3D::_init_view_toolbar() +{ + return wxGetApp().plater()->init_view_toolbar(); +} +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + bool GLCanvas3D::_set_current() { return m_context != nullptr && m_canvas->SetCurrent(*m_context); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 3b23a74a57..b26111cedb 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -83,7 +83,9 @@ template using Vec3dsEvent = ArrayEvent; using HeightProfileSmoothEvent = Event; +#if !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX wxDECLARE_EVENT(EVT_GLCANVAS_INIT, SimpleEvent); +#endif // !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX wxDECLARE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, RBtnEvent); wxDECLARE_EVENT(EVT_GLCANVAS_REMOVE_OBJECT, SimpleEvent); @@ -417,7 +419,6 @@ private: std::unique_ptr m_retina_helper; #endif bool m_in_render; - bool m_render_enabled; LegendTexture m_legend_texture; WarningTexture m_warning_texture; wxTimer m_timer; @@ -555,9 +556,6 @@ public: void enable_dynamic_background(bool enable); void allow_multisample(bool allow); - void enable_render(bool enable) { m_render_enabled = enable; } - bool is_render_enabled() const { return m_render_enabled; } - void zoom_to_bed(); void zoom_to_volumes(); void zoom_to_selection(); @@ -685,6 +683,9 @@ private: bool _init_toolbars(); bool _init_main_toolbar(); bool _init_undoredo_toolbar(); +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + bool _init_view_toolbar(); +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX bool _set_current(); void _resize(unsigned int w, unsigned int h); diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 07da836fce..eb73dcdfd3 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -293,6 +293,9 @@ public: bool is_any_item_pressed() const; +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + unsigned int get_items_count() const { return (unsigned int)m_items.size(); } +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX int get_item_id(const std::string& name) const; void force_left_action(int item_id, GLCanvas3D& parent) { do_action(GLToolbarItem::Left, item_id, parent, false); } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 71448cb050..e02dd5f6e7 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -466,6 +466,9 @@ void GUI_App::recreate_GUI() dlg.Update(30, _(L("Recreating")) + dots); topwindow->Destroy(); + + // For this moment ConfigWizard is deleted, invalidate it + m_wizard = nullptr; } dlg.Update(80, _(L("Loading of current presets")) + dots); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp index 862ffe41af..fb4149a9f2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp @@ -48,6 +48,13 @@ std::string GLGizmoMove3D::on_get_name() const return (_(L("Move")) + " [M]").ToUTF8().data(); } +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE +bool GLGizmoMove3D::on_is_activable() const +{ + return !m_parent.get_selection().is_empty(); +} +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + void GLGizmoMove3D::on_start_dragging() { if (m_hover_id != -1) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp index 21b1d397be..3ffaa14be6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp @@ -33,6 +33,9 @@ public: protected: virtual bool on_init(); virtual std::string on_get_name() const; +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + virtual bool on_is_activable() const; +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE virtual void on_start_dragging(); virtual void on_stop_dragging(); virtual void on_update(const UpdateData& data); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp index 9a2c72633e..aa5530e76b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp @@ -449,6 +449,13 @@ std::string GLGizmoRotate3D::on_get_name() const return (_(L("Rotate")) + " [R]").ToUTF8().data(); } +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE +bool GLGizmoRotate3D::on_is_activable() const +{ + return !m_parent.get_selection().is_empty(); +} +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + void GLGizmoRotate3D::on_start_dragging() { if ((0 <= m_hover_id) && (m_hover_id < 3)) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp index c856e5465c..c80e48b02f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp @@ -104,6 +104,9 @@ protected: if (id < 3) m_gizmos[id].disable_grabber(0); } +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + virtual bool on_is_activable() const; +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE virtual void on_start_dragging(); virtual void on_stop_dragging(); virtual void on_update(const UpdateData& data) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp index a685fb7742..0d16b6fa80 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp @@ -49,7 +49,12 @@ std::string GLGizmoScale3D::on_get_name() const bool GLGizmoScale3D::on_is_activable() const { +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + const Selection& selection = m_parent.get_selection(); + return !selection.is_empty() && !selection.is_wipe_tower(); +#else return !m_parent.get_selection().is_wipe_tower(); +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE } void GLGizmoScale3D::on_start_dragging() diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 0ac57da9f2..473a488650 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -885,7 +885,11 @@ void GLGizmosManager::do_render_overlay() const GLGizmoBase* gizmo = m_gizmos[idx].get(); unsigned int sprite_id = gizmo->get_sprite_id(); +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + int icon_idx = (m_current == idx) ? 2 : ((m_hover == idx) ? 1 : (gizmo->is_activable()? 0 : 3)); +#else int icon_idx = m_current == idx ? 2 : (m_hover == idx ? 1 : 0); +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE float u_icon_size = m_overlay_icons_size * m_overlay_scale * inv_tex_width; float v_icon_size = m_overlay_icons_size * m_overlay_scale * inv_tex_height; @@ -951,9 +955,12 @@ bool GLGizmosManager::generate_icons_texture() const } std::vector> states; - states.push_back(std::make_pair(1, false)); - states.push_back(std::make_pair(0, false)); - states.push_back(std::make_pair(0, true)); + states.push_back(std::make_pair(1, false)); // Activable + states.push_back(std::make_pair(0, false)); // Hovered + states.push_back(std::make_pair(0, true)); // Selected +#if ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE + states.push_back(std::make_pair(2, false)); // Disabled +#endif // ENABLE_GIZMO_ICONS_NON_ACTIVABLE_STATE unsigned int sprite_size_px = (unsigned int)(m_overlay_icons_size * m_overlay_scale); // // force even size diff --git a/src/slic3r/GUI/MeshUtils.cpp b/src/slic3r/GUI/MeshUtils.cpp index 62a6813a66..d344667420 100644 --- a/src/slic3r/GUI/MeshUtils.cpp +++ b/src/slic3r/GUI/MeshUtils.cpp @@ -129,10 +129,9 @@ MeshRaycaster::MeshRaycaster(const TriangleMesh& mesh) { } -MeshRaycaster::~MeshRaycaster() -{ - delete m_AABB_wrapper; -} +// Define the default destructor here. This is needed for the PIMPL with +// unique_ptr to work, the AABBWrapper is complete here. +MeshRaycaster::~MeshRaycaster() = default; Vec3f MeshRaycaster::AABBWrapper::get_hit_pos(const igl::Hit& hit) const { diff --git a/src/slic3r/GUI/MeshUtils.hpp b/src/slic3r/GUI/MeshUtils.hpp index e4c4c20d22..d05cc42065 100644 --- a/src/slic3r/GUI/MeshUtils.hpp +++ b/src/slic3r/GUI/MeshUtils.hpp @@ -17,7 +17,7 @@ namespace GUI { struct Camera; - +// lm_FIXME: Following class might possibly be replaced by Eigen::Hyperplane class ClippingPlane { double m_data[4]; @@ -67,13 +67,23 @@ public: }; - +// MeshClipper class cuts a mesh and is able to return a triangulated cut. class MeshClipper { public: + // Inform MeshClipper about which plane we want to use to cut the mesh + // This is supposed to be in world coordinates. void set_plane(const ClippingPlane& plane); + + // Which mesh to cut. MeshClipper remembers const * to it, caller + // must make sure that it stays valid. void set_mesh(const TriangleMesh& mesh); + + // Inform the MeshClipper about the transformation that transforms the mesh + // into world coordinates. void set_transformation(const Geometry::Transformation& trafo); + // Return the triangulated cut. The points are returned directly + // in world coordinates. const std::vector& get_triangles(); private: @@ -90,26 +100,45 @@ private: - +// MeshRaycaster class answers queries such as where on the mesh someone clicked, +// whether certain points are visible or obscured by the mesh etc. class MeshRaycaster { public: + // The class saves a const* to the mesh, called is responsible + // for making sure it does not get invalid. MeshRaycaster(const TriangleMesh& mesh); + ~MeshRaycaster(); - void set_transformation(const Geometry::Transformation& trafo); - void set_camera(const Camera& camera); - bool unproject_on_mesh(const Vec2d& mouse_pos, const Transform3d& trafo, const Camera& camera, - Vec3f& position, Vec3f& normal, const ClippingPlane* clipping_plane = nullptr) const; + // Given a mouse position, this returns true in case it is on the mesh. + bool unproject_on_mesh( + const Vec2d& mouse_pos, + const Transform3d& trafo, // how to get the mesh into world coords + const Camera& camera, // current camera position + Vec3f& position, // where to save the positibon of the hit (mesh coords) + Vec3f& normal, // normal of the triangle that was hit + const ClippingPlane* clipping_plane = nullptr // clipping plane (if active) + ) const; - std::vector get_unobscured_idxs(const Geometry::Transformation& trafo, const Camera& camera, - const std::vector& points, const ClippingPlane* clipping_plane = nullptr) const; + // Given a vector of points in woorld coordinates, this returns vector + // of indices of points that are visible (i.e. not cut by clipping plane + // or obscured by part of the mesh. + std::vector get_unobscured_idxs( + const Geometry::Transformation& trafo, // how to get the mesh into world coords + const Camera& camera, // current camera position + const std::vector& points, // points in world coords + const ClippingPlane* clipping_plane = nullptr // clipping plane (if active) + ) const; + // Given a point in world coords, the method returns closest point on the mesh. + // The output is in mesh coords. + // normal* can be used to also get normal of the respective triangle. Vec3f get_closest_point(const Vec3f& point, Vec3f* normal = nullptr) const; private: // PIMPL wrapper around igl::AABB so I don't have to include the header-only IGL here class AABBWrapper; - AABBWrapper* m_AABB_wrapper; + std::unique_ptr m_AABB_wrapper; const TriangleMesh* m_mesh = nullptr; }; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 7014b96a66..028414d604 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1819,6 +1819,10 @@ struct Plater::priv bool is_preview_loaded() const { return preview->is_loaded(); } bool is_view3D_shown() const { return current_panel == view3D; } +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + bool init_view_toolbar(); +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + void reset_all_gizmos(); void update_ui_from_settings(); ProgressStatusBar* statusbar(); @@ -1964,7 +1968,9 @@ private: bool complit_init_object_menu(); bool complit_init_sla_object_menu(); bool complit_init_part_menu(); +#if !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX void init_view_toolbar(); +#endif // !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX bool can_split() const; bool layers_height_allowed() const; @@ -2116,7 +2122,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this); view3D_canvas->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this); view3D_canvas->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this); +#if !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); }); +#endif // !ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) { set_bed_shape(config->option("bed_shape")->values, @@ -3221,7 +3229,6 @@ void Plater::priv::reload_from_disk() catch (std::exception&) { // error while loading - view3D->get_canvas3d()->enable_render(true); return; } @@ -3833,8 +3840,18 @@ bool Plater::priv::complit_init_part_menu() return true; } +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX +bool Plater::priv::init_view_toolbar() +#else void Plater::priv::init_view_toolbar() +#endif //!ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX { +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + if (view_toolbar.get_items_count() > 0) + // already initialized + return true; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + BackgroundTexture::Metadata background_data; background_data.filename = "toolbar_background.png"; background_data.left = 16; @@ -3843,7 +3860,11 @@ void Plater::priv::init_view_toolbar() background_data.bottom = 16; if (!view_toolbar.init(background_data)) +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + return false; +#else return; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX view_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Left); view_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Bottom); @@ -3858,7 +3879,11 @@ void Plater::priv::init_view_toolbar() item.sprite_id = 0; item.left.action_callback = [this]() { if (this->q != nullptr) wxPostEvent(this->q, SimpleEvent(EVT_GLVIEWTOOLBAR_3D)); }; if (!view_toolbar.add_item(item)) +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + return false; +#else return; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX item.name = "Preview"; item.icon_filename = "preview.svg"; @@ -3866,10 +3891,18 @@ void Plater::priv::init_view_toolbar() item.sprite_id = 1; item.left.action_callback = [this]() { if (this->q != nullptr) wxPostEvent(this->q, SimpleEvent(EVT_GLVIEWTOOLBAR_PREVIEW)); }; if (!view_toolbar.add_item(item)) +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + return false; +#else return; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX view_toolbar.select_item("3D"); view_toolbar.set_enabled(true); + +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + return true; +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX } bool Plater::priv::can_set_instance_to_object() const @@ -5242,6 +5275,13 @@ void Plater::msw_rescale() GetParent()->Layout(); } +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX +bool Plater::init_view_toolbar() +{ + return p->init_view_toolbar(); +} +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + const Camera& Plater::get_camera() const { return p->camera; diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 5c36dbf5e0..33140c4f5d 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -261,6 +261,10 @@ public: void msw_rescale(); +#if ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + bool init_view_toolbar(); +#endif // ENABLE_VIEW_TOOLBAR_BACKGROUND_FIX + const Camera& get_camera() const; const Mouse3DController& get_mouse3d_controller() const; Mouse3DController& get_mouse3d_controller();