override onExtendedDocumentRestored in AttachExtension

This commit is contained in:
wmayer
2017-10-25 22:52:39 +02:00
parent b94917fe51
commit bc3c9b0c5d
3 changed files with 36 additions and 0 deletions

View File

@@ -207,6 +207,38 @@ void AttachExtension::extensionOnChanged(const App::Property* prop)
App::DocumentObjectExtension::extensionOnChanged(prop);
}
void AttachExtension::onExtendedDocumentRestored()
{
try {
bool bAttached = positionBySupport();
// Hide properties when not applicable to reduce user confusion
eMapMode mmode = eMapMode(this->MapMode.getValue());
bool modeIsPointOnCurve =
(mmode == mmNormalToPath ||
mmode == mmFrenetNB ||
mmode == mmFrenetTN ||
mmode == mmFrenetTB ||
mmode == mmRevolutionSection ||
mmode == mmConcentric);
// MapPathParameter is only used if there is a reference to one edge and not edge + vertex
bool hasOneRef = false;
if (_attacher && _attacher->references.getSubValues().size() == 1) {
hasOneRef = true;
}
this->MapPathParameter.setStatus(App::Property::Status::Hidden, !bAttached || !(modeIsPointOnCurve && hasOneRef));
this->MapReversed.setStatus(App::Property::Status::Hidden, !bAttached);
this->superPlacement.setStatus(App::Property::Status::Hidden, !bAttached);
getPlacement().setReadOnly(bAttached && mmode != mmTranslate); //for mmTranslate, orientation should remain editable even when attached.
}
catch (Base::Exception&) {
}
catch (Standard_Failure &) {
}
}
void AttachExtension::updateAttacherVals()
{
if (!_attacher)

View File

@@ -103,6 +103,8 @@ public:
virtual short int extensionMustExecute(void);
virtual App::DocumentObjectExecReturn *extensionExecute(void);
virtual PyObject* getExtensionPyObject(void);
virtual void onExtendedDocumentRestored();
protected:
virtual void extensionOnChanged(const App::Property* /*prop*/);

View File

@@ -5691,6 +5691,8 @@ void SketchObject::onDocumentRestored()
if (this->solve(true) == 0)
Shape.setValue(solvedSketch.toShape());
}
Part::Part2DObject::onDocumentRestored();
}
catch (...) {
}