remove possibility of directly cross-referencing other body, use shape binder instead!

This commit is contained in:
wmayer
2017-10-13 17:28:21 +02:00
parent fb58d4b640
commit fb2b9d6cef
3 changed files with 6 additions and 23 deletions

View File

@@ -99,8 +99,6 @@ SketchObject::SketchObject()
ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints");
ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
ExternalGeometry.setScope(App::LinkScope::Global);
allowOtherBody = true;
allowUnaligned = true;
for (std::vector<Part::Geometry *>::iterator it=ExternalGeo.begin(); it != ExternalGeo.end(); ++it)
@@ -2037,13 +2035,9 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p
} else if (body_this == body_obj) {
return true;
} else {
if ( this->allowOtherBody ) { // Selection outside of body not allowed if flag is not set
return true;
} else {
if (rsn)
*rsn = rlOtherBody;
return false;
}
if (rsn)
*rsn = rlOtherBody;
return false;
}
} else {
// cross-part link. Disallow, should be done via shapebinders only
@@ -2096,7 +2090,7 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject
App::Part* part_obj = App::Part::getPartOfObject(pObj);
if (part_this == part_obj){ //either in the same part, or in the root of document
if (body_this != NULL) {
if ((body_this != body_obj) && !this->allowOtherBody) {
if (body_this != body_obj) {
if (rsn)
*rsn = rlOtherBody;
return false;

View File

@@ -305,13 +305,6 @@ public:
/// gets the solved sketch as a reference
inline Sketch &getSolvedSketch(void) {return solvedSketch;}
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
bool isAllowedOtherBody() const {
return allowOtherBody;
}
void setAllowOtherBody(bool on) {
allowOtherBody = on;
}
/// Flag to allow carbon copy from misaligned geometry
bool isAllowedUnaligned() const {
return allowUnaligned;
@@ -356,8 +349,6 @@ protected:
std::vector<Part::Geometry *> supportedGeometry(const std::vector<Part::Geometry *> &geoList) const;
private:
/// Flag to allow external geometry from other bodies than the one this sketch belongs to
bool allowOtherBody;
/// Flag to allow carbon copy from misaligned geometry
bool allowUnaligned;

View File

@@ -6308,7 +6308,6 @@ namespace SketcherGui {
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
{
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(object);
sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier);
this->notAllowedReason = "";
Sketcher::SketchObject::eReasonList msg;
@@ -6321,7 +6320,7 @@ namespace SketcherGui {
this->notAllowedReason = QT_TR_NOOP("This object is in another document.");
break;
case Sketcher::SketchObject::rlOtherBody:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body, can't link. Hold Ctrl to allow cross-references.");
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body, can't link.");
break;
case Sketcher::SketchObject::rlOtherPart:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another part, can't link.");
@@ -6536,7 +6535,6 @@ namespace SketcherGui {
Q_UNUSED(sSubName);
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(object);
sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier || QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
sketch->setAllowUnaligned(QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier));
this->notAllowedReason = "";
@@ -6552,7 +6550,7 @@ namespace SketcherGui {
this->notAllowedReason = QT_TR_NOOP("This object is in another document.");
break;
case Sketcher::SketchObject::rlOtherBody:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body. Hold Ctrl to allow crossreferences.");
this->notAllowedReason = QT_TR_NOOP("This object belongs to another body.");
break;
case Sketcher::SketchObject::rlOtherPart:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another part.");