diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 4475e880f..6211aff33 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -291,7 +291,7 @@ sub slice { while (@{$self->layers} && !@{$self->get_layer(0)->slices}) { shift @{$self->layers}; for (my $i = 0; $i <= $#{$self->layers}; $i++) { - $self->get_layer($i)->id( $self->get_layer($i)->id-1 ); + $self->get_layer($i)->set_id( $self->get_layer($i)->id-1 ); } } diff --git a/xs/src/libslic3r/Layer.cpp b/xs/src/libslic3r/Layer.cpp index 38935fced..2e1a8c50e 100644 --- a/xs/src/libslic3r/Layer.cpp +++ b/xs/src/libslic3r/Layer.cpp @@ -6,7 +6,7 @@ namespace Slic3r { -Layer::Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z, +Layer::Layer(size_t id, PrintObject *object, coordf_t height, coordf_t print_z, coordf_t slice_z) : _id(id), _object(object), @@ -35,12 +35,18 @@ Layer::~Layer() this->clear_regions(); } -int -Layer::id() +size_t +Layer::id() const { return this->_id; } +void +Layer::set_id(size_t id) +{ + this->_id = id; +} + PrintObject* Layer::object() { @@ -147,7 +153,7 @@ REGISTER_CLASS(Layer, "Layer"); #endif -SupportLayer::SupportLayer(int id, PrintObject *object, coordf_t height, +SupportLayer::SupportLayer(size_t id, PrintObject *object, coordf_t height, coordf_t print_z, coordf_t slice_z) : Layer(id, object, height, print_z, slice_z) { diff --git a/xs/src/libslic3r/Layer.hpp b/xs/src/libslic3r/Layer.hpp index 5f6a6baa0..c21ffa1c8 100644 --- a/xs/src/libslic3r/Layer.hpp +++ b/xs/src/libslic3r/Layer.hpp @@ -72,7 +72,8 @@ class Layer { friend class PrintObject; public: - int id(); + size_t id() const; + void set_id(size_t id); PrintObject* object(); Layer *upper_layer; @@ -97,11 +98,11 @@ class Layer { template bool any_bottom_region_slice_contains(const T &item) const; protected: - int _id; // sequential number of layer, 0-based + size_t _id; // sequential number of layer, 0-based PrintObject *_object; - Layer(int id, PrintObject *object, coordf_t height, coordf_t print_z, + Layer(size_t id, PrintObject *object, coordf_t height, coordf_t print_z, coordf_t slice_z); virtual ~Layer(); @@ -119,7 +120,7 @@ class SupportLayer : public Layer { ExtrusionEntityCollection support_interface_fills; protected: - SupportLayer(int id, PrintObject *object, coordf_t height, coordf_t print_z, + SupportLayer(size_t id, PrintObject *object, coordf_t height, coordf_t print_z, coordf_t slice_z); virtual ~SupportLayer(); }; diff --git a/xs/xsp/Layer.xsp b/xs/xsp/Layer.xsp index ffc9f9af8..02ac5fc2b 100644 --- a/xs/xsp/Layer.xsp +++ b/xs/xsp/Layer.xsp @@ -35,6 +35,7 @@ // owned by PrintObject, no constructor/destructor int id(); + void set_id(int id); Ref object(); Ref upper_layer() %code%{ RETVAL = THIS->upper_layer; %}; @@ -89,6 +90,7 @@ // copies of some Layer methods, because the parameter wrapper code // gets confused about getting a Layer::Support instead of a Layer int id(); + void set_id(int id); Ref object(); Ref upper_layer() %code%{ RETVAL = (SupportLayer*)THIS->upper_layer; %};