mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 06:33:57 -06:00
Support / seam / MMU painting serialization / deserialization:
Changed the serialization structure std::map<int, std::vector<bool>> to a significantly more compact std::pair<std::vector<std::pair<int, int>>, std::vector<bool>> Such change shall significantly improve efficiency of Undo / Redo stack.
This commit is contained in:
parent
b59ff2c294
commit
95f4690e25
5 changed files with 56 additions and 43 deletions
|
@ -512,13 +512,21 @@ public:
|
|||
// Assign the content if the timestamp differs, don't assign an ObjectID.
|
||||
void assign(const FacetsAnnotation& rhs) { if (! this->timestamp_matches(rhs)) { m_data = rhs.m_data; this->copy_timestamp(rhs); } }
|
||||
void assign(FacetsAnnotation&& rhs) { if (! this->timestamp_matches(rhs)) { m_data = std::move(rhs.m_data); this->copy_timestamp(rhs); } }
|
||||
const std::map<int, std::vector<bool>>& get_data() const throw() { return m_data; }
|
||||
const std::pair<std::vector<std::pair<int, int>>, std::vector<bool>>& get_data() const throw() { return m_data; }
|
||||
bool set(const TriangleSelector& selector);
|
||||
indexed_triangle_set get_facets(const ModelVolume& mv, EnforcerBlockerType type) const;
|
||||
bool empty() const { return m_data.empty(); }
|
||||
bool empty() const { return m_data.first.empty(); }
|
||||
void clear();
|
||||
|
||||
// Serialize triangle into string, for serialization into 3MF/AMF.
|
||||
std::string get_triangle_as_string(int i) const;
|
||||
|
||||
// Before deserialization, reserve space for n_triangles.
|
||||
void reserve(int n_triangles) { m_data.first.reserve(n_triangles); }
|
||||
// Deserialize triangles one by one, with strictly increasing triangle_id.
|
||||
void set_triangle_from_string(int triangle_id, const std::string& str);
|
||||
// After deserializing the last triangle, shrink data to fit.
|
||||
void shrink_to_fit() { m_data.first.shrink_to_fit(); m_data.second.shrink_to_fit(); }
|
||||
|
||||
private:
|
||||
// Constructors to be only called by derived classes.
|
||||
|
@ -544,7 +552,7 @@ private:
|
|||
ar(cereal::base_class<ObjectWithTimestamp>(this), m_data);
|
||||
}
|
||||
|
||||
std::map<int, std::vector<bool>> m_data;
|
||||
std::pair<std::vector<std::pair<int, int>>, std::vector<bool>> m_data;
|
||||
|
||||
// To access set_new_unique_id() when copy / pasting a ModelVolume.
|
||||
friend class ModelVolume;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue