From ebad053c7026336e0fad7f7fefa9b7cb476a0634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Althaus?= Date: Wed, 1 May 2024 15:58:48 +0200 Subject: [PATCH] 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. --- src/Mod/PartDesign/App/FeatureTransformed.cpp | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index ea47fa01c8..fe68f30155 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -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(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 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 transformations; try {