From 94d8a2034adb558917b49571e6eae10b80ccf3fe Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 15 Dec 2021 15:13:33 +0100 Subject: [PATCH] PD: hide the sections of a loft only if it can be recomputed successfully --- src/Mod/PartDesign/Gui/TaskLoftParameters.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index bfe2732761..a8d8d7184e 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -388,19 +389,22 @@ TaskDlgLoftParameters::~TaskDlgLoftParameters() { } - bool TaskDlgLoftParameters::accept() { - // TODO Fill this with commands (2015-09-11, Fat-Zer) PartDesign::Loft* pcLoft = static_cast(vp->getObject()); static_cast(vp)->highlightReferences(ViewProviderLoft::Both, false); - for (App::DocumentObject* obj : pcLoft->Sections.getValues()) { - FCMD_OBJ_HIDE(obj); + // First verify that the loft can be built and then hide the sections as otherwise + // they will remain hidden if the loft's recompute fails + if (TaskDlgSketchBasedParameters::accept()) { + for (App::DocumentObject* obj : pcLoft->Sections.getValues()) { + Gui::cmdAppObjectHide(obj); + } + + return true; } - - return TaskDlgSketchBasedParameters::accept (); + return false; } //==== calls from the TaskView ===============================================================