Fixed conflicts after merge with master

This commit is contained in:
enricoturri1966 2022-03-18 13:36:32 +01:00
commit 21e6dccc12
14 changed files with 158 additions and 53 deletions

View file

@ -741,9 +741,7 @@ void GCodeProcessorResult::reset() {
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
#if ENABLE_SPIRAL_VASE_LAYERS
spiral_vase_layers = std::vector<std::pair<float, std::pair<size_t, size_t>>>();
#endif // ENABLE_SPIRAL_VASE_LAYERS
time = 0;
}
#else
@ -759,9 +757,7 @@ void GCodeProcessorResult::reset() {
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
#if ENABLE_SPIRAL_VASE_LAYERS
spiral_vase_layers = std::vector<std::pair<float, std::pair<size_t, size_t>>>();
#endif // ENABLE_SPIRAL_VASE_LAYERS
}
#endif // ENABLE_GCODE_VIEWER_STATISTICS
@ -909,17 +905,13 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_result.max_print_height = config.max_print_height;
#if ENABLE_SPIRAL_VASE_LAYERS
const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_vase");
if (spiral_vase != nullptr)
m_spiral_vase_active = spiral_vase->value;
#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_Z_OFFSET_CORRECTION
const ConfigOptionFloat* z_offset = config.option<ConfigOptionFloat>("z_offset");
if (z_offset != nullptr)
m_z_offset = z_offset->value;
#endif // ENABLE_Z_OFFSET_CORRECTION
}
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
@ -1164,17 +1156,13 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
if (max_print_height != nullptr)
m_result.max_print_height = max_print_height->value;
#if ENABLE_SPIRAL_VASE_LAYERS
const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_vase");
if (spiral_vase != nullptr)
m_spiral_vase_active = spiral_vase->value;
#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_Z_OFFSET_CORRECTION
const ConfigOptionFloat* z_offset = config.option<ConfigOptionFloat>("z_offset");
if (z_offset != nullptr)
m_z_offset = z_offset->value;
#endif // ENABLE_Z_OFFSET_CORRECTION
}
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
@ -1207,9 +1195,7 @@ void GCodeProcessor::reset()
m_forced_height = 0.0f;
m_mm3_per_mm = 0.0f;
m_fan_speed = 0.0f;
#if ENABLE_Z_OFFSET_CORRECTION
m_z_offset = 0.0f;
#endif // ENABLE_Z_OFFSET_CORRECTION
m_extrusion_role = erNone;
m_extruder_id = 0;
@ -1242,9 +1228,7 @@ void GCodeProcessor::reset()
m_options_z_corrector.reset();
#if ENABLE_SPIRAL_VASE_LAYERS
m_spiral_vase_active = false;
#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.reset();
@ -1958,7 +1942,6 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers
// layer change tag
if (comment == reserved_tag(ETags::Layer_Change)) {
++m_layer_id;
#if ENABLE_SPIRAL_VASE_LAYERS
if (m_spiral_vase_active) {
if (m_result.moves.empty())
m_result.spiral_vase_layers.push_back({ m_first_layer_height, { 0, 0 } });
@ -1970,7 +1953,6 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers
m_result.spiral_vase_layers.push_back({ static_cast<float>(m_end_position[Z]), { move_id, move_id } });
}
}
#endif // ENABLE_SPIRAL_VASE_LAYERS
return;
}
@ -2783,11 +2765,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
// the threshold value = 0.0625f == 0.25 * 0.25 is arbitrary, we may find some smarter condition later
if ((new_pos - *first_vertex).squaredNorm() < 0.0625f) {
#if ENABLE_Z_OFFSET_CORRECTION
set_end_position(0.5f * (new_pos + *first_vertex) + m_z_offset * Vec3f::UnitZ());
#else
set_end_position(0.5f * (new_pos + *first_vertex));
#endif // ENABLE_Z_OFFSET_CORRECTION
store_move_vertex(EMoveType::Seam);
set_end_position(curr_pos);
}
@ -2800,10 +2778,8 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id]);
}
#if ENABLE_SPIRAL_VASE_LAYERS
if (m_spiral_vase_active && !m_result.spiral_vase_layers.empty() && !m_result.moves.empty())
m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1;
#endif // ENABLE_SPIRAL_VASE_LAYERS
// store move
store_move_vertex(type);
@ -3526,11 +3502,7 @@ void GCodeProcessor::store_move_vertex(EMoveType type)
m_extrusion_role,
m_extruder_id,
m_cp_color.current,
#if ENABLE_Z_OFFSET_CORRECTION
Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z] - m_z_offset) + m_extruder_offsets[m_extruder_id],
#else
Vec3f(m_end_position[X], m_end_position[Y], m_processing_start_custom_gcode ? m_first_layer_height : m_end_position[Z]) + m_extruder_offsets[m_extruder_id],
#endif // ENABLE_Z_OFFSET_CORRECTION
static_cast<float>(m_end_position[E] - m_start_position[E]),
m_feedrate,
m_width,

