[PD] fix dressup feature display when broken
As discussed in https://forum.freecadweb.org/viewtopic.php?p=479647#p479377 the user can end up without either seeing nothing or an inexisting dressup feature. This PR fixes this.
This commit is contained in:
@@ -118,6 +118,9 @@ TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView, QWidg
|
||||
ref = pcDraft->PullDirection.getValue();
|
||||
strings = pcDraft->PullDirection.getSubValues();
|
||||
ui->lineLine->setText(getRefStr(ref, strings));
|
||||
|
||||
// the dialog can be called on a broken draft, then hide the draft
|
||||
hideOnError();
|
||||
}
|
||||
|
||||
void TaskDraftParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
@@ -171,6 +174,8 @@ void TaskDraftParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
pcDraft->getDocument()->recomputeFeature(pcDraft);
|
||||
// highlight existing references for possible further selections
|
||||
DressUpView->highlightReferences(true);
|
||||
// hide the draft if there was a computation error
|
||||
hideOnError();
|
||||
} else if (selectionMode == line) {
|
||||
PartDesign::Draft* pcDraft = static_cast<PartDesign::Draft*>(DressUpView->getObject());
|
||||
std::vector<std::string> edges;
|
||||
@@ -185,6 +190,8 @@ void TaskDraftParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
pcDraft->getDocument()->recomputeFeature(pcDraft);
|
||||
// highlight existing references for possible further selections
|
||||
DressUpView->highlightReferences(true);
|
||||
// hide the draft if there was a computation error
|
||||
hideOnError();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,6 +267,8 @@ void TaskDraftParameters::onRefDeleted(void)
|
||||
pcDraft->Base.setValue(base, refs);
|
||||
// recompute the feature
|
||||
pcDraft->recomputeFeature();
|
||||
// hide the draft if there was a computation error
|
||||
hideOnError();
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
@@ -295,6 +304,8 @@ void TaskDraftParameters::onAngleChanged(double angle)
|
||||
setupTransaction();
|
||||
pcDraft->Angle.setValue(angle);
|
||||
pcDraft->getDocument()->recomputeFeature(pcDraft);
|
||||
// hide the draft if there was a computation error
|
||||
hideOnError();
|
||||
}
|
||||
|
||||
double TaskDraftParameters::getAngle(void) const
|
||||
@@ -308,6 +319,8 @@ void TaskDraftParameters::onReversedChanged(const bool on) {
|
||||
setupTransaction();
|
||||
pcDraft->Reversed.setValue(on);
|
||||
pcDraft->getDocument()->recomputeFeature(pcDraft);
|
||||
// hide the draft if there was a computation error
|
||||
hideOnError();
|
||||
}
|
||||
|
||||
bool TaskDraftParameters::getReversed(void) const
|
||||
@@ -373,8 +386,6 @@ TaskDlgDraftParameters::~TaskDlgDraftParameters()
|
||||
|
||||
bool TaskDlgDraftParameters::accept()
|
||||
{
|
||||
parameter->showObject();
|
||||
|
||||
std::vector<std::string> strings;
|
||||
App::DocumentObject* obj;
|
||||
TaskDraftParameters* draftparameter = static_cast<TaskDraftParameters*>(parameter);
|
||||
|
||||
Reference in New Issue
Block a user