Merge branch 'vb_undoredo_timestamp'

This commit is contained in:
Vojtech Bubnik 2020-09-23 13:00:01 +02:00
commit 0d6eb842b0
4 changed files with 56 additions and 11 deletions

View file

@ -601,7 +601,7 @@ std::vector<GCode::LayerToPrint> GCode::collect_layers_to_print(const PrintObjec
// Check that there are extrusions on the very first layer.
if (layers_to_print.size() == 1u) {
if (!has_extrusions)
throw Slic3r::RuntimeError(_(L("There is an object with no extrusions on the first layer.")));
throw Slic3r::SlicingError(_(L("There is an object with no extrusions on the first layer.")));
}
// In case there are extrusions on this layer, check there is a layer to lay it on.

View file

@ -448,7 +448,11 @@ public:
Vec3d mesh_offset{ Vec3d::Zero() };
Geometry::Transformation transform;
template<class Archive> void serialize(Archive& ar) { ar(input_file, object_idx, volume_idx, mesh_offset, transform); }
template<class Archive> void serialize(Archive& ar) {
//FIXME Vojtech: Serialize / deserialize only if the Source is set.
// likely testing input_file or object_idx would be sufficient.
ar(input_file, object_idx, volume_idx, mesh_offset, transform);
}
};
Source source;
@ -467,7 +471,7 @@ public:
FacetsAnnotation m_supported_facets;
// List of seam enforcers/blockers.
FacetsAnnotation m_seam_facets;
FacetsAnnotation m_seam_facets;
// A parent object owning this modifier volume.
ModelObject* get_object() const { return this->object; }

View file

@ -49,7 +49,12 @@ private:
class ObjectBase
{
public:
ObjectID id() const { return m_id; }
ObjectID id() const { return m_id; }
// Return an optional timestamp of this object.
// If the timestamp returned is non-zero, then the serialization framework will
// only save this object on the Undo/Redo stack if the timestamp is different
// from the timestmap of the object at the top of the Undo / Redo stack.
virtual uint64_t timestamp() const { return 0; }
protected:
// Constructors to be only called by derived classes.
@ -59,7 +64,7 @@ protected:
// by an existing ID copied from elsewhere.
ObjectBase(int) : m_id(ObjectID(0)) {}
// The class tree will have virtual tables and type information.
virtual ~ObjectBase() {}
virtual ~ObjectBase() = default;
// Use with caution!
void set_new_unique_id() { m_id = generate_new_id(); }