ENABLE_ENHANCED_RELOAD_FROM_DISK set as default

This commit is contained in:
Enrico Turri 2019-09-23 15:35:49 +02:00
parent 1115e77b38
commit 2dc9949a4c
13 changed files with 10 additions and 269 deletions

View file

@ -392,7 +392,6 @@ class ModelVolume final : public ObjectBase
{
public:
std::string name;
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
// struct used by reload from disk command to recover data from disk
struct Source
{
@ -404,7 +403,7 @@ public:
template<class Archive> void serialize(Archive& ar) { ar(input_file, object_idx, volume_idx, mesh_offset); }
};
Source source;
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
// The triangular model.
const TriangleMesh& mesh() const { return *m_mesh.get(); }
void set_mesh(const TriangleMesh &mesh) { m_mesh = std::make_shared<const TriangleMesh>(mesh); }
@ -453,11 +452,7 @@ public:
// Translates the mesh and the convex hull so that the origin of their vertices is in the center of this volume's bounding box.
// Attention! This method may only be called just after ModelVolume creation! It must not be called once the TriangleMesh of this ModelVolume is shared!
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
void center_geometry_after_creation(bool update_source_offset = true);
#else
void center_geometry_after_creation();
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
void calculate_convex_hull();
const TriangleMesh& get_convex_hull() const;
@ -546,11 +541,7 @@ private:
// Copying an existing volume, therefore this volume will get a copy of the ID assigned.
ModelVolume(ModelObject *object, const ModelVolume &other) :
ObjectBase(other),
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
name(other.name), source(other.source), m_mesh(other.m_mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
#else
name(other.name), m_mesh(other.m_mesh), m_convex_hull(other.m_convex_hull), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
{
assert(this->id().valid()); assert(this->config.id().valid()); assert(this->id() != this->config.id());
assert(this->id() == other.id() && this->config.id() == other.config.id());
@ -558,11 +549,7 @@ private:
}
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
name(other.name), source(other.source), m_mesh(new TriangleMesh(std::move(mesh))), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
#else
name(other.name), m_mesh(new TriangleMesh(std::move(mesh))), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
{
assert(this->id().valid()); assert(this->config.id().valid()); assert(this->id() != this->config.id());
assert(this->id() != other.id() && this->config.id() == other.config.id());
@ -583,11 +570,7 @@ private:
}
template<class Archive> void load(Archive &ar) {
bool has_convex_hull;
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
ar(name, source, m_mesh, m_type, m_material_id, m_transformation, m_is_splittable, has_convex_hull);
#else
ar(name, m_mesh, m_type, m_material_id, m_transformation, m_is_splittable, has_convex_hull);
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
cereal::load_by_value(ar, config);
assert(m_mesh);
if (has_convex_hull) {
@ -600,11 +583,7 @@ private:
}
template<class Archive> void save(Archive &ar) const {
bool has_convex_hull = m_convex_hull.get() != nullptr;
#if ENABLE_ENHANCED_RELOAD_FROM_DISK
ar(name, source, m_mesh, m_type, m_material_id, m_transformation, m_is_splittable, has_convex_hull);
#else
ar(name, m_mesh, m_type, m_material_id, m_transformation, m_is_splittable, has_convex_hull);
#endif // ENABLE_ENHANCED_RELOAD_FROM_DISK
cereal::save_by_value(ar, config);
if (has_convex_hull)
cereal::save_optional(ar, m_convex_hull);