Fixed conflicts after merge with master

This commit is contained in:
enricoturri1966 2021-07-23 11:40:07 +02:00
commit 8df2525355
20 changed files with 338 additions and 89 deletions

View File

@ -1,4 +1,5 @@
min_slic3r_version = 2.4.0-alpha0
1.4.0-alpha5 Added multiple add:north and Extrudr filament profiles. Updated support head settings (SL1S).
1.4.0-alpha4 Decreased Area Fill (SL1S).
1.4.0-alpha3 Updated SL1S tilt times.
1.4.0-alpha2 Updated Prusa MINI machine limits.
@ -8,8 +9,10 @@ min_slic3r_version = 2.4.0-alpha0
1.3.0-alpha1 Added Prusament PCCF. Increased travel acceleration for Prusa MINI. Updated start g-code for Prusa MINI. Added multiple add:north and Extrudr filament profiles. Updated Z travel speed values.
1.3.0-alpha0 Disabled thick bridges, updated support settings.
min_slic3r_version = 2.3.2-alpha0
1.3.1 Added multiple add:north and Extrudr filament profiles. Updated support head settings (SL1S).
1.3.0 Added SL1S profiles.
min_slic3r_version = 2.3.0-rc1
1.2.8 Added multiple add:north and Extrudr filament profiles.
1.2.7 Updated "Prusament PC Blend Carbon Fiber" profile for Prusa MINI.
1.2.6 Added filament profile for "Prusament PC Blend Carbon Fiber".
1.2.5 Updated firmware version. Added filament profiles. Various improvements.

View File

