Part: fix regression of visibility automation in Attachment dialog

If a body is in a Part container and a new primitive is created no preview is shown because the Part container is automatically made invisiible.
The user has to manually make the container visible but this is an error-prone procedure because the Attachment dialog reacts on user-selection and thus
unintended things can happen. So, this is a serious regression of usability.

The regression is caused by commit cd73df745124 but the commit log doesn't explain why the change was even needed.
So, this commit leaves the previous changes but re-adds the old check to filter out container objects.
This commit is contained in:
wmayer
2020-07-12 16:03:01 +02:00
parent 4dad08eff6
commit d2ff5eaebe

View File

@@ -944,9 +944,11 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
if (opening_not_closing) {
QString code = QString::fromLatin1(
"import Show\n"
"from Show.Containers import isAContainer\n"
"_tv_%4 = Show.TempoVis(App.ActiveDocument, tag= 'PartGui::TaskAttacher')\n"
"tvObj = %1\n"
"dep_features = _tv_%4.get_all_dependent(%2, '%3')\n"
"dep_features = [o for o in dep_features if not isAContainer(o)]\n"
"if tvObj.isDerivedFrom('PartDesign::CoordinateSystem'):\n"
"\tvisible_features = [feat for feat in tvObj.InList if feat.isDerivedFrom('PartDesign::FeaturePrimitive')]\n"
"\tdep_features = [feat for feat in dep_features if feat not in visible_features]\n"