part deletion handling
-remove everxthing that belongs to a part on deletion -disallow to delete the origin by the user and only remove it when Part is being deleted
This commit is contained in:
@@ -2053,13 +2053,20 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName)
|
||||
}
|
||||
|
||||
/// Remove an object out of the document
|
||||
void Document::remObject(const char* sName)
|
||||
void Document::remObject(const char* sName, bool forceIfUndeletable)
|
||||
{
|
||||
std::map<std::string,DocumentObject*>::iterator pos = d->objectMap.find(sName);
|
||||
|
||||
// name not found?
|
||||
if (pos == d->objectMap.end())
|
||||
return;
|
||||
|
||||
// undeletable?
|
||||
if (pos->second->testStatus(ObjectStatus::Undeletable) && !forceIfUndeletable) {
|
||||
std::stringstream str;
|
||||
str << "Document object '" << pos->second->getNameInDocument() << "' is undeletable";
|
||||
throw Base::Exception(str.str());
|
||||
}
|
||||
|
||||
_checkTransaction(pos->second);
|
||||
|
||||
@@ -2123,7 +2130,7 @@ void Document::_remObject(DocumentObject* pcObject)
|
||||
_checkTransaction(pcObject);
|
||||
|
||||
std::map<std::string,DocumentObject*>::iterator pos = d->objectMap.find(pcObject->getNameInDocument());
|
||||
|
||||
|
||||
if (d->activeObject == pcObject)
|
||||
d->activeObject = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user