[Core] Fix for frozen status
A frozen object prevents the document to be saved The frozen status propagates into object inheritance A frozen sketch is no more editable Transform and Placement can't be changed for a frozen object The freeze icon is reduced
This commit is contained in:
committed by
Chris Hennes
parent
b6697c12eb
commit
1eb8496aae
@@ -242,7 +242,7 @@ void DocumentObject::freeze()
|
||||
*/
|
||||
void DocumentObject::unfreeze(bool noRecompute)
|
||||
{
|
||||
StatusBits.set(ObjectStatus::Freeze, false);
|
||||
StatusBits.reset(ObjectStatus::Freeze);
|
||||
touch(noRecompute);
|
||||
}
|
||||
|
||||
@@ -307,6 +307,9 @@ const char* DocumentObject::getStatusString() const
|
||||
const char* text = getDocument()->getErrorDescription(this);
|
||||
return text ? text : "Error";
|
||||
}
|
||||
else if (isFreezed()){
|
||||
return "Freezed";
|
||||
}
|
||||
else if (isTouched()) {
|
||||
return "Touched";
|
||||
}
|
||||
@@ -795,13 +798,16 @@ App::Property* DocumentObject::addDynamicProperty(const char* type,
|
||||
|
||||
void DocumentObject::onBeforeChange(const Property* prop)
|
||||
{
|
||||
// Store current name in oldLabel, to be able to easily retrieve old name of document object
|
||||
// later when renaming expressions.
|
||||
if (prop == &Label) {
|
||||
oldLabel = Label.getStrValue();
|
||||
if (isFreezed() && prop != &Visibility) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_pDoc) {
|
||||
// Store current name in oldLabel, to be able to easily retrieve old name of document object later
|
||||
// when renaming expressions.
|
||||
if (prop == &Label)
|
||||
oldLabel = Label.getStrValue();
|
||||
|
||||
if (_pDoc){
|
||||
onBeforeChangeProperty(_pDoc, prop);
|
||||
}
|
||||
|
||||
@@ -830,7 +836,7 @@ void DocumentObject::onEarlyChange(const Property* prop)
|
||||
/// get called by the container when a Property was changed
|
||||
void DocumentObject::onChanged(const Property* prop)
|
||||
{
|
||||
if (isFreezed()) {
|
||||
if (isFreezed() && prop != &Visibility) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1141,11 @@ DocumentObject* DocumentObject::getLinkedObject(bool recursive,
|
||||
|
||||
void DocumentObject::Save(Base::Writer& writer) const
|
||||
{
|
||||
if (this->isAttachedToDocument()) {
|
||||
if (this->isFreezed()) {
|
||||
throw Base::AbortException("At least one object is frozen, unable to save.");
|
||||
}
|
||||
|
||||
if (this->isAttachedToDocument()){
|
||||
writer.ObjectName = this->getNameInDocument();
|
||||
}
|
||||
App::ExtensionContainer::Save(writer);
|
||||
|
||||
Reference in New Issue
Block a user