Merge branch 'master' into tm_builtin_pad

This commit is contained in:
tamasmeszaros 2019-06-20 10:03:47 +02:00
commit c82fd692c3
91 changed files with 4791 additions and 4391 deletions

View file

@ -783,8 +783,8 @@ void SLAPrint::process()
{
// We apply the printer correction offset here.
if(clpr_offs != 0)
po.m_model_slices[id] =
offset_ex(po.m_model_slices[id], float(clpr_offs));
po.m_model_slices[id] =
offset_ex(po.m_model_slices[id], float(clpr_offs));
mit->set_model_slice_idx(po, id); ++mit;
}
@ -1085,7 +1085,7 @@ void SLAPrint::process()
namespace sl = libnest2d::shapelike; // For algorithms
// If the raster has vertical orientation, we will flip the coordinates
bool flpXY = m_printer_config.display_orientation.getInt() == SLADisplayOrientation::sladoPortrait;
// bool flpXY = m_printer_config.display_orientation.getInt() == SLADisplayOrientation::sladoPortrait;
// Set up custom union and diff functions for clipper polygons
auto polyunion = [] (const ClipperPolygons& subjects)
@ -1143,9 +1143,9 @@ void SLAPrint::process()
// get polygons for all instances in the object
auto get_all_polygons =
[flpXY](const ExPolygons& input_polygons,
const std::vector<SLAPrintObject::Instance>& instances,
bool is_lefthanded)
[](const ExPolygons& input_polygons,
const std::vector<SLAPrintObject::Instance>& instances,
bool is_lefthanded)
{
ClipperPolygons polygons;
polygons.reserve(input_polygons.size() * instances.size());
@ -1159,7 +1159,7 @@ void SLAPrint::process()
// We need to reverse if flpXY OR is_lefthanded is true but
// not if both are true which is a logical inequality (XOR)
bool needreverse = flpXY != is_lefthanded;
bool needreverse = /*flpXY !=*/ is_lefthanded;
// should be a move
poly.Contour.reserve(polygon.contour.size() + 1);
@ -1194,10 +1194,10 @@ void SLAPrint::process()
sl::translate(poly, ClipperPoint{instances[i].shift(X),
instances[i].shift(Y)});
if (flpXY) {
for(auto& p : poly.Contour) std::swap(p.X, p.Y);
for(auto& h : poly.Holes) for(auto& p : h) std::swap(p.X, p.Y);
}
// if (flpXY) {
// for(auto& p : poly.Contour) std::swap(p.X, p.Y);
// for(auto& h : poly.Holes) for(auto& p : h) std::swap(p.X, p.Y);
// }
polygons.emplace_back(std::move(poly));
}
@ -1366,35 +1366,11 @@ void SLAPrint::process()
auto rasterize = [this]() {
if(canceled()) return;
// collect all the keys
// If the raster has vertical orientation, we will flip the coordinates
bool flpXY = m_printer_config.display_orientation.getInt() ==
SLADisplayOrientation::sladoPortrait;
{ // create a raster printer for the current print parameters
// I don't know any better
auto& ocfg = m_objects.front()->m_config;
auto& matcfg = m_material_config;
auto& printcfg = m_printer_config;
double w = printcfg.display_width.getFloat();
double h = printcfg.display_height.getFloat();
auto pw = unsigned(printcfg.display_pixels_x.getInt());
auto ph = unsigned(printcfg.display_pixels_y.getInt());
double lh = ocfg.layer_height.getFloat();
double exp_t = matcfg.exposure_time.getFloat();
double iexp_t = matcfg.initial_exposure_time.getFloat();
double gamma = m_printer_config.gamma_correction.getFloat();
if(flpXY) { std::swap(w, h); std::swap(pw, ph); }
m_printer.reset(
new SLAPrinter(w, h, pw, ph, lh, exp_t, iexp_t,
flpXY? SLAPrinter::RO_PORTRAIT :
SLAPrinter::RO_LANDSCAPE,
gamma));
double layerh = m_default_object_config.layer_height.getFloat();
m_printer.reset(new SLAPrinter(m_printer_config,
m_material_config,
layerh));
}
// Allocate space for all the layers
@ -1582,6 +1558,8 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
"display_height",
"display_pixels_x",
"display_pixels_y",
"display_mirror_x",
"display_mirror_y",
"display_orientation"
};