Change MultiTransform child detection to the previous method
isMultiTransformChild() tried to do a better job by checking for a parent MultiTransform in the dependency list, but this is unusable during initialization, when these dependencies are not established. The method is changed back to the previous one which only checks for default property values. This will give false results during initialization but not cause problems.
This commit is contained in:
@@ -157,6 +157,9 @@ void Transformed::Restore(Base::XMLReader& reader)
|
||||
|
||||
bool Transformed::isMultiTransformChild() const
|
||||
{
|
||||
// Checking for a MultiTransform in the dependency list is not reliable on initialization
|
||||
// because the dependencies are only established after creation.
|
||||
/*
|
||||
for (auto const* obj : getInList()) {
|
||||
auto mt = Base::freecad_dynamic_cast<PartDesign::MultiTransform>(obj);
|
||||
if (!mt) {
|
||||
@@ -168,6 +171,14 @@ bool Transformed::isMultiTransformChild() const
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// instead check for default property values because these are invalid for a standalone transform feature.
|
||||
// This will mislabel standalone features during the initialization phase.
|
||||
if (TransformMode.getValue() == 0 && Originals.getValue().empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -210,15 +221,6 @@ App::DocumentObjectExecReturn* Transformed::execute()
|
||||
Originals.setValues({});
|
||||
}
|
||||
|
||||
if (!this->BaseFeature.getValue()) {
|
||||
auto body = getFeatureBody();
|
||||
if (body) {
|
||||
body->setBaseProperty(this);
|
||||
}
|
||||
}
|
||||
|
||||
this->positionBySupport();
|
||||
|
||||
std::vector<App::DocumentObject*> originals = Originals.getValues();
|
||||
// Remove suppressed features from the list so the transformations behave as if they are not
|
||||
// there
|
||||
@@ -235,6 +237,15 @@ App::DocumentObjectExecReturn* Transformed::execute()
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
if (!this->BaseFeature.getValue()) {
|
||||
auto body = getFeatureBody();
|
||||
if (body) {
|
||||
body->setBaseProperty(this);
|
||||
}
|
||||
}
|
||||
|
||||
this->positionBySupport();
|
||||
|
||||
// get transformations from subclass by calling virtual method
|
||||
std::vector<gp_Trsf> transformations;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user