Navigation Menu

Skip to content

Commit

Permalink
[skip ci] tmp. disable viewer selection for several interactive comma…
Browse files Browse the repository at this point in the history
…nds in Mesh workbench
  • Loading branch information
wwmayer committed Nov 7, 2019
1 parent 72a30f2 commit acd6cb0
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Mod/Mesh/Gui/Command.cpp
Expand Up @@ -1280,6 +1280,7 @@ void CmdMeshRemoveCompByHand::activated(int)
viewer->setEditing(true);
viewer->setEditingCursor(QCursor(Qt::OpenHandCursor));
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), MeshGui::ViewProviderMeshFaceSet::markPartCallback);
viewer->setSelectionEnabled(false);
}
}

Expand Down Expand Up @@ -1595,6 +1596,7 @@ void CmdMeshFillInteractiveHole::activated(int)
viewer->setEditing(true);
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmap("mesh_fillhole"),5,5));
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), MeshGui::ViewProviderMeshFaceSet::fillHoleCallback);
viewer->setSelectionEnabled(false);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Mod/Mesh/Gui/DlgSmoothing.cpp
Expand Up @@ -149,6 +149,7 @@ TaskSmoothing::TaskSmoothing()

selection = new Selection();
selection->setObjects(Gui::Selection().getSelectionEx(0, Mesh::Feature::getClassTypeId()));
Gui::Selection().clearSelection();
#if !defined (QSINT_ACTIONPANEL)
Gui::TaskView::TaskGroup* tasksel = new Gui::TaskView::TaskGroup();
#else
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Mesh/Gui/MeshEditor.cpp
Expand Up @@ -195,6 +195,7 @@ void MeshFaceAddition::startEditing(MeshGui::ViewProviderMesh* vp)
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(parent());
Gui::View3DInventorViewer* viewer = view->getViewer();
viewer->setEditing(true);
viewer->setSelectionEnabled(false);
viewer->setRedirectToSceneGraph(true);
viewer->setRedirectToSceneGraphEnabled(true);

Expand All @@ -211,6 +212,7 @@ void MeshFaceAddition::finishEditing()
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(parent());
Gui::View3DInventorViewer* viewer = view->getViewer();
viewer->setEditing(false);
viewer->setSelectionEnabled(true);
viewer->setRedirectToSceneGraph(false);
viewer->setRedirectToSceneGraphEnabled(false);

Expand Down
8 changes: 8 additions & 0 deletions src/Mod/Mesh/Gui/MeshSelection.cpp
Expand Up @@ -97,6 +97,14 @@ MeshSelection::~MeshSelection()
}
}

void MeshSelection::setEnabledViewerSelection(bool on)
{
Gui::View3DInventorViewer* viewer = this->getViewer();
if (viewer) {
viewer->setSelectionEnabled(on);
}
}

void MeshSelection::setCallback(SoEventCallbackCB *cb)
{
selectionCB = cb;
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Mesh/Gui/MeshSelection.h
Expand Up @@ -45,6 +45,8 @@ class MeshGuiExport MeshSelection
MeshSelection();
~MeshSelection();

void setEnabledViewerSelection(bool);

void startSelection();
void startDeselection();
void stopSelection();
Expand Down
4 changes: 4 additions & 0 deletions src/Mod/Mesh/Gui/RemoveComponents.cpp
Expand Up @@ -31,6 +31,7 @@
#include "ui_RemoveComponents.h"
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/Selection.h>

using namespace MeshGui;

Expand All @@ -45,8 +46,10 @@ RemoveComponents::RemoveComponents(QWidget* parent, Qt::WindowFlags fl)
ui->spDeselectComp->setRange(1, INT_MAX);
ui->spDeselectComp->setValue(10);

Gui::Selection().clearSelection();
meshSel.setCheckOnlyVisibleTriangles(ui->visibleTriangles->isChecked());
meshSel.setCheckOnlyPointToUserTriangles(ui->screenTriangles->isChecked());
meshSel.setEnabledViewerSelection(false);
}

RemoveComponents::~RemoveComponents()
Expand Down Expand Up @@ -153,6 +156,7 @@ void RemoveComponents::reject()
{
// deselect all meshes
meshSel.clearSelection();
meshSel.setEnabledViewerSelection(true);
}

// -------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Mesh/Gui/SegmentationBestFit.cpp
Expand Up @@ -197,14 +197,17 @@ ParametersDialog::ParametersDialog(std::vector<float>& val, FitParameter* fitPar
Gui::SelectionObject obj(mesh);
std::vector<Gui::SelectionObject> sel;
sel.push_back(obj);
Gui::Selection().clearSelection();
meshSel.setObjects(sel);
meshSel.setCheckOnlyPointToUserTriangles(true);
meshSel.setCheckOnlyVisibleTriangles(true);
meshSel.setEnabledViewerSelection(false);
}

ParametersDialog::~ParametersDialog()
{
meshSel.clearSelection();
meshSel.setEnabledViewerSelection(true);
delete fitParameter;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Mesh/Gui/Selection.cpp
Expand Up @@ -41,6 +41,7 @@ Selection::Selection(QWidget* parent)

meshSel.setCheckOnlyVisibleTriangles(ui->visibleTriangles->isChecked());
meshSel.setCheckOnlyPointToUserTriangles(ui->screenTriangles->isChecked());
meshSel.setEnabledViewerSelection(false);
}

/*
Expand All @@ -51,6 +52,7 @@ Selection::~Selection()
// no need to delete child widgets, Qt does it all for us
delete ui;
meshSel.clearSelection();
meshSel.setEnabledViewerSelection(true);
}

void Selection::setObjects(const std::vector<Gui::SelectionObject>& o)
Expand Down
9 changes: 6 additions & 3 deletions src/Mod/Mesh/Gui/ViewProvider.cpp
Expand Up @@ -314,8 +314,9 @@ ViewProviderMesh::ViewProviderMesh() : pcOpenEdge(0)
CreaseAngle.setValue(angle);
}

if (hGrp->GetBool("ShowBoundingBox", false))
if (hGrp->GetBool("ShowBoundingBox", false)) {
SelectionStyle.setValue(1);
}

Coloring.setStatus(App::Property::Hidden, true);
}
Expand Down Expand Up @@ -371,8 +372,8 @@ void ViewProviderMesh::onChanged(const App::Property* prop)
tryColorPerVertexOrFace(Coloring.getValue());
}
else if (prop == &SelectionStyle) {
pcHighlight->style = SelectionStyle.getValue()
?Gui::SoFCSelection::BOX:Gui::SoFCSelection::EMISSIVE;
pcHighlight->style = SelectionStyle.getValue() ? Gui::SoFCSelection::BOX
: Gui::SoFCSelection::EMISSIVE;
}
else {
// Set the inverse color for open edges
Expand Down Expand Up @@ -1582,6 +1583,7 @@ void ViewProviderMesh::fillHoleCallback(void * ud, SoEventCallback * n)
QAction* id = menu.exec(QCursor::pos());
if (cl == id) {
view->setEditing(false);
view->setSelectionEnabled(true);
view->getWidget()->setCursor(QCursor(Qt::ArrowCursor));
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), fillHoleCallback,ud);
}
Expand Down Expand Up @@ -1629,6 +1631,7 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
QAction* id = menu.exec(QCursor::pos());
if (cl == id) {
view->setEditing(false);
view->setSelectionEnabled(true);
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), markPartCallback,ud);

std::vector<ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
Expand Down

0 comments on commit acd6cb0

Please sign in to comment.