@ -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.0-alpha4
config_version = 1.4.0-alpha5
# 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%
@ -2025,7 +2025,7 @@ first_layer_temperature = 220
temperature = 220
filament_max_volumetric_speed = 10
compatible_printers_condition = ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
filament_spool_weight = 0
filament_spool_weight = 230
[filament:Extrudr PETG]
inherits = *PET*
@ -2040,7 +2040,7 @@ temperature = 220
slowdown_below_layer_time = 20
filament_retract_length = nil
filament_retract_lift = nil
filament_spool_weight = 0
filament_spool_weight = 262
full_fan_speed_layer = 0
compatible_printers_condition = printer_model!="MINI" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
@ -2056,6 +2056,7 @@ filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=198"
first_layer_temperature = 235
temperature = 235
compatible_printers_condition = nozzle_diameter[0]>=0.4 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_spool_weight = 230
[filament:Extrudr XPETG CF @MINI]
inherits = Extrudr XPETG CF; *PETMINI*
@ -2086,7 +2087,7 @@ max_fan_speed = 45
min_fan_speed = 25
slowdown_below_layer_time = 20
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.07{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 K18{elsif nozzle_diameter[0]==0.8};{else}M900 K43{endif} ; Filament gcode LA 1.0"
filament_spool_weight = 0
filament_spool_weight = 230
[filament:Extrudr Flax]
inherits = *PLA*
@ -2100,19 +2101,19 @@ max_fan_speed = 80
min_fan_speed = 30
full_fan_speed_layer = 0
slowdown_below_layer_time = 20
filament_max_volumetric_speed = 10
filament_spool_weight = 0
filament_max_volumetric_speed = 11
filament_spool_weight = 262
[filament:Extrudr GreenTEC]
inherits = *PLA*
filament_vendor = Extrudr
filament_cost = 23.63
filament_density = 1.35
filament_cost = 56
filament_density = 1.3
filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=106"
first_layer_temperature = 208
temperature = 208
slowdown_below_layer_time = 20
filament_spool_weight = 0
filament_spool_weight = 230
[filament:Extrudr GreenTEC Pro]
inherits = *PLA*
@ -2125,7 +2126,7 @@ max_fan_speed = 80
min_fan_speed = 30
full_fan_speed_layer = 0
slowdown_below_layer_time = 20
filament_spool_weight = 0
filament_spool_weight = 230
[filament:Extrudr GreenTEC Pro Carbon]
inherits = *PLA*
@ -2139,7 +2140,7 @@ min_fan_speed = 30
temperature = 225
full_fan_speed_layer = 0
slowdown_below_layer_time = 20
filament_spool_weight = 0
filament_spool_weight = 230
compatible_printers_condition = nozzle_diameter[0]>=0.4 and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
[filament:Extrudr PLA NX1]
@ -2156,7 +2157,7 @@ full_fan_speed_layer = 0
max_fan_speed = 90
min_fan_speed = 30
slowdown_below_layer_time = 20
filament_spool_weight = 0
filament_spool_weight = 262
[filament:Extrudr PLA NX2]
inherits = Extrudr PLA NX1
@ -2176,7 +2177,7 @@ filament_max_volumetric_speed = 3
filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=115"
filament_retract_length = 0.4
filament_wipe = nil
filament_spool_weight = 0
filament_spool_weight = 230
slowdown_below_layer_time = 20
[filament:Extrudr Flex Medium]
@ -2191,7 +2192,7 @@ filament_max_volumetric_speed = 2
filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=115"
filament_retract_length = 0.4
filament_wipe = nil
filament_spool_weight = 0
filament_spool_weight = 230
slowdown_below_layer_time = 20
[filament:Extrudr Flex SemiSoft]
@ -2206,7 +2207,7 @@ filament_max_volumetric_speed = 1.2
filament_notes = "https://www.extrudr.com/en/products/catalogue/?material=115"
filament_retract_length = 0.4
filament_wipe = nil
filament_spool_weight = 0
filament_spool_weight = 230
slowdown_below_layer_time = 20
[filament:addnorth Adamant S1]
@ -2221,6 +2222,7 @@ bed_temperature = 50
first_layer_temperature = 245
first_layer_bed_temperature = 50
slowdown_below_layer_time = 20
min_print_speed = 20
fan_below_layer_time = 15
fan_always_on = 1
cooling = 1
@ -2233,6 +2235,7 @@ filament_retract_length = 0.6
filament_retract_lift = 0.5
filament_spool_weight = 0
filament_retract_restart_extra = 0.1
filament_wipe = nil
[filament:addnorth Adura X]
inherits = *PET*
@ -2257,14 +2260,23 @@ full_fan_speed_layer = 0
filament_retract_length = 1.4
filament_retract_lift = 0.4
filament_max_volumetric_speed = 4
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.01{elsif nozzle_diameter[0]==0.6}0.04{else}0.05{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 K18{elsif nozzle_diameter[0]==0.8};{else}M900 K30{endif} ; Filament gcode LA 1.0"
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 K24{elsif nozzle_diameter[0]==0.8};{else}M900 K45{endif} ; Filament gcode LA 1.0"
filament_spool_weight = 0
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model!="MINI" and printer_model!="MK2SMM" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
## [filament:addnorth Adura X @MINI]
## inherits = addnorth Adura X
## filament_retract_length = nil
## filament_retract_lift = nil
## compatible_printers_condition = printer_model=="MINI"
[filament:addnorth Adura X @MINI]
inherits = addnorth Adura X
filament_retract_length = nil
filament_retract_lift = nil
filament_retract_speed = 40
filament_deretract_speed = 25
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model=="MINI"
[filament:addnorth Adura X @MMU1]
inherits = addnorth Adura X
filament_retract_length = nil
filament_retract_lift = nil
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model=="MK2SMM"
[filament:addnorth E-PLA]
inherits = *PLA*
@ -2304,13 +2316,21 @@ filament_retract_lift = 0
filament_max_volumetric_speed = 2
filament_spool_weight = 0
## [filament:addnorth ESD-PETG @MINI]
## inherits = addnorth ESD-PETG
## filament_retract_length = nil
## filament_max_volumetric_speed = 2
## compatible_printers_condition = printer_model=="MINI"
[filament:addnorth ESD-PETG @MINI]
inherits = addnorth ESD-PETG
filament_retract_length = nil
filament_retract_speed = 40
filament_deretract_speed = 25
filament_max_volumetric_speed = 2
compatible_printers_condition = printer_model=="MINI"
[filament:addnorth OBC]
[filament:addnorth ESD-PETG @MMU1]
inherits = addnorth ESD-PETG
filament_retract_length = nil
filament_max_volumetric_speed = 2
compatible_printers_condition = printer_model=="MK2SMM"
[filament:addnorth OBC Polyethylene]
inherits = *FLEX*
filament_vendor = addnorth
disable_fan_first_layers = 3
@ -2363,9 +2383,18 @@ filament_spool_weight = 0
inherits = addnorth PETG
filament_retract_length = nil
filament_retract_lift = nil
filament_retract_speed = 40
filament_deretract_speed = 25
filament_max_volumetric_speed = 7
compatible_printers_condition = printer_model=="MINI"
[filament:addnorth PETG @MMU1]
inherits = addnorth PETG
filament_retract_length = nil
filament_retract_lift = nil
filament_max_volumetric_speed = 7
compatible_printers_condition = printer_model=="MK2SMM"
[filament:addnorth Rigid X]
inherits = *PET*
filament_vendor = addnorth
@ -2389,14 +2418,21 @@ filament_retract_length = 1.4
filament_max_volumetric_speed = 5
filament_spool_weight = 0
filament_notes = "Please use a nozzle that is resistant to abrasive filaments, like hardened steel."
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model!="MINI" and printer_model!="MK2SMM" and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
## [filament:addnorth Rigid X @MINI]
## inherits = addnorth Rigid X
## filament_retract_length = nil
## filament_retract_lift = nil
## filament_max_volumetric_speed = 5
## filament_notes = "Please use a nozzle that is resistant to abrasive filaments, like hardened steel."
## compatible_printers_condition = printer_model=="MINI"
[filament:addnorth Rigid X @MINI]
inherits = addnorth Rigid X
filament_retract_length = nil
filament_retract_lift = nil
filament_retract_speed = 40
filament_deretract_speed = 25
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model=="MINI"
[filament:addnorth Rigid X @MMU1]
inherits = addnorth Rigid X
filament_retract_length = nil
filament_retract_lift = nil
compatible_printers_condition = nozzle_diameter[0]>=0.4 and printer_model=="MK2SMM"
[filament:addnorth Textura]
inherits = *PLA*
@ -2418,10 +2454,15 @@ filament_spool_weight = 0
filament_retract_length = 1
compatible_printers_condition = 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:addnorth Textura @MINI]
## inherits = addnorth Textura
## filament_retract_length = nil
## compatible_printers_condition = printer_model=="MINI"
[filament:addnorth Textura @MINI]
inherits = addnorth Textura
filament_retract_length = nil
compatible_printers_condition = printer_model=="MINI"
[filament:addnorth Textura @MMU1]
inherits = addnorth Textura
filament_retract_length = nil
compatible_printers_condition = printer_model=="MK2SMM"
[filament:Filament PM PETG]
inherits = *PET*
@ -2481,16 +2522,43 @@ filament_cost = 33.99
filament_density = 1.20
filament_spool_weight = 230
filament_max_volumetric_speed = 1.2
filament_retract_length = 0
filament_retract_length = 0.4
filament_retract_speed = nil
filament_retract_lift = nil
filament_deretract_speed = 20
fan_always_on = 1
cooling = 0
max_fan_speed = 50
min_fan_speed = 50
max_fan_speed = 60
min_fan_speed = 60
disable_fan_first_layers = 4
full_fan_speed_layer = 6
[filament:AmazonBasics TPU]
inherits = *FLEX*
filament_vendor = AmazonBasics
fan_always_on = 1
filament_max_volumetric_speed = 1.8
extrusion_multiplier = 1.14
first_layer_temperature = 235
first_layer_bed_temperature = 50
temperature = 235
bed_temperature = 50
bridge_fan_speed = 100
max_fan_speed = 80
min_fan_speed = 80
filament_retract_before_travel = 3
filament_cost = 19.99
filament_density = 1.21
filament_retract_length = 2
filament_retract_speed = 45
filament_deretract_speed = 20
filament_retract_lift = 0
filament_wipe = 0
disable_fan_first_layers = 4
full_fan_speed_layer = 6
min_print_speed = 15
slowdown_below_layer_time = 10
cooling = 1
[filament:SainSmart TPU]
inherits = *FLEX*
filament_vendor = SainSmart
@ -3068,12 +3136,19 @@ filament_cost = 35.48
filament_density = 1.24
filament_spool_weight = 230
[filament:SemiFlex or Flexfill 98A]
[filament:SemiFlex]
inherits = *FLEX*
renamed_from = "SemiFlex or Flexfill 98A"
filament_vendor = Generic
filament_cost = 82.26
filament_density = 1.22
extrusion_multiplier = 1.12
filament_max_volumetric_speed = 1.35
fan_always_on = 1
cooling = 0
max_fan_speed = 30
min_fan_speed = 30
filament_retract_length = nil
[filament:Fillamentum Flexfill 98A]
inherits = *FLEX*
@ -3081,13 +3156,16 @@ filament_vendor = Fillamentum
filament_cost = 82.26
filament_density = 1.23
filament_spool_weight = 230
extrusion_multiplier = 1.12
filament_max_volumetric_speed = 1.35
fan_always_on = 1
cooling = 0
max_fan_speed = 50
min_fan_speed = 50
max_fan_speed = 60
min_fan_speed = 60
disable_fan_first_layers = 4
full_fan_speed_layer = 6
filament_retract_length = 1.2
filament_deretract_speed = 20
[filament:Taulman Bridge]
inherits = *common*
@ -3410,16 +3488,22 @@ fan_always_on = 1
max_fan_speed = 15
min_fan_speed = 15
[filament:SemiFlex or Flexfill 98A @MMU1]
[filament:SemiFlex @MMU1]
inherits = *FLEX*
renamed_from = "SemiFlex or Flexfill 98A @MMU1"
filament_vendor = Generic
filament_cost = 82.26
filament_density = 1.22
extrusion_multiplier = 1.12
filament_max_volumetric_speed = 1.35
filament_retract_length = nil
filament_retract_speed = nil
filament_retract_lift = nil
compatible_printers_condition = printer_model=="MK2SMM"
fan_always_on = 1
cooling = 0
max_fan_speed = 30
min_fan_speed = 30
[filament:Generic FLEX @MMU1]
inherits = *FLEX*
@ -3550,16 +3634,18 @@ bed_temperature = 100
compatible_printers_condition = printer_model=="MINI" and nozzle_diameter[0]!=0.8
[filament:Fillamentum Flexfill 98A @MINI]
inherits = SemiFlex or Flexfill 98A; *FLEXMINI*
inherits = SemiFlex; *FLEXMINI*
filament_vendor = Fillamentum
first_layer_temperature = 240
temperature = 240
filament_max_volumetric_speed = 1.35
filament_cost = 82.26
filament_spool_weight = 230
max_fan_speed = 60
min_fan_speed = 60
[filament:Generic FLEX @MINI]
inherits = SemiFlex or Flexfill 98A; *FLEXMINI*
inherits = SemiFlex; *FLEXMINI*
filament_vendor = Generic
fan_always_on = 0
bridge_fan_speed = 80
@ -3639,8 +3725,8 @@ filament_cost = 33.95
bridge_fan_speed = 70
fan_always_on = 1
cooling = 0
max_fan_speed = 50
min_fan_speed = 50
max_fan_speed = 60
min_fan_speed = 60
filament_max_volumetric_speed = 1.2
compatible_printers_condition = nozzle_diameter[0]>0.35 and printer_model=="MINI"
disable_fan_first_layers = 4
@ -4080,6 +4166,8 @@ layer_height = 0.05
[sla_print:0.1 Fast @SL1S]
inherits = *SL1S*
layer_height = 0.1
support_head_front_diameter = 0.6
support_head_penetration = 0.6
########### Materials

View File

@ -1762,7 +1762,11 @@ namespace ProcessLayer
assert(m600_extruder_before_layer >= 0);
// Color Change or Tool Change as Color Change.
// add tag for processor
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Color_Change) + ",T" + std::to_string(m600_extruder_before_layer) + "," + custom_gcode->color + "\n";
#else
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Color_Change) + ",T" + std::to_string(m600_extruder_before_layer) + "\n";
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (!single_extruder_printer && m600_extruder_before_layer >= 0 && first_extruder_id != (unsigned)m600_extruder_before_layer
// && !MMU1

View File

@ -684,6 +684,9 @@ void GCodeProcessor::Result::reset() {
extruder_colors = std::vector<std::string>();
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
time = 0;
}
#else
@ -695,6 +698,9 @@ void GCodeProcessor::Result::reset() {
extruder_colors = std::vector<std::string>();
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
}
#endif // ENABLE_GCODE_VIEWER_STATISTICS
@ -1125,6 +1131,9 @@ void GCodeProcessor::reset()
m_result.id = ++s_result_id;
m_use_volumetric_e = false;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
m_last_default_color_id = 0;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.reset();
@ -1521,6 +1530,56 @@ void GCodeProcessor::process_tags(const std::string_view comment)
// color change tag
if (boost::starts_with(comment, reserved_tag(ETags::Color_Change))) {
unsigned char extruder_id = 0;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
static std::vector<std::string> Default_Colors = {
"#0B2C7A", // { 0.043f, 0.173f, 0.478f }, // bluish
"#1C8891", // { 0.110f, 0.533f, 0.569f },
"#AAF200", // { 0.667f, 0.949f, 0.000f },
"#F5CE0A", // { 0.961f, 0.808f, 0.039f },
"#D16830", // { 0.820f, 0.408f, 0.188f },
"#942616", // { 0.581f, 0.149f, 0.087f } // reddish
};
std::string color = Default_Colors[0];
auto is_valid_color = [](const std::string& color) {
auto is_hex_digit = [](char c) {
return ((c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f'));
};
if (color[0] != '#' || color.length() != 7)
return false;
for (int i = 1; i <= 6; ++i) {
if (!is_hex_digit(color[i]))
return false;
}
return true;
};
std::vector<std::string> tokens;
boost::split(tokens, comment, boost::is_any_of(","), boost::token_compress_on);
if (tokens.size() > 1) {
if (tokens[1][0] == 'T') {
int eid;
if (!parse_number(tokens[1].substr(1), eid) || eid < 0 || eid > 255) {
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Color_Change (" << comment << ").";
return;
}
extruder_id = static_cast<unsigned char>(eid);
}
}
if (tokens.size() > 2) {
if (is_valid_color(tokens[2]))
color = tokens[2];
}
else {
color = Default_Colors[m_last_default_color_id];
++m_last_default_color_id;
if (m_last_default_color_id == Default_Colors.size())
m_last_default_color_id = 0;
}
#else
if (boost::starts_with(comment.substr(reserved_tag(ETags::Color_Change).size()), ",T")) {
int eid;
if (!parse_number(comment.substr(reserved_tag(ETags::Color_Change).size() + 2), eid) || eid < 0 || eid > 255) {
@ -1529,6 +1588,7 @@ void GCodeProcessor::process_tags(const std::string_view comment)
}
extruder_id = static_cast<unsigned char>(eid);
}
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (extruder_id < m_extruder_colors.size())
m_extruder_colors[extruder_id] = static_cast<unsigned char>(m_extruder_offsets.size()) + m_cp_color.counter; // color_change position in list of color for preview
@ -1539,10 +1599,18 @@ void GCodeProcessor::process_tags(const std::string_view comment)
if (m_extruder_id == extruder_id) {
m_cp_color.current = m_extruder_colors[extruder_id];
store_move_vertex(EMoveType::Color_change);
}
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
CustomGCode::Item item = { static_cast<double>(m_end_position[2]), CustomGCode::ColorChange, extruder_id + 1, color, "" };
m_result.custom_gcode_per_print_z.emplace_back(item);
process_custom_gcode_time(CustomGCode::ColorChange);
process_filaments(CustomGCode::ColorChange);
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
}
#if !ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
process_custom_gcode_time(CustomGCode::ColorChange);
process_filaments(CustomGCode::ColorChange);
#endif // !ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
return;
}
@ -1550,6 +1618,10 @@ void GCodeProcessor::process_tags(const std::string_view comment)
// pause print tag
if (comment == reserved_tag(ETags::Pause_Print)) {
store_move_vertex(EMoveType::Pause_Print);
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
CustomGCode::Item item = { static_cast<double>(m_end_position[2]), CustomGCode::PausePrint, m_extruder_id + 1, "", "" };
m_result.custom_gcode_per_print_z.emplace_back(item);
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
process_custom_gcode_time(CustomGCode::PausePrint);
return;
}
@ -1557,6 +1629,10 @@ void GCodeProcessor::process_tags(const std::string_view comment)
// custom code tag
if (comment == reserved_tag(ETags::Custom_Code)) {
store_move_vertex(EMoveType::Custom_GCode);
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
CustomGCode::Item item = { static_cast<double>(m_end_position[2]), CustomGCode::Custom, m_extruder_id + 1, "", "" };
m_result.custom_gcode_per_print_z.emplace_back(item);
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
return;
}

View File

@ -352,6 +352,9 @@ namespace Slic3r {
std::vector<float> filament_diameters;
std::vector<float> filament_densities;
PrintEstimatedStatistics print_statistics;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
#if ENABLE_GCODE_VIEWER_STATISTICS
int64_t time{ 0 };
@ -484,6 +487,9 @@ namespace Slic3r {
CpColor m_cp_color;
bool m_use_volumetric_e;
SeamsDetector m_seams_detector;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
size_t m_last_default_color_id;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
enum class EProducer
{

View File

@ -47,6 +47,8 @@
#define ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW (0 && ENABLE_PROJECT_DIRTY_STATE)
// Enable delayed rendering of transparent volumes
#define ENABLE_DELAYED_TRANSPARENT_VOLUMES_RENDERING (1 && ENABLE_2_4_0_ALPHA0)
// Enable the fix of importing color print view from gcode files into GCodeViewer
#define ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER (1 && ENABLE_2_4_0_ALPHA0)
// Enable drawing contours, at cut level, for sinking volumes
#define ENABLE_SINKING_CONTOURS (1 && ENABLE_2_4_0_ALPHA0)

View File

@ -1551,6 +1551,9 @@ void Control::OnMotion(wxMouseEvent& event)
event.Skip();
// Set tooltips with information for each icon
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (GUI::wxGetApp().is_editor())
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
this->SetToolTip(get_tooltip(tick));
if (action) {

View File

@ -586,6 +586,11 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
m_sequential_view.gcode_window.set_filename(gcode_result.filename);
m_sequential_view.gcode_window.load_gcode();
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (wxGetApp().is_gcode_viewer())
m_custom_gcode_per_print_z = gcode_result.custom_gcode_per_print_z;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
load_toolpaths(gcode_result);
if (m_layers.empty())
@ -743,6 +748,9 @@ void GCodeViewer::reset()
m_layers_z_range = { 0, 0 };
m_roles = std::vector<ExtrusionRole>();
m_print_statistics.reset();
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
m_custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
m_sequential_view.gcode_window.reset();
#if ENABLE_GCODE_VIEWER_STATISTICS
m_statistics.reset_all();
@ -2939,7 +2947,11 @@ void GCodeViewer::render_legend(float& legend_height) const
}
case EViewType::ColorPrint:
{
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
const std::vector<CustomGCode::Item>& custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes : m_custom_gcode_per_print_z;
#else
const std::vector<CustomGCode::Item>& custom_gcode_per_print_z = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
size_t total_items = 1;
for (unsigned char i : m_extruder_ids) {
total_items += color_print_ranges(i, custom_gcode_per_print_z).size();
@ -3034,7 +3046,11 @@ void GCodeViewer::render_legend(float& legend_height) const
auto generate_partial_times = [this, get_used_filament_from_volume](const TimesList& times, const std::vector<double>& used_filaments) {
PartialTimes items;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<CustomGCode::Item> custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes : m_custom_gcode_per_print_z;
#else
std::vector<CustomGCode::Item> custom_gcode_per_print_z = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
int extruders_count = wxGetApp().extruders_edited_cnt();
std::vector<Color> last_color(extruders_count);
for (int i = 0; i < extruders_count; ++i) {

View File

@ -616,6 +616,10 @@ private:
GCodeProcessor::Result::SettingsIds m_settings_ids;
std::array<SequentialRangeCap, 2> m_sequential_range_caps;
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<CustomGCode::Item> m_custom_gcode_per_print_z;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
public:
GCodeViewer();
~GCodeViewer() { reset(); }
@ -665,6 +669,10 @@ public:
void stop_mapping_gcode_window();
void toggle_gcode_window_visibility() { m_sequential_view.gcode_window.toggle_visibility(); }
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_custom_gcode_per_print_z; }
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
private:
void load_toolpaths(const GCodeProcessor::Result& gcode_result);
void load_shells(const Print& print, bool initialized);

View File

@ -254,7 +254,7 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
float widget_align = ImGui::GetCursorPosX();
ImGui::PushItemWidth(imgui.get_style_scaling() * 120.0f);
m_adaptive_quality = std::clamp(m_adaptive_quality, 0.0f, 1.f);
ImGui::SliderFloat("", &m_adaptive_quality, 0.0f, 1.f, "%.2f");
imgui.slider_float("", &m_adaptive_quality, 0.0f, 1.f, "%.2f");
ImGui::Separator();
if (imgui.button(_L("Smooth")))

View File

@ -634,6 +634,9 @@ public:
void set_toolpath_view_type(GCodeViewer::EViewType type);
void set_volumes_z_range(const std::array<double, 2>& range);
void set_toolpaths_z_range(const std::array<unsigned int, 2>& range);
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<CustomGCode::Item>& get_custom_gcode_per_print_z() { return m_gcode_viewer.get_custom_gcode_per_print_z(); }
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
std::vector<int> load_object(const ModelObject& model_object, int obj_idx, std::vector<int> instance_idxs);
std::vector<int> load_object(const Model& model, int obj_idx);

View File

@ -637,11 +637,25 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
update_layers_slider_mode();
Plater* plater = wxGetApp().plater();
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
CustomGCode::Info ticks_info_from_model;
if (wxGetApp().is_editor())
ticks_info_from_model = plater->model().custom_gcode_per_print_z;
else {
ticks_info_from_model.mode = CustomGCode::Mode::SingleExtruder;
ticks_info_from_model.gcodes = m_canvas->get_custom_gcode_per_print_z();
}
#else
CustomGCode::Info& ticks_info_from_model = plater->model().custom_gcode_per_print_z;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
check_layers_slider_values(ticks_info_from_model.gcodes, layers_z);
//first of all update extruder colors to avoid crash, when we are switching printer preset from MM to SM
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
m_layers_slider->SetExtruderColors(plater->get_extruder_colors_from_plater_config(wxGetApp().is_editor() ? nullptr : m_gcode_result));
#else
m_layers_slider->SetExtruderColors(plater->get_extruder_colors_from_plater_config());
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
m_layers_slider->SetSliderValues(layers_z);
assert(m_layers_slider->GetMinValue() == 0);
@ -904,7 +918,14 @@ void Preview::load_print_as_fff(bool keep_z_range)
colors = wxGetApp().plater()->get_colors_for_color_print(m_gcode_result);
if (!gcode_preview_data_valid) {
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (wxGetApp().is_editor())
color_print_values = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
else
color_print_values = m_canvas->get_custom_gcode_per_print_z();
#else
color_print_values = wxGetApp().plater()->model().custom_gcode_per_print_z.gcodes;
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
colors.push_back("#808080"); // gray color for pause print or custom G-code
}
}

View File

@ -152,6 +152,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
if (m_imgui->button(m_desc["enforce_button"], buttons_width, 0.f)) {
select_facets_by_angle(m_angle_threshold_deg, false);
m_angle_threshold_deg = 0.f;
m_parent.use_slope(false);
}
ImGui::SameLine(window_width - buttons_width);
if (m_imgui->button(m_desc["cancel"], buttons_width, 0.f)) {
@ -185,7 +186,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
m_imgui->text(m_desc.at("cursor_size"));
ImGui::SameLine(cursor_slider_left);
ImGui::PushItemWidth(window_width - cursor_slider_left);
ImGui::SliderFloat(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -193,8 +194,6 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
// Manually inserted values aren't clamped by ImGui. Zero cursor size results in a crash.
m_cursor_radius = std::clamp(m_cursor_radius, CursorRadiusMin, CursorRadiusMax);
ImGui::AlignTextToFramePadding();
@ -251,7 +250,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
ImGui::SameLine(clipping_slider_left);
ImGui::PushItemWidth(window_width - clipping_slider_left);
auto clp_dist = float(m_c->object_clipper()->get_position());
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {

View File

@ -545,7 +545,7 @@ RENDER_AGAIN:
m_imgui->text(m_desc.at("offset"));
ImGui::SameLine(settings_sliders_left);
ImGui::PushItemWidth(window_width - settings_sliders_left);
ImGui::SliderFloat(" ", &offset, offset_min, offset_max, "%.1f mm");
m_imgui->slider_float(" ", &offset, offset_min, offset_max, "%.1f mm");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -560,7 +560,7 @@ RENDER_AGAIN:
if (current_mode >= quality_mode) {
m_imgui->text(m_desc.at("quality"));
ImGui::SameLine(settings_sliders_left);
ImGui::SliderFloat(" ", &quality, quality_min, quality_max, "%.1f");
m_imgui->slider_float(" ", &quality, quality_min, quality_max, "%.1f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -576,7 +576,7 @@ RENDER_AGAIN:
if (current_mode >= closing_d_mode) {
m_imgui->text(m_desc.at("closing_distance"));
ImGui::SameLine(settings_sliders_left);
ImGui::SliderFloat(" ", &closing_d, closing_d_min, closing_d_max, "%.1f mm");
m_imgui->slider_float(" ", &closing_d, closing_d_min, closing_d_max, "%.1f mm");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -618,15 +618,19 @@ RENDER_AGAIN:
ImGui::Separator();
float diameter_upper_cap = 15.;
if (m_new_hole_radius > diameter_upper_cap)
m_new_hole_radius = diameter_upper_cap;
float diameter_upper_cap = 60.;
if (m_new_hole_radius * 2.f > diameter_upper_cap)
m_new_hole_radius = diameter_upper_cap / 2.f;
m_imgui->text(m_desc.at("hole_diameter"));
ImGui::SameLine(diameter_slider_left);
ImGui::PushItemWidth(window_width - diameter_slider_left);
float diam = 2.f * m_new_hole_radius;
ImGui::SliderFloat("", &diam, 1.f, diameter_upper_cap, "%.1f mm");
m_imgui->slider_float("", &diam, 1.f, 15.f, "%.1f mm", 1.f, false);
// Let's clamp the value (which could have been entered by keyboard) to a larger range
// than the slider. This allows entering off-scale values and still protects against
//complete non-sense.
diam = std::clamp(diam, 0.1f, diameter_upper_cap);
m_new_hole_radius = diam / 2.f;
bool clicked = ImGui::IsItemClicked();
bool edited = ImGui::IsItemEdited();
@ -634,7 +638,9 @@ RENDER_AGAIN:
m_imgui->text(m_desc["hole_depth"]);
ImGui::SameLine(diameter_slider_left);
ImGui::SliderFloat(" ", &m_new_hole_height, 0.f, 10.f, "%.1f mm");
m_imgui->slider_float(" ", &m_new_hole_height, 0.f, 10.f, "%.1f mm", 1.f, false);
// Same as above:
m_new_hole_height = std::clamp(m_new_hole_height, 0.f, 100.f);
clicked |= ImGui::IsItemClicked();
edited |= ImGui::IsItemEdited();
@ -699,7 +705,7 @@ RENDER_AGAIN:
ImGui::SameLine(clipping_slider_left);
ImGui::PushItemWidth(window_width - clipping_slider_left);
float clp_dist = m_c->object_clipper()->get_position();
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
// make sure supports are shown/hidden as appropriate

View File

@ -425,7 +425,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
m_imgui->text(m_desc.at("cursor_size"));
ImGui::SameLine(sliders_width);
ImGui::PushItemWidth(window_width - sliders_width);
ImGui::SliderFloat(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -433,8 +433,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
// Manually inserted values aren't clamped by ImGui. Zero cursor size results in a crash.
m_cursor_radius = std::clamp(m_cursor_radius, CursorRadiusMin, CursorRadiusMax);
m_imgui->checkbox(_L("Split triangles"), m_triangle_splitting_enabled);
@ -480,7 +478,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::SameLine(sliders_width);
ImGui::PushItemWidth(window_width - sliders_width);
auto clp_dist = float(m_c->object_clipper()->get_position());
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();

View File

@ -140,7 +140,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
m_imgui->text(m_desc.at("cursor_size"));
ImGui::SameLine(cursor_size_slider_left);
ImGui::PushItemWidth(window_width - cursor_size_slider_left);
ImGui::SliderFloat(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
m_imgui->slider_float(" ", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(max_tooltip_width);
@ -148,9 +148,6 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
// Manually inserted values aren't clamped by ImGui. Zero cursor size results in a crash.
m_cursor_radius = std::clamp(m_cursor_radius, CursorRadiusMin, CursorRadiusMax);
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("cursor_type"));
@ -203,7 +200,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
ImGui::SameLine(clipping_slider_left);
ImGui::PushItemWidth(window_width - clipping_slider_left);
auto clp_dist = float(m_c->object_clipper()->get_position());
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);
if (ImGui::IsItemHovered()) {

View File

@ -671,7 +671,7 @@ RENDER_AGAIN:
// - keep updating the head radius during sliding so it is continuosly refreshed in 3D scene
// - take correct undo/redo snapshot after the user is done with moving the slider
float initial_value = m_new_point_head_diameter;
ImGui::SliderFloat("", &m_new_point_head_diameter, 0.1f, diameter_upper_cap, "%.1f");
m_imgui->slider_float("", &m_new_point_head_diameter, 0.1f, diameter_upper_cap, "%.1f");
if (ImGui::IsItemClicked()) {
if (m_old_point_head_diameter == 0.f)
m_old_point_head_diameter = initial_value;
@ -731,7 +731,7 @@ RENDER_AGAIN:
float density = static_cast<const ConfigOptionInt*>(opts[0])->value;
float minimal_point_distance = static_cast<const ConfigOptionFloat*>(opts[1])->value;
ImGui::SliderFloat("", &minimal_point_distance, 0.f, 20.f, "%.f mm");
m_imgui->slider_float("", &minimal_point_distance, 0.f, 20.f, "%.f mm");
bool slider_clicked = ImGui::IsItemClicked(); // someone clicked the slider
bool slider_edited = ImGui::IsItemEdited(); // someone is dragging the slider
bool slider_released = ImGui::IsItemDeactivatedAfterEdit(); // someone has just released the slider
@ -740,7 +740,7 @@ RENDER_AGAIN:
m_imgui->text(m_desc.at("points_density"));
ImGui::SameLine(settings_sliders_left);
ImGui::SliderFloat(" ", &density, 0.f, 200.f, "%.f %%");
m_imgui->slider_float(" ", &density, 0.f, 200.f, "%.f %%");
slider_clicked |= ImGui::IsItemClicked();
slider_edited |= ImGui::IsItemEdited();
slider_released |= ImGui::IsItemDeactivatedAfterEdit();
@ -801,7 +801,7 @@ RENDER_AGAIN:
ImGui::SameLine(clipping_slider_left);
ImGui::PushItemWidth(window_width - clipping_slider_left);
float clp_dist = m_c->object_clipper()->get_position();
if (ImGui::SliderFloat(" ", &clp_dist, 0.f, 1.f, "%.2f"))
if (m_imgui->slider_float(" ", &clp_dist, 0.f, 1.f, "%.2f"))
m_c->object_clipper()->set_position(clp_dist, true);

View File

@ -406,20 +406,23 @@ void ImGuiWrapper::text_colored(const ImVec4& color, const wxString& label)
this->text_colored(color, label_utf8.c_str());
}
bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/)
bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/)
{
return ImGui::SliderFloat(label, v, v_min, v_max, format, power);
bool ret = ImGui::SliderFloat(label, v, v_min, v_max, format, power);
if (clamp)
*v = std::clamp(*v, v_min, v_max);
return ret;
}
bool ImGuiWrapper::slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/)
bool ImGuiWrapper::slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/)
{
return this->slider_float(label.c_str(), v, v_min, v_max, format, power);
return this->slider_float(label.c_str(), v, v_min, v_max, format, power, clamp);
}
bool ImGuiWrapper::slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/)
bool ImGuiWrapper::slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/, bool clamp /*= true*/)
{
auto label_utf8 = into_u8(label);
return this->slider_float(label_utf8.c_str(), v, v_min, v_max, format, power);
return this->slider_float(label_utf8.c_str(), v, v_min, v_max, format, power, clamp);
}
bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>& options, int& selection)

View File

@ -79,9 +79,12 @@ public:
void text_colored(const ImVec4& color, const char* label);
void text_colored(const ImVec4& color, const std::string& label);
void text_colored(const ImVec4& color, const wxString& label);
bool slider_float(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
bool slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
bool slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
// Float sliders: Manually inserted values aren't clamped by ImGui.Using this wrapper function does (when clamp==true).
bool slider_float(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true);
bool slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true);
bool slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f, bool clamp = true);
bool combo(const wxString& label, const std::vector<std::string>& options, int& selection); // Use -1 to not mark any option as selected
bool undo_redo_list(const ImVec2& size, const bool is_undo, bool (*items_getter)(const bool, int, const char**), int& hovered, int& selected, int& mouse_wheel);
void search_list(const ImVec2& size, bool (*items_getter)(int, const char** label, const char** tooltip), char* search_str,

View File

@ -6060,9 +6060,22 @@ std::vector<std::string> Plater::get_colors_for_color_print(const GCodeProcessor
std::vector<std::string> colors = get_extruder_colors_from_plater_config(result);
colors.reserve(colors.size() + p->model.custom_gcode_per_print_z.gcodes.size());
for (const CustomGCode::Item& code : p->model.custom_gcode_per_print_z.gcodes)
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
if (wxGetApp().is_gcode_viewer() && result != nullptr) {
for (const CustomGCode::Item& code : result->custom_gcode_per_print_z) {
if (code.type == CustomGCode::ColorChange)
colors.emplace_back(code.color);
}
}
else {
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
for (const CustomGCode::Item& code : p->model.custom_gcode_per_print_z.gcodes) {
if (code.type == CustomGCode::ColorChange)
colors.emplace_back(code.color);
}
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
}
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
return colors;
}