Fixed undo/redo issue when clear method of FacetsAnnotation and ModelConfig

reset timestamp to 1. This led to a bug where e.g. deleting painted facets
through the respective item in object list followed by  possible other actions
and undo restored the painted facets from the time when the project was loaded.
I'm not sure if there was any other situation where this problem manifested.
This commit is contained in:
Lukas Matena 2021-08-30 17:23:44 +02:00
parent 9a5f61c306
commit 270c076e77
6 changed files with 22 additions and 20 deletions

View file

@ -1064,7 +1064,9 @@ Points get_bed_shape(const SLAPrinterConfig &cfg);
class ModelConfig
{
public:
void clear() { m_data.clear(); m_timestamp = 1; }
// Following method clears the config and increases its timestamp, so the deleted
// state is considered changed from perspective of the undo/redo stack.
void reset() { m_data.clear(); touch(); }
void assign_config(const ModelConfig &rhs) {
if (m_timestamp != rhs.m_timestamp) {
@ -1076,7 +1078,7 @@ public:
if (m_timestamp != rhs.m_timestamp) {
m_data = std::move(rhs.m_data);
m_timestamp = rhs.m_timestamp;
rhs.clear();
rhs.reset();
}
}