diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 6fc65f0d7..b3758a3f0 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -335,7 +335,9 @@ public: QSplitter* mainSplitter=0; mainSplitter = new QSplitter(Qt::Horizontal, this); _viewer.push_back(new View3DInventorViewer(mainSplitter)); + _viewer.back()->setDocument(pcDocument); _viewer.push_back(new View3DInventorViewer(mainSplitter)); + _viewer.back()->setDocument(pcDocument); QFrame* vbox = new QFrame(this); QVBoxLayout* layout = new QVBoxLayout(); diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 52cca94ce..03b09a5be 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -60,9 +60,6 @@ #include #include -#include "View3DInventor.h" -#include "View3DInventorViewer.h" - #include #include #include @@ -90,7 +87,7 @@ SO_NODE_SOURCE(SoFCUnifiedSelection); /*! Constructor. */ -SoFCUnifiedSelection::SoFCUnifiedSelection() : viewer(0) +SoFCUnifiedSelection::SoFCUnifiedSelection() : pcDocument(0) { SO_NODE_CONSTRUCTOR(SoFCUnifiedSelection); @@ -289,8 +286,9 @@ void SoFCUnifiedSelection::doAction(SoAction *action) } else if (selaction->SelChange.Type == SelectionChanges::ClrSelection || selaction->SelChange.Type == SelectionChanges::SetSelection) { - std::vector vps = this->pcDocument->getViewProvidersOfType - (ViewProviderDocumentObject::getClassTypeId()); + std::vector vps; + if (this->pcDocument) + vps = this->pcDocument->getViewProvidersOfType(ViewProviderDocumentObject::getClassTypeId()); for (std::vector::iterator it = vps.begin(); it != vps.end(); ++it) { ViewProviderDocumentObject* vpd = static_cast(*it); if (vpd->useNewSelectionModel()) { @@ -350,8 +348,8 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action) SoFullPath *pPath = (pp != NULL) ? (SoFullPath *) pp->getPath() : NULL; ViewProvider *vp = 0; ViewProviderDocumentObject* vpd = 0; - if (pPath && pPath->containsPath(action->getCurPath())) - vp = pcDocument->getViewProviderByPathFromTail(pPath); + if (this->pcDocument && pPath && pPath->containsPath(action->getCurPath())) + vp = this->pcDocument->getViewProviderByPathFromTail(pPath); if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) vpd = static_cast(vp); @@ -423,8 +421,8 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action) SoFullPath *pPath = (pp != NULL) ? (SoFullPath *) pp->getPath() : NULL; ViewProvider *vp = 0; ViewProviderDocumentObject* vpd = 0; - if (pPath && pPath->containsPath(action->getCurPath())) - vp = pcDocument->getViewProviderByPathFromTail(pPath); + if (this->pcDocument && pPath && pPath->containsPath(action->getCurPath())) + vp = this->pcDocument->getViewProviderByPathFromTail(pPath); if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) vpd = static_cast(vp); if (vpd && vpd->useNewSelectionModel() && vpd->isSelectable()) { diff --git a/src/Gui/SoFCUnifiedSelection.h b/src/Gui/SoFCUnifiedSelection.h index 380e778f4..c9914f5ca 100644 --- a/src/Gui/SoFCUnifiedSelection.h +++ b/src/Gui/SoFCUnifiedSelection.h @@ -95,8 +95,6 @@ protected: //virtual void redrawHighlighted(SoAction * act, SbBool flag); //virtual SbBool readInstance(SoInput * in, unsigned short flags); - View3DInventorViewer *viewer; - Gui::Document *pcDocument; private: //static void turnoffcurrent(SoAction * action); //void setOverride(SoGLRenderAction * action); @@ -104,6 +102,7 @@ private: //SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc); static int getPriority(const SoPickedPoint* p); const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const; + Gui::Document *pcDocument; static SoFullPath * currenthighlight; diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index c3623c5fc..5e1963687 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -217,7 +217,6 @@ View3DInventorViewer::View3DInventorViewer (QWidget *parent, const char *name, // must be created. Using an SoSeparator avoids this drawback. selectionRoot = new Gui::SoFCUnifiedSelection(); selectionRoot->applySettings(); - selectionRoot->viewer = this; #endif // set the ViewProvider root node pcViewProviderRoot = selectionRoot;