[PD] Fixed loft and sweep breaking on section deletion

Item removal in `onDeleteSection()` was also clearing subname details so if one
of the remaining sections was a face this caused a failure.
This commit is contained in:
Ajinkya Dahale
2021-11-08 21:20:16 -05:00
committed by Uwe
parent 03a8ff7841
commit 314ff0053c
2 changed files with 10 additions and 4 deletions

View File

@@ -212,6 +212,8 @@ bool TaskLoftParameters::referenceSelected(const Gui::SelectionChanges& msg) con
}
else if (selectionMode == refRemove) {
if (f != refs.end())
// Removing just the object this way instead of `refs.erase` and
// `setValues(ref)` cleanly ensures subnames are preserved.
loft->Sections.removeValue(obj);
else
return false;
@@ -250,8 +252,9 @@ void TaskLoftParameters::onDeleteSection()
App::DocumentObject* obj = loft->getDocument()->getObject(data.constData());
std::vector<App::DocumentObject*>::iterator f = std::find(refs.begin(), refs.end(), obj);
if (f != refs.end()) {
refs.erase(f);
loft->Sections.setValues(refs);
// Removing just the object this way instead of `refs.erase` and
// `setValues(ref)` cleanly ensures subnames are preserved.
loft->Sections.removeValue(obj);
//static_cast<ViewProviderLoft*>(vp)->highlightReferences(false, true);
recomputeFeature();

View File

@@ -1042,6 +1042,8 @@ bool TaskPipeScaling::referenceSelected(const SelectionChanges& msg) const {
}
else {
if (f != refs.end())
// Removing just the object this way instead of `refs.erase` and
// `setValues(ref)` cleanly ensures subnames are preserved.
pipe->Sections.removeValue(obj);
else
return false;
@@ -1082,8 +1084,9 @@ void TaskPipeScaling::onDeleteSection()
// if something was found, delete it and update the section list
if (f != refs.end()) {
refs.erase(f);
pipe->Sections.setValues(refs);
// Removing just the object this way instead of `refs.erase` and
// `setValues(ref)` cleanly ensures subnames are preserved.
pipe->Sections.removeValue(obj);
clearButtons();
recomputeFeature();
}