From a275de72020818a8bdbfd3d8c8a13e63ed64613f Mon Sep 17 00:00:00 2001 From: donovaly Date: Mon, 12 Apr 2021 03:20:18 +0200 Subject: [PATCH] [PD] fix bug that reference selection is always on It is annoying because error-prone, that on opening e.g. primitives the reference selection mode is always on. You then e.g. click in the model and get a new attachment. But when opening existing primitives you don't always want to change the attachment (often only the parameters). And even if you want to change the attachment, you want to select which one and you like to know when you are in selection mode. --- src/Mod/Part/Gui/TaskAttacher.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index fcb46fddef..8f608f7f8a 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -102,6 +102,9 @@ void TaskAttacher::makeRefStrings(std::vector& refstrings, std::vector< for (size_t r = 0; r < 4; r++) { if ((r < refs.size()) && (refs[r] != NULL)) { refstrings.push_back(makeRefString(refs[r], refnames[r])); + // for Origin or Datum features refnames is empty but we need a non-empty return value + if (refnames[r].empty()) + refnames[r] = refs[r]->getNameInDocument(); } else { refstrings.push_back(QObject::tr("No reference selected")); refnames.push_back(""); @@ -195,7 +198,11 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidge ui->lineRef4->blockSignals(false); ui->listOfModes->blockSignals(false); - this->iActiveRef = 0; + // only activate the ref when there is no existing first attachment + if (refnames[0].empty()) + this->iActiveRef = 0; + else + this->iActiveRef = -1; if (pcAttach->Support.getSize() == 0){ autoNext = true; } else {