Merge branch 'lm_includes_warnings'

No functional changes (hopefully).
This commit is contained in:
Lukas Matena 2020-05-26 16:14:09 +02:00
commit 6e716faa1c
61 changed files with 273 additions and 172 deletions

View file

@ -1,7 +1,8 @@
#include "Arrange.hpp"
//#include "Geometry.hpp"
#include "SVG.hpp"
#include "BoundingBox.hpp"
#include <libnest2d/backends/clipper/geometries.hpp>
#include <libnest2d/optimizers/nlopt/subplex.hpp>
#include <libnest2d/placers/nfpplacer.hpp>

View file

@ -2,9 +2,12 @@
#define ARRANGE_HPP
#include "ExPolygon.hpp"
#include "BoundingBox.hpp"
namespace Slic3r { namespace arrangement {
namespace Slic3r {
class BoundingBox;
namespace arrangement {
/// A geometry abstraction for a circular print bed. Similarly to BoundingBox.
class CircleBed {

View file

@ -6,7 +6,6 @@
#include <stdint.h>
#include "../libslic3r.h"
#include "../BoundingBox.hpp"
#include "../PrintConfig.hpp"
#include "FillBase.hpp"

View file

@ -901,7 +901,7 @@ static void connect_segment_intersections_by_contours(
const SegmentedIntersectionLine *il_prev = i_vline > 0 ? &segs[i_vline - 1] : nullptr;
const SegmentedIntersectionLine *il_next = i_vline + 1 < segs.size() ? &segs[i_vline + 1] : nullptr;
for (int i_intersection = 0; i_intersection < il.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection < int(il.intersections.size()); ++ i_intersection) {
SegmentIntersection &itsct = il.intersections[i_intersection];
const Polygon &poly = poly_with_offset.contour(itsct.iContour);
const bool forward = itsct.is_low(); // == poly_with_offset.is_contour_ccw(intrsctn->iContour);
@ -914,7 +914,7 @@ static void connect_segment_intersections_by_contours(
int iprev = -1;
int d_prev = std::numeric_limits<int>::max();
if (il_prev) {
for (int i = 0; i < il_prev->intersections.size(); ++ i) {
for (int i = 0; i < int(il_prev->intersections.size()); ++ i) {
const SegmentIntersection &itsct2 = il_prev->intersections[i];
if (itsct.iContour == itsct2.iContour && itsct.type == itsct2.type) {
// The intersection points lie on the same contour and have the same orientation.
@ -932,7 +932,7 @@ static void connect_segment_intersections_by_contours(
int inext = -1;
int d_next = std::numeric_limits<int>::max();
if (il_next) {
for (int i = 0; i < il_next->intersections.size(); ++ i) {
for (int i = 0; i < int(il_next->intersections.size()); ++ i) {
const SegmentIntersection &itsct2 = il_next->intersections[i];
if (itsct.iContour == itsct2.iContour && itsct.type == itsct2.type) {
// The intersection points lie on the same contour and have the same orientation.
@ -950,7 +950,7 @@ static void connect_segment_intersections_by_contours(
bool same_prev = false;
bool same_next = false;
// Does the perimeter intersect the current vertical line above intrsctn?
for (int i = 0; i < il.intersections.size(); ++ i)
for (int i = 0; i < int(il.intersections.size()); ++ i)
if (const SegmentIntersection &it2 = il.intersections[i];
i != i_intersection && it2.iContour == itsct.iContour && it2.type != itsct.type) {
int d = distance_of_segmens(poly, it2.iSegment, itsct.iSegment, forward);
@ -1040,7 +1040,7 @@ static void connect_segment_intersections_by_contours(
}
// Make the LinkQuality::Invalid symmetric on vertical connections.
for (int i_intersection = 0; i_intersection < il.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection < int(il.intersections.size()); ++ i_intersection) {
SegmentIntersection &it = il.intersections[i_intersection];
if (it.has_left_vertical() && it.prev_on_contour_quality == SegmentIntersection::LinkQuality::Invalid) {
SegmentIntersection &it2 = il.intersections[it.left_vertical()];
@ -1157,9 +1157,9 @@ static void traverse_graph_generate_polylines(
{
// For each outer only chords, measure their maximum distance to the bow of the outer contour.
// Mark an outer only chord as consumed, if the distance is low.
for (int i_vline = 0; i_vline < segs.size(); ++ i_vline) {
for (int i_vline = 0; i_vline < int(segs.size()); ++ i_vline) {
SegmentedIntersectionLine &vline = segs[i_vline];
for (int i_intersection = 0; i_intersection + 1 < vline.intersections.size(); ++ i_intersection) {
for (int i_intersection = 0; i_intersection + 1 < int(vline.intersections.size()); ++ i_intersection) {
if (vline.intersections[i_intersection].type == SegmentIntersection::OUTER_LOW &&
vline.intersections[i_intersection + 1].type == SegmentIntersection::OUTER_HIGH) {
bool consumed = false;
@ -1189,14 +1189,14 @@ static void traverse_graph_generate_polylines(
if (i_intersection == -1) {
// The path has been interrupted. Find a next starting point, closest to the previous extruder position.
coordf_t dist2min = std::numeric_limits<coordf_t>().max();
for (int i_vline2 = 0; i_vline2 < segs.size(); ++ i_vline2) {
for (int i_vline2 = 0; i_vline2 < int(segs.size()); ++ i_vline2) {
const SegmentedIntersectionLine &vline = segs[i_vline2];
if (! vline.intersections.empty()) {
assert(vline.intersections.size() > 1);
// Even number of intersections with the loops.
assert((vline.intersections.size() & 1) == 0);
assert(vline.intersections.front().type == SegmentIntersection::OUTER_LOW);
for (int i = 0; i < vline.intersections.size(); ++ i) {
for (int i = 0; i < int(vline.intersections.size()); ++ i) {
const SegmentIntersection& intrsctn = vline.intersections[i];
if (intrsctn.is_outer()) {
assert(intrsctn.is_low() || i > 0);
@ -1674,13 +1674,13 @@ static std::vector<MonotonousRegion> generate_montonous_regions(std::vector<Segm
auto test_overlap = [](int, int, int) { return false; };
#endif
for (int i_vline_seed = 0; i_vline_seed < segs.size(); ++ i_vline_seed) {
for (int i_vline_seed = 0; i_vline_seed < int(segs.size()); ++ i_vline_seed) {
SegmentedIntersectionLine &vline_seed = segs[i_vline_seed];
for (int i_intersection_seed = 1; i_intersection_seed + 1 < vline_seed.intersections.size(); ) {
while (i_intersection_seed < vline_seed.intersections.size() &&
for (int i_intersection_seed = 1; i_intersection_seed + 1 < int(vline_seed.intersections.size()); ) {
while (i_intersection_seed < int(vline_seed.intersections.size()) &&
vline_seed.intersections[i_intersection_seed].type != SegmentIntersection::INNER_LOW)
++ i_intersection_seed;
if (i_intersection_seed == vline_seed.intersections.size())
if (i_intersection_seed == int(vline_seed.intersections.size()))
break;
SegmentIntersection *start = &vline_seed.intersections[i_intersection_seed];
SegmentIntersection *end = &end_of_vertical_run(vline_seed, *start);
@ -1697,7 +1697,7 @@ static std::vector<MonotonousRegion> generate_montonous_regions(std::vector<Segm
assert(! test_overlap(region.left.vline, region.left.low, region.left.high));
start->consumed_vertical_up = true;
int num_lines = 1;
while (++ i_vline < segs.size()) {
while (++ i_vline < int(segs.size())) {
SegmentedIntersectionLine &vline_left = segs[i_vline - 1];
SegmentedIntersectionLine &vline_right = segs[i_vline];
std::pair<SegmentIntersection*, SegmentIntersection*> right = right_overlap(left, vline_left, vline_right);
@ -1860,7 +1860,7 @@ static void connect_monotonous_regions(std::vector<MonotonousRegion> &regions, c
}
}
}
if (region.right.vline + 1 < segs.size()) {
if (region.right.vline + 1 < int(segs.size())) {
auto &vline = segs[region.right.vline];
auto &vline_right = segs[region.right.vline + 1];
auto [rbegin, rend] = right_overlap(vline.intersections[region.right.low], vline.intersections[region.right.high], vline, vline_right);
@ -2100,7 +2100,7 @@ static std::vector<MonotonousRegionLink> chain_monotonous_regions(
AntPath &path2 = path_matrix(region, dir, *next, true);
if (path1.visibility > next_candidate.probability)
next_candidate = { next, &path1, &path1, path1.visibility, false };
if (path2.visibility > next_candidate.probability)
if (path2.visibility > next_candidate.probability)
next_candidate = { next, &path2, &path2, path2.visibility, true };
}
}
@ -2111,7 +2111,7 @@ static std::vector<MonotonousRegionLink> chain_monotonous_regions(
AntPath &path2 = path_matrix(region, dir, *next, true);
if (path1.visibility > next_candidate.probability)
next_candidate = { next, &path1, &path1, path1.visibility, false };
if (path2.visibility > next_candidate.probability)
if (path2.visibility > next_candidate.probability)
next_candidate = { next, &path2, &path2, path2.visibility, true };
}
}

View file

@ -7,6 +7,7 @@
#include "GCode/PrintExtents.hpp"
#include "GCode/WipeTower.hpp"
#include "ShortestPath.hpp"
#include "Print.hpp"
#include "Utils.hpp"
#include "libslic3r.h"

View file

@ -8,7 +8,6 @@
#include "MotionPlanner.hpp"
#include "Point.hpp"
#include "PlaceholderParser.hpp"
#include "Print.hpp"
#include "PrintConfig.hpp"
#include "GCode/CoolingBuffer.hpp"
#include "GCode/SpiralVase.hpp"
@ -32,6 +31,10 @@ namespace Slic3r {
class GCode;
class GCodePreviewData;
namespace { struct Item; }
struct PrintInstance;
using PrintObjectPtrs = std::vector<PrintObject*>;
class AvoidCrossingPerimeters {
public:

View file

@ -6,6 +6,7 @@
#include "../BoundingBox.hpp"
#include "../ExtrusionEntity.hpp"
#include "../ExtrusionEntityCollection.hpp"
#include "../Layer.hpp"
#include "../Print.hpp"
#include "PrintExtents.hpp"

View file

@ -1,4 +1,3 @@
#include "libslic3r/libslic3r.h"
#include "ThumbnailData.hpp"
namespace Slic3r {

View file

@ -24,4 +24,4 @@ typedef std::function<void(ThumbnailsList & thumbnails, const Vec2ds & sizes, bo
} // namespace Slic3r
#endif // slic3r_ThumbnailData_hpp_
#endif // slic3r_ThumbnailData_hpp_

View file

@ -1,5 +1,6 @@
#include "Print.hpp"
#include "ToolOrdering.hpp"
#include "Layer.hpp"
// #define SLIC3R_DEBUG
@ -15,7 +16,6 @@
#include <libslic3r.h>
#include "../GCodeWriter.hpp"
namespace Slic3r {

View file

@ -14,6 +14,8 @@ namespace Slic3r {
class Print;
class PrintObject;
class LayerTools;
namespace CustomGCode { struct Item; }
class PrintRegion;

View file

@ -282,7 +282,7 @@ namespace Slic3r {
};
GCodeReader parser;
unsigned int g1_lines_count = 0;
int g1_lines_count = 0;
int normal_g1_line_id = 0;
float normal_last_recorded_time = 0.0f;
int silent_g1_line_id = 0;

View file

@ -10,8 +10,6 @@
#include <cmath>
#include "libslic3r.h"
#include "Point.hpp"
#include "BoundingBox.hpp"
namespace Slic3r {

View file

@ -1383,8 +1383,8 @@ unsigned int ModelObject::check_instances_print_volume_state(const BoundingBoxf3
inside_outside |= OUTSIDE;
}
model_instance->print_volume_state =
(inside_outside == (INSIDE | OUTSIDE)) ? ModelInstance::PVS_Partly_Outside :
(inside_outside == INSIDE) ? ModelInstance::PVS_Inside : ModelInstance::PVS_Fully_Outside;
(inside_outside == (INSIDE | OUTSIDE)) ? ModelInstancePVS_Partly_Outside :
(inside_outside == INSIDE) ? ModelInstancePVS_Inside : ModelInstancePVS_Fully_Outside;
if (inside_outside == INSIDE)
++ num_printable;
}

View file

@ -3,7 +3,6 @@
#include "libslic3r.h"
#include "Geometry.hpp"
#include "Layer.hpp"
#include "ObjectID.hpp"
#include "Point.hpp"
#include "PrintConfig.hpp"
@ -641,25 +640,26 @@ private:
}
};
enum ModelInstanceEPrintVolumeState : unsigned char
{
ModelInstancePVS_Inside,
ModelInstancePVS_Partly_Outside,
ModelInstancePVS_Fully_Outside,
ModelInstanceNum_BedStates
};
// A single instance of a ModelObject.
// Knows the affine transformation of an object.
class ModelInstance final : public ObjectBase
{
public:
enum EPrintVolumeState : unsigned char
{
PVS_Inside,
PVS_Partly_Outside,
PVS_Fully_Outside,
Num_BedStates
};
private:
Geometry::Transformation m_transformation;
public:
// flag showing the position of this instance with respect to the print volume (set by Print::validate() using ModelObject::check_instances_print_volume_state())
EPrintVolumeState print_volume_state;
ModelInstanceEPrintVolumeState print_volume_state;
// Whether or not this instance is printable
bool printable;
@ -706,7 +706,7 @@ public:
const Transform3d& get_matrix(bool dont_translate = false, bool dont_rotate = false, bool dont_scale = false, bool dont_mirror = false) const { return m_transformation.get_matrix(dont_translate, dont_rotate, dont_scale, dont_mirror); }
bool is_printable() const { return object->printable && printable && (print_volume_state == PVS_Inside); }
bool is_printable() const { return object->printable && printable && (print_volume_state == ModelInstancePVS_Inside); }
// Getting the input polygon for arrange
arrangement::ArrangePolygon get_arrange_polygon() const;
@ -735,10 +735,10 @@ private:
ModelObject* object;
// Constructor, which assigns a new unique ID.
explicit ModelInstance(ModelObject* object) : print_volume_state(PVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
explicit ModelInstance(ModelObject* object) : print_volume_state(ModelInstancePVS_Inside), printable(true), object(object) { assert(this->id().valid()); }
// Constructor, which assigns a new unique ID.
explicit ModelInstance(ModelObject *object, const ModelInstance &other) :
m_transformation(other.m_transformation), print_volume_state(PVS_Inside), printable(other.printable), object(object) { assert(this->id().valid() && this->id() != other.id()); }
m_transformation(other.m_transformation), print_volume_state(ModelInstancePVS_Inside), printable(other.printable), object(object) { assert(this->id().valid() && this->id() != other.id()); }
explicit ModelInstance(ModelInstance &&rhs) = delete;
ModelInstance& operator=(const ModelInstance &rhs) = delete;
@ -753,6 +753,7 @@ private:
}
};
class ModelWipeTower final : public ObjectBase
{
public:

View file

@ -4,10 +4,9 @@
#include "PrintBase.hpp"
#include "BoundingBox.hpp"
#include "ExtrusionEntityCollection.hpp"
#include "Flow.hpp"
#include "Point.hpp"
#include "Layer.hpp"
#include "Model.hpp"
#include "Slicing.hpp"
#include "GCode/ToolOrdering.hpp"
#include "GCode/WipeTower.hpp"
@ -23,6 +22,8 @@ class ModelObject;
class GCode;
class GCodePreviewData;
enum class SlicingMode : uint32_t;
class Layer;
class SupportLayer;
// Print step IDs for keeping track of the print state.
enum PrintStep {
@ -147,18 +148,11 @@ public:
const Layer* get_layer(int idx) const { return m_layers[idx]; }
Layer* get_layer(int idx) { return m_layers[idx]; }
// Get a layer exactly at print_z.
const Layer* get_layer_at_printz(coordf_t print_z) const {
auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [print_z](const Layer *layer) { return layer->print_z < print_z; });
return (it == m_layers.end() || (*it)->print_z != print_z) ? nullptr : *it;
}
Layer* get_layer_at_printz(coordf_t print_z) { return const_cast<Layer*>(std::as_const(*this).get_layer_at_printz(print_z)); }
const Layer* get_layer_at_printz(coordf_t print_z) const;
Layer* get_layer_at_printz(coordf_t print_z);
// Get a layer approximately at print_z.
const Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon) const {
coordf_t limit = print_z - epsilon;
auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [limit](const Layer *layer) { return layer->print_z < limit; });
return (it == m_layers.end() || (*it)->print_z > print_z + epsilon) ? nullptr : *it;
}
Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon) { return const_cast<Layer*>(std::as_const(*this).get_layer_at_printz(print_z, epsilon)); }
const Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon) const;
Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon);
// print_z: top of the layer; slice_z: center of the layer.
Layer* add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z);

View file

@ -4,6 +4,7 @@
#include "ElephantFootCompensation.hpp"
#include "Geometry.hpp"
#include "I18N.hpp"
#include "Layer.hpp"
#include "SupportMaterial.hpp"
#include "Surface.hpp"
#include "Slicing.hpp"
@ -2829,4 +2830,28 @@ void PrintObject::project_and_append_custom_supports(
} // loop over ModelVolumes
}
const Layer* PrintObject::get_layer_at_printz(coordf_t print_z) const {
auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [print_z](const Layer *layer) { return layer->print_z < print_z; });
return (it == m_layers.end() || (*it)->print_z != print_z) ? nullptr : *it;
}
Layer* PrintObject::get_layer_at_printz(coordf_t print_z) { return const_cast<Layer*>(std::as_const(*this).get_layer_at_printz(print_z)); }
// Get a layer approximately at print_z.
const Layer* PrintObject::get_layer_at_printz(coordf_t print_z, coordf_t epsilon) const {
coordf_t limit = print_z - epsilon;
auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [limit](const Layer *layer) { return layer->print_z < limit; });
return (it == m_layers.end() || (*it)->print_z > print_z + epsilon) ? nullptr : *it;
}
Layer* PrintObject::get_layer_at_printz(coordf_t print_z, coordf_t epsilon) { return const_cast<Layer*>(std::as_const(*this).get_layer_at_printz(print_z, epsilon)); }
} // namespace Slic3r

View file

@ -9,7 +9,6 @@
#include <libslic3r/ClipperUtils.hpp>
#include <libslic3r/Point.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <boost/container/small_vector.hpp>

View file

@ -724,7 +724,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
glsafe(::glDisable(GL_BLEND));
}
bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, ModelInstance::EPrintVolumeState* out_state)
bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, ModelInstanceEPrintVolumeState* out_state)
{
if (config == nullptr)
return false;
@ -738,7 +738,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
// Allow the objects to protrude below the print bed
print_volume.min(2) = -1e10;
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
ModelInstanceEPrintVolumeState state = ModelInstancePVS_Inside;
bool contained_min_one = false;
@ -757,11 +757,11 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
if (contained)
contained_min_one = true;
if ((state == ModelInstance::PVS_Inside) && volume->is_outside)
state = ModelInstance::PVS_Fully_Outside;
if ((state == ModelInstancePVS_Inside) && volume->is_outside)
state = ModelInstancePVS_Fully_Outside;
if ((state == ModelInstance::PVS_Fully_Outside) && volume->is_outside && print_volume.intersects(bb))
state = ModelInstance::PVS_Partly_Outside;
if ((state == ModelInstancePVS_Fully_Outside) && volume->is_outside && print_volume.intersects(bb))
state = ModelInstancePVS_Partly_Outside;
}
if (out_state != nullptr)

View file

@ -6,7 +6,7 @@
#include "libslic3r/Line.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Geometry.hpp"
#include <functional>
@ -40,6 +40,9 @@ class ExtrusionMultiPath;
class ExtrusionLoop;
class ExtrusionEntity;
class ExtrusionEntityCollection;
class ModelObject;
class ModelVolume;
enum ModelInstanceEPrintVolumeState : unsigned char;
// A container for interleaved arrays of 3D vertices and normals,
// possibly indexed by triangles and / or quads.
@ -578,7 +581,7 @@ public:
// returns true if all the volumes are completely contained in the print volume
// returns the containment state in the given out_state, if non-null
bool check_outside_state(const DynamicPrintConfig* config, ModelInstance::EPrintVolumeState* out_state);
bool check_outside_state(const DynamicPrintConfig* config, ModelInstanceEPrintVolumeState* out_state);
void reset_outside_state();
void update_colors_by_extruder(const DynamicPrintConfig* config);

View file

@ -300,13 +300,13 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe
std::vector<std::string> AppConfig::get_mouse_device_names() const
{
static constexpr char *prefix = "mouse_device:";
static constexpr size_t prefix_len = 13; // strlen(prefix); reports error C2131: expression did not evaluate to a constant on VS2019
std::vector<std::string> out;
static constexpr const char *prefix = "mouse_device:";
static const size_t prefix_len = strlen(prefix);
std::vector<std::string> out;
for (const std::pair<std::string, std::map<std::string, std::string>>& key_value_pair : m_storage)
if (boost::starts_with(key_value_pair.first, "mouse_device:") && key_value_pair.first.size() > prefix_len)
if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len)
out.emplace_back(key_value_pair.first.substr(prefix_len));
return out;
return out;
}
void AppConfig::update_config_dir(const std::string &dir)

View file

@ -5,22 +5,22 @@
#include <condition_variable>
#include <mutex>
#include <boost/filesystem/path.hpp>
#include <wx/event.h>
#include "libslic3r/Print.hpp"
#include "libslic3r/PrintBase.hpp"
#include "libslic3r/GCode/ThumbnailData.hpp"
#include "libslic3r/Format/SL1.hpp"
#include "slic3r/Utils/PrintHost.hpp"
namespace boost { namespace filesystem { class path; } }
namespace Slic3r {
class DynamicPrintConfig;
class GCodePreviewData;
class Model;
class SLAPrint;
class SL1Archive;
class SlicingStatusEvent : public wxEvent
{
@ -86,7 +86,7 @@ public:
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.
Print::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config);
PrintBase::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config);
// After calling the apply() function, set_task() may be called to limit the task to be processed by process().
// This is useful for calculating SLA supports for a single object only.
void set_task(const PrintBase::TaskParams &params);

View file

@ -425,9 +425,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double
if ((dx <= 0.0) || (dy <= 0.0))
return -1.0f;
double med_x = 0.5 * (max_x + min_x);
double med_y = 0.5 * (max_y + min_y);
dx *= margin_factor;
dy *= margin_factor;

View file

@ -22,7 +22,7 @@ namespace DoubleSlider {
/* For exporting GCode in GCodeWriter is used XYZF_NUM(val) = PRECISION(val, 3) for XYZ values.
* So, let use same value as a permissible error for layer height.
*/
static double epsilon() { return 0.0011;}
constexpr double epsilon() { return 0.0011; }
// custom message the slider sends to its parent to notify a tick-change:
wxDECLARE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);

View file

@ -9,6 +9,7 @@
#include "libslic3r/GCode/ThumbnailData.hpp"
#include "libslic3r/Geometry.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Layer.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Technologies.hpp"
#include "libslic3r/Tesselate.hpp"
@ -1694,7 +1695,7 @@ void GLCanvas3D::reset_volumes()
int GLCanvas3D::check_volumes_outside_state() const
{
ModelInstance::EPrintVolumeState state;
ModelInstanceEPrintVolumeState state;
m_volumes.check_outside_state(m_config, &state);
return (int)state;
}
@ -2578,15 +2579,15 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// checks for geometry outside the print volume to render it accordingly
if (!m_volumes.empty())
{
ModelInstance::EPrintVolumeState state;
ModelInstanceEPrintVolumeState state;
const bool contained_min_one = m_volumes.check_outside_state(m_config, &state);
_set_warning_texture(WarningTexture::ObjectClashed, state == ModelInstance::PVS_Partly_Outside);
_set_warning_texture(WarningTexture::ObjectOutside, state == ModelInstance::PVS_Fully_Outside);
_set_warning_texture(WarningTexture::ObjectClashed, state == ModelInstancePVS_Partly_Outside);
_set_warning_texture(WarningTexture::ObjectOutside, state == ModelInstancePVS_Fully_Outside);
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
contained_min_one && !m_model->objects.empty() && state != ModelInstance::PVS_Partly_Outside));
contained_min_one && !m_model->objects.empty() && state != ModelInstancePVS_Partly_Outside));
}
else
{

View file

@ -15,6 +15,8 @@
#include "GLSelectionRectangle.hpp"
#include "MeshUtils.hpp"
#include "libslic3r/Slicing.hpp"
#include <float.h>
#include <wx/timer.h>
@ -33,13 +35,16 @@ class wxGLContext;
namespace Slic3r {
class Bed3D;
struct Camera;
class BackgroundSlicingProcess;
class GCodePreviewData;
struct ThumbnailData;
struct SlicingParameters;
enum LayerHeightEditActionType : unsigned int;
class ModelObject;
class ModelInstance;
class PrintObject;
class Print;
class SLAPrint;
namespace CustomGCode { struct Item; }
namespace GUI {

View file

@ -1,13 +1,11 @@
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "I18N.hpp"
#include "WipeTowerDialog.hpp"
#include <assert.h>
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/any.hpp>
#if __APPLE__
#import <IOKit/pwr_mgt/IOPMLib.h>
@ -18,22 +16,16 @@
#include "boost/nowide/convert.hpp"
#endif
#include <wx/display.h>
#include "wxExtensions.hpp"
#include "GUI_Preview.hpp"
#include "AboutDialog.hpp"
#include "AppConfig.hpp"
#include "ConfigWizard.hpp"
#include "PresetBundle.hpp"
#include "UpdateDialogs.hpp"
#include "MsgDialog.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Print.hpp"
#include "Tab.hpp"
#include "GUI_ObjectList.hpp"
namespace Slic3r { namespace GUI {
namespace Slic3r {
class AppConfig;
namespace GUI {
#if __APPLE__
IOPMAssertionID assertionID;

View file

@ -36,6 +36,7 @@
#include "GUI_Utils.hpp"
#include "AppConfig.hpp"
#include "PresetBundle.hpp"
#include "3DScene.hpp"
#include "../Utils/PresetUpdater.hpp"
#include "../Utils/PrintHost.hpp"

View file

@ -2,6 +2,7 @@
#include "GUI_ObjectList.hpp"
#include "I18N.hpp"
#include "GLCanvas3D.hpp"
#include "OptionsGroup.hpp"
#include "wxExtensions.hpp"
#include "PresetBundle.hpp"

View file

@ -4,7 +4,8 @@
#include <memory>
#include "GUI_ObjectSettings.hpp"
#include "GLCanvas3D.hpp"
#include "libslic3r/Point.hpp"
#include <float.h>
class wxBitmapComboBox;
class wxStaticText;

View file

@ -4,7 +4,6 @@
#include "GUI_App.hpp"
#include "GUI.hpp"
#include "I18N.hpp"
#include "AppConfig.hpp"
#include "3DScene.hpp"
#include "BackgroundSlicingProcess.hpp"
#include "OpenGLManager.hpp"

View file

@ -2,10 +2,12 @@
#define slic3r_GUI_Preview_hpp_
#include <wx/panel.h>
#include "libslic3r/Point.hpp"
#include "libslic3r/CustomGCode.hpp"
#include <string>
#include "libslic3r/Model.hpp"
class wxNotebook;
class wxGLCanvas;

View file

@ -4,14 +4,9 @@
#include <GL/glew.h>
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/GLCanvas3D.hpp"
// TODO: Display tooltips quicker on Linux
namespace Slic3r {
namespace GUI {

View file

@ -4,7 +4,6 @@
#include "libslic3r/Point.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/Selection.hpp"
#include <cereal/archives/binary.hpp>
@ -31,9 +30,9 @@ static const float CONSTRAINED_COLOR[4] = { 0.5f, 0.5f, 0.5f, 1.0f };
class ImGuiWrapper;
class GLCanvas3D;
class ClippingPlane;
enum class CommonGizmosDataID;
class CommonGizmosDataPool;
class Selection;
class GLGizmoBase
{

View file

@ -5,6 +5,8 @@
#include "slic3r/GUI/3DScene.hpp"
#include "libslic3r/ObjectID.hpp"
#include <cereal/types/vector.hpp>
@ -15,6 +17,7 @@ enum class FacetSupportType : int8_t;
namespace GUI {
enum class SLAGizmoEventType : unsigned char;
class ClippingPlane;
class GLGizmoFdmSupports : public GLGizmoBase
{

View file

@ -3,6 +3,8 @@
#include "slic3r/GUI/GLCanvas3D.hpp"
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
#include "libslic3r/Model.hpp"
#include <numeric>
#include <GL/glew.h>

View file

@ -2,9 +2,14 @@
#define slic3r_GLGizmoFlatten_hpp_
#include "GLGizmoBase.hpp"
#include "slic3r/GUI/3DScene.hpp"
namespace Slic3r {
enum class ModelVolumeType : int;
namespace GUI {

View file

@ -11,6 +11,8 @@
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/PresetBundle.hpp"
#include "libslic3r/Model.hpp"
namespace Slic3r {
namespace GUI {

View file

@ -5,12 +5,17 @@
#include "slic3r/GUI/GLSelectionRectangle.hpp"
#include <libslic3r/SLA/Hollowing.hpp>
#include <libslic3r/ObjectID.hpp>
#include <wx/dialog.h>
#include <cereal/types/vector.hpp>
namespace Slic3r {
class ConfigOption;
class ConfigOptionDef;
namespace GUI {
enum class SLAGizmoEventType : unsigned char;

View file

@ -26,7 +26,6 @@ std::string GLGizmoScale3D::get_tooltip() const
bool single_instance = selection.is_single_full_instance();
bool single_volume = selection.is_single_modifier() || selection.is_single_volume();
bool single_selection = single_instance || single_volume;
Vec3f scale = 100.0f * Vec3f::Ones();
if (single_instance)

View file

@ -3,6 +3,8 @@
#include "GLGizmoBase.hpp"
#include "libslic3r/BoundingBox.hpp"
namespace Slic3r {
namespace GUI {

View file

@ -4,13 +4,17 @@
#include "GLGizmoBase.hpp"
#include "slic3r/GUI/GLSelectionRectangle.hpp"
#include "libslic3r/SLA/Common.hpp"
#include "libslic3r/SLA/SupportPoint.hpp"
#include "libslic3r/ObjectID.hpp"
#include <wx/dialog.h>
#include <cereal/types/vector.hpp>
namespace Slic3r {
class ConfigOption;
namespace GUI {
enum class SLAGizmoEventType : unsigned char;

View file

@ -17,6 +17,8 @@
#include "slic3r/GUI/Gizmos/GLGizmoCut.hpp"
#include "slic3r/GUI/Gizmos/GLGizmoHollow.hpp"
#include "libslic3r/Model.hpp"
#include <wx/glcanvas.h>
namespace Slic3r {

View file

@ -6,6 +6,8 @@
#include "slic3r/GUI/Gizmos/GLGizmoBase.hpp"
#include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp"
#include "libslic3r/ObjectID.hpp"
#include <map>
namespace Slic3r {

View file

@ -1,6 +1,7 @@
#include "ArrangeJob.hpp"
#include "libslic3r/MTUtils.hpp"
#include "libslic3r/Model.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/GLCanvas3D.hpp"

View file

@ -3,6 +3,7 @@
#include "libslic3r/MTUtils.hpp"
#include "libslic3r/SLA/Rotfinder.hpp"
#include "libslic3r/MinAreaBoundingBox.hpp"
#include "libslic3r/Model.hpp"
#include "slic3r/GUI/Plater.hpp"

View file

@ -8,6 +8,8 @@
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/Utils/SLAImport.hpp"
#include "libslic3r/Model.hpp"
#include <wx/dialog.h>
#include <wx/stattext.h>
#include <wx/combobox.h>

View file

@ -25,15 +25,6 @@
#include <wx/choicebk.h>
#endif // BOOK_TYPE
#if ENABLE_SCROLLABLE
static wxSize get_screen_size(wxWindow* window)
{
const auto idx = wxDisplay::GetFromWindow(window);
wxDisplay display(idx != wxNOT_FOUND ? idx : 0u);
return display.GetClientArea().GetSize();
}
#endif // ENABLE_SCROLLABLE
namespace Slic3r {
namespace GUI {

View file

@ -2626,7 +2626,7 @@ void Plater::priv::object_list_changed()
{
const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty());
// XXX: is this right?
const bool model_fits = view3D->check_volumes_outside_state() == ModelInstance::PVS_Inside;
const bool model_fits = view3D->check_volumes_outside_state() == ModelInstancePVS_Inside;
sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits);
}
@ -3318,7 +3318,7 @@ void Plater::priv::set_current_panel(wxPanel* panel)
// see: Plater::priv::object_list_changed()
// FIXME: it may be better to have a single function making this check and let it be called wherever needed
bool export_in_progress = this->background_process.is_export_scheduled();
bool model_fits = view3D->check_volumes_outside_state() != ModelInstance::PVS_Partly_Outside;
bool model_fits = view3D->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
if (!model.objects.empty() && !export_in_progress && model_fits)
this->q->reslice();
// keeps current gcode preview, if any

View file

@ -25,10 +25,13 @@ namespace Slic3r {
class Model;
class ModelObject;
class ModelInstance;
class Print;
class SLAPrint;
enum SLAPrintObjectStep : unsigned int;
using ModelInstancePtrs = std::vector<ModelInstance*>;
namespace UndoRedo {
class Stack;
struct Snapshot;

View file

@ -962,7 +962,7 @@ void PresetCollection::load_bitmap_add(const std::string &file_name)
const Preset* PresetCollection::get_selected_preset_parent() const
{
if (this->get_selected_idx() == -1)
if (this->get_selected_idx() == size_t(-1))
// This preset collection has no preset activated yet. Only the get_edited_preset() is valid.
return nullptr;

View file

@ -296,9 +296,8 @@ std::string PresetHints::top_bottom_shell_thickness_explanation(const PresetBund
double bottom_solid_min_thickness = print_config.opt_float("bottom_solid_min_thickness");
double layer_height = print_config.opt_float("layer_height");
bool variable_layer_height = printer_config.opt_bool("variable_layer_height");
//FIXME the following lines take into account the 1st extruder only.
//FIXME the following line takes into account the 1st extruder only.
double min_layer_height = variable_layer_height ? Slicing::min_layer_height_from_nozzle(printer_config, 1) : layer_height;
double max_layer_height = variable_layer_height ? Slicing::max_layer_height_from_nozzle(printer_config, 1) : layer_height;
if (layer_height <= 0.f) {
out += _utf8(L("Top / bottom shell thickness hint: Not available due to invalid layer height."));

View file

@ -1,15 +1,17 @@
#include "libslic3r/libslic3r.h"
#include "Selection.hpp"
#include "3DScene.hpp"
#include "GLCanvas3D.hpp"
#include "GUI_App.hpp"
#include "GUI.hpp"
#include "GUI_ObjectManipulation.hpp"
#include "GUI_ObjectList.hpp"
#include "Gizmos/GLGizmoBase.hpp"
#include "3DScene.hpp"
#include "Camera.hpp"
#include "libslic3r/Model.hpp"
#include <GL/glew.h>
#include <boost/algorithm/string/predicate.hpp>
@ -54,7 +56,7 @@ bool Selection::Clipboard::is_sla_compliant() const
if (m_mode == Selection::Volume)
return false;
for (const ModelObject* o : m_model.objects)
for (const ModelObject* o : m_model->objects)
{
if (o->is_multiparts())
return false;
@ -69,6 +71,35 @@ bool Selection::Clipboard::is_sla_compliant() const
return true;
}
Selection::Clipboard::Clipboard()
{
m_model.reset(new Model);
}
void Selection::Clipboard::reset() {
m_model->clear_objects();
}
bool Selection::Clipboard::is_empty() const
{
return m_model->objects.empty();
}
ModelObject* Selection::Clipboard::add_object()
{
return m_model->add_object();
}
ModelObject* Selection::Clipboard::get_object(unsigned int id)
{
return (id < (unsigned int)m_model->objects.size()) ? m_model->objects[id] : nullptr;
}
const ModelObjectPtrs& Selection::Clipboard::get_objects() const
{
return m_model->objects;
}
Selection::Selection()
: m_volumes(nullptr)
, m_model(nullptr)
@ -76,9 +107,11 @@ Selection::Selection()
, m_mode(Instance)
, m_type(Empty)
, m_valid(false)
, m_curved_arrow(16)
, m_scale_factor(1.0f)
{
m_arrow.reset(new GLArrow);
m_curved_arrow.reset(new GLCurvedArrow(16));
this->set_bounding_boxes_dirty();
#if ENABLE_RENDER_SELECTION_CENTER
m_quadric = ::gluNewQuadric();
@ -104,15 +137,15 @@ void Selection::set_volumes(GLVolumePtrs* volumes)
// Init shall be called from the OpenGL render function, so that the OpenGL context is initialized!
bool Selection::init()
{
if (!m_arrow.init())
if (!m_arrow->init())
return false;
m_arrow.set_scale(5.0 * Vec3d::Ones());
m_arrow->set_scale(5.0 * Vec3d::Ones());
if (!m_curved_arrow.init())
if (!m_curved_arrow->init())
return false;
m_curved_arrow.set_scale(5.0 * Vec3d::Ones());
m_curved_arrow->set_scale(5.0 * Vec3d::Ones());
return true;
}
@ -2048,29 +2081,29 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co
void Selection::render_sidebar_position_hint(Axis axis) const
{
m_arrow.set_color(AXES_COLOR[axis], 3);
m_arrow.render();
m_arrow->set_color(AXES_COLOR[axis], 3);
m_arrow->render();
}
void Selection::render_sidebar_rotation_hint(Axis axis) const
{
m_curved_arrow.set_color(AXES_COLOR[axis], 3);
m_curved_arrow.render();
m_curved_arrow->set_color(AXES_COLOR[axis], 3);
m_curved_arrow->render();
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
m_curved_arrow.render();
m_curved_arrow->render();
}
void Selection::render_sidebar_scale_hint(Axis axis) const
{
m_arrow.set_color(((requires_uniform_scale() || wxGetApp().obj_manipul()->get_uniform_scaling()) ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis]), 3);
m_arrow->set_color(((requires_uniform_scale() || wxGetApp().obj_manipul()->get_uniform_scaling()) ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis]), 3);
glsafe(::glTranslated(0.0, 5.0, 0.0));
m_arrow.render();
m_arrow->render();
glsafe(::glTranslated(0.0, -10.0, 0.0));
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
m_arrow.render();
m_arrow->render();
}
void Selection::render_sidebar_size_hint(Axis axis, double length) const

View file

@ -3,7 +3,7 @@
#include <set>
#include "libslic3r/Geometry.hpp"
#include "3DScene.hpp"
#if ENABLE_RENDER_SELECTION_CENTER
class GLUquadric;
@ -11,7 +11,19 @@ typedef class GLUquadric GLUquadricObj;
#endif // ENABLE_RENDER_SELECTION_CENTER
namespace Slic3r {
class Shader;
class Model;
class ModelObject;
class GLVolume;
class GLArrow;
class GLCurvedArrow;
class DynamicPrintConfig;
using GLVolumePtrs = std::vector<GLVolume*>;
using ModelObjectPtrs = std::vector<ModelObject*>;
namespace GUI {
class TransformationType
{
@ -145,18 +157,23 @@ public:
class Clipboard
{
Model m_model;
// Model is stored through a pointer to avoid including heavy Model.hpp.
// It is created in constructor.
std::unique_ptr<Model> m_model;
Selection::EMode m_mode;
public:
void reset() { m_model.clear_objects(); }
bool is_empty() const { return m_model.objects.empty(); }
Clipboard();
void reset();
bool is_empty() const;
bool is_sla_compliant() const;
ModelObject* add_object() { return m_model.add_object(); }
ModelObject* get_object(unsigned int id) { return (id < (unsigned int)m_model.objects.size()) ? m_model.objects[id] : nullptr; }
const ModelObjectPtrs& get_objects() const { return m_model.objects; }
ModelObject* add_object();
ModelObject* get_object(unsigned int id);
const ModelObjectPtrs& get_objects() const;
Selection::EMode get_mode() const { return m_mode; }
void set_mode(Selection::EMode mode) { m_mode = mode; }
@ -200,8 +217,11 @@ private:
#if ENABLE_RENDER_SELECTION_CENTER
GLUquadricObj* m_quadric;
#endif // ENABLE_RENDER_SELECTION_CENTER
mutable GLArrow m_arrow;
mutable GLCurvedArrow m_curved_arrow;
// Arrows are saved through pointers to avoid including 3DScene.hpp.
// It also allows mutability.
std::unique_ptr<GLArrow> m_arrow;
std::unique_ptr<GLCurvedArrow> m_curved_arrow;
mutable float m_scale_factor;

View file

@ -3297,28 +3297,28 @@ void Tab::save_preset(std::string name /*= ""*/, bool detach)
wxGetApp().plater()->force_filament_colors_update();
{
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
if (static_cast<const TabPrinter*>(this)->m_printer_technology == ptFFF)
dependent = { Preset::TYPE_PRINT, Preset::TYPE_FILAMENT };
else
dependent = { Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
break;
break;
default:
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
}
// Called for a currently selected preset.

View file

@ -120,7 +120,7 @@ namespace fts {
char *end = Slic3r::fold_to_ascii(*str, tmp);
char *c = tmp;
for (const wchar_t* d = pattern; c != end && *d != 0 && wchar_t(std::tolower(*c)) == std::tolower(*d); ++c, ++d);
if (c == end) {
if (c == end) {
folded_match = true;
num_matched = end - tmp;
}

View file

@ -4,7 +4,6 @@
#include <functional>
#include <libslic3r/Point.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <libslic3r/PrintConfig.hpp>
namespace Slic3r {

View file

@ -2,6 +2,7 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/Print.hpp"
#include "libslic3r/Layer.hpp"
#include "test_data.hpp"

View file

@ -2,6 +2,7 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/Print.hpp"
#include "libslic3r/Layer.hpp"
#include "test_data.hpp"

View file

@ -1,6 +1,7 @@
#include <catch2/catch.hpp>
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Layer.hpp"
#include "test_data.hpp" // get access to init_print, etc

View file

@ -3,6 +3,7 @@
%{
#include <xsinit.h>
#include "libslic3r/PerimeterGenerator.hpp"
#include "libslic3r/Layer.hpp"
%}
%name{Slic3r::Layer::PerimeterGenerator} class PerimeterGenerator {