View file

@ -131,9 +131,7 @@ namespace Slic3r {
std::vector<float> filament_densities;
PrintEstimatedStatistics print_statistics;
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
#if ENABLE_SPIRAL_VASE_LAYERS
std::vector<std::pair<float, std::pair<size_t, size_t>>> spiral_vase_layers;
#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_GCODE_VIEWER_STATISTICS
int64_t time{ 0 };
@ -542,9 +540,7 @@ namespace Slic3r {
float m_forced_height; // mm
float m_mm3_per_mm;
float m_fan_speed; // percentage
#if ENABLE_Z_OFFSET_CORRECTION
float m_z_offset; // mm
#endif // ENABLE_Z_OFFSET_CORRECTION
ExtrusionRole m_extrusion_role;
unsigned char m_extruder_id;
ExtruderColors m_extruder_colors;
@ -559,9 +555,7 @@ namespace Slic3r {
SeamsDetector m_seams_detector;
OptionsZCorrector m_options_z_corrector;
size_t m_last_default_color_id;
#if ENABLE_SPIRAL_VASE_LAYERS
bool m_spiral_vase_active;
#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_GCODE_VIEWER_STATISTICS
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
#endif // ENABLE_GCODE_VIEWER_STATISTICS

View file

@ -36,17 +36,6 @@
#define ENABLE_SMOOTH_NORMALS 0
//================
// 2.4.1.rc techs
//================
#define ENABLE_2_4_1_RC 1
// Enable detection of layers for spiral vase prints
#define ENABLE_SPIRAL_VASE_LAYERS (1 && ENABLE_2_4_1_RC)
// Enable correction of toolpaths when z offset is set
#define ENABLE_Z_OFFSET_CORRECTION (1 && ENABLE_2_4_1_RC)
//====================
// 2.5.0.alpha1 techs
//====================
@ -84,6 +73,8 @@
#define ENABLE_NEW_CAMERA_MOVEMENTS (1 && ENABLE_2_5_0_ALPHA1)
// Enable modified rectangle selection
#define ENABLE_NEW_RECTANGLE_SELECTION (1 && ENABLE_2_5_0_ALPHA1)
// Enable alternative version of file_wildcards()
#define ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR (1 && ENABLE_2_5_0_ALPHA1)
// Enable processing of gcode G2 and G3 lines
#define ENABLE_PROCESS_G2_G3_LINES (1 && ENABLE_2_5_0_ALPHA1)

View file

@ -2313,7 +2313,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
sort_remove_duplicates(m_extruder_ids);
m_extruder_ids.shrink_to_fit();
#if ENABLE_SPIRAL_VASE_LAYERS
// replace layers for spiral vase mode
if (!gcode_result.spiral_vase_layers.empty()) {
m_layers.reset();
@ -2321,7 +2320,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
m_layers.append(layer.first, { layer.second.first, layer.second.second });
}
}
#endif // ENABLE_SPIRAL_VASE_LAYERS
// set layers z range
if (!m_layers.empty())

View file

@ -499,6 +499,44 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = {
/* FT_SL1 */ { "Masked SLA files"sv, { ".sl1"sv, ".sl1s"sv, ".pwmx"sv } },
};
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxString file_wildcards(FileType file_type)
{
const FileWildcards& data = file_wildcards_by_type[file_type];
std::string title;
std::string mask;
// Generate cumulative first item
for (const std::string_view& ext : data.file_extensions) {
if (title.empty()) {
title = "*";
title += ext;
mask = title;
}
else {
title += ", *";
title += ext;
mask += ";*";
mask += ext;
}
mask += ";*";
mask += boost::to_upper_copy(std::string(ext));
}
wxString ret = GUI::format_wxstr("%s (%s)|%s", data.title, title, mask);
// Adds an item for each of the extensions
if (data.file_extensions.size() > 1) {
for (const std::string_view& ext : data.file_extensions) {
title = "*";
title += ext;
ret += GUI::format_wxstr("|%s (%s)|%s", data.title, title, title);
}
}
return ret;
}
#else
// This function produces a Win32 file dialog file template mask to be consumed by wxWidgets on all platforms.
// The function accepts a custom extension parameter. If the parameter is provided, the custom extension
// will be added as a fist to the list. This is important for a "file save" dialog on OSX, which strips
@ -551,8 +589,10 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
mask += ";*";
mask += boost::to_upper_copy(std::string(ext));
}
return GUI::format_wxstr("%s (%s)|%s", data.title, title, mask);
}
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }

View file

@ -71,7 +71,11 @@ enum FileType
FT_SIZE,
};
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
extern wxString file_wildcards(FileType file_type);
#else
extern wxString file_wildcards(FileType file_type, const std::string &custom_extension = std::string{});
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
enum ConfigMenuIDs {
ConfigMenuWizard,

View file

@ -997,6 +997,11 @@ void Preview::load_print_as_fff(bool keep_z_range)
Refresh();
zs = m_canvas->get_volumes_print_zs(true);
}
else {
m_left_sizer->Hide(m_bottom_toolbar_panel);
m_left_sizer->Layout();
Refresh();
}
if (!zs.empty() && !m_keep_current_preview_type) {
unsigned int number_extruders = wxGetApp().is_editor() ?
@ -1071,7 +1076,6 @@ void Preview::load_print_as_sla()
if (IsShown()) {
m_canvas->load_sla_preview();
m_left_sizer->Hide(m_bottom_toolbar_panel);
m_left_sizer->Hide(m_bottom_toolbar_panel);
m_left_sizer->Layout();
Refresh();

View file

@ -154,7 +154,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
Geometry::Transformation transformation(vol->get_instance_transformation().get_matrix() * vol->get_volume_transformation().get_matrix());
const Transform3d& instance_scaling_matrix_inverse = transformation.get_matrix(true, true, false, true).inverse();
#if ENABLE_GL_SHADERS_ATTRIBUTES
const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * vol->get_instance_transformation().get_matrix();
const Transform3d instance_matrix = Geometry::assemble_transform(m_c->selection_info()->get_sla_shift() * Vec3d::UnitZ()) * transformation.get_matrix();
const Camera& camera = wxGetApp().plater()->get_camera();
const Transform3d& view_matrix = camera.get_view_matrix();
const Transform3d& projection_matrix = camera.get_projection_matrix();

View file

@ -5566,7 +5566,7 @@ bool Plater::load_files(const wxArrayString& filenames)
if (!model().objects.empty()) {
if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) ||
(boost::algorithm::iends_with(filename, ".amf") && !boost::algorithm::iends_with(filename, ".zip.amf")))
load_type = LoadType::OpenProject;
load_type = LoadType::LoadGeometry;
else {
if (wxGetApp().app_config->get("show_drop_project_dialog") == "1") {
ProjectDropDialog dlg(filename);
@ -5919,11 +5919,17 @@ void Plater::export_gcode(bool prefer_removable)
fs::path output_path;
{
std::string ext = default_output_file.extension().string();
#if !ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
std::string ext = default_output_file.extension().string();
#endif // !ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxFileDialog dlg(this, (printer_technology() == ptFFF) ? _L("Save G-code file as:") : _L("Save SL1 / SL1S file as:"),
start_dir,
from_path(default_output_file.filename()),
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1),
#else
GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1, ext),
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);
if (dlg.ShowModal() == wxID_OK) {