Sketcher: when refusing to link external, print why (in statusbar)

This commit is contained in:
DeepSOIC
2015-07-09 22:04:13 +03:00
committed by Stefan Tröger
parent 81592ea816
commit b21950326c
3 changed files with 42 additions and 6 deletions

View File

@@ -1702,13 +1702,26 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
return -1;
}
bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *pObj) const
bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *pObj, eReasonList* rsn) const
{
if (rsn)
*rsn = rlAllowed;
// Externals outside of the Document are NOT allowed
if (this->getDocument() != pDoc)
if (this->getDocument() != pDoc){
if (rsn)
*rsn = rlOtherDoc;
return false;
}
//circular reference prevention
try {
return this->testIfLinkDAGCompatible(pObj);
if (!(this->testIfLinkDAGCompatible(pObj))){
if (rsn)
*rsn = rlCircularReference;
return false
;
}
} catch (Base::Exception &e) {
Base::Console().Warning("Probably, there is a circular reference in the document. Error: %s\n", e.what());
return true; //prohibiting this reference won't remove the problem anyway...
@@ -1721,6 +1734,8 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p
if (body != NULL) {
if ( ! body->hasFeature (pObj) && !this->allowOtherBody ) {
// Selection outside of body not allowed if flag is not set
if (rsn)
*rsn = rlOtherPart;
return false;
}
} else {