diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 1d327dd080..176f796aee 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -228,6 +228,19 @@ void DocumentObject::touch(bool noRecompute) void DocumentObject::freeze() { StatusBits.set(ObjectStatus::Freeze); + + // store read-only property names + this->readOnlyProperties.clear(); + std::vector> list; + static_cast(this)->getPropertyNamedList(list); + for (auto pair: list){ + if (pair.second->isReadOnly()){ + this->readOnlyProperties.push_back(pair.first); + } else { + pair.second->setReadOnly(true); + } + } + // use the signalTouchedObject to refresh the Gui if (_pDoc) { _pDoc->signalTouchedObject(*this); @@ -241,6 +254,17 @@ void DocumentObject::freeze() void DocumentObject::unfreeze(bool noRecompute) { StatusBits.reset(ObjectStatus::Freeze); + + // reset read-only property status + std::vector> list; + static_cast(this)->getPropertyNamedList(list); + + for (auto pair: list){ + if (! std::count(readOnlyProperties.begin(), readOnlyProperties.end(), pair.first)){ + pair.second->setReadOnly(false); + } + } + touch(noRecompute); } @@ -840,6 +864,10 @@ DocumentObject::onProposedLabelChange(std::string& newLabel) void DocumentObject::onEarlyChange(const Property* prop) { + if (isFreezed() && prop != &Visibility) { + return; + } + if (GetApplication().isClosingAll()) { return; } diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index 76e100591e..e3da15591e 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -110,6 +110,11 @@ class AppExport DocumentObject: public App::TransactionalObject { PROPERTY_HEADER_WITH_OVERRIDE(App::DocumentObject); +private: + // store read-only property names at freeze + // in order to retablish correct status at unfreeze + std::vector readOnlyProperties; + public: PropertyString Label; PropertyString Label2;