Commit 3e65eac4 authored by Pierre Kraemer's avatar Pierre Kraemer

fix crash when manipulating plugin dock tab without a current map selected

parent 1a38e382
*** english version below *** *** english version below ***
Pour compiler CGoGN sur MAC (testé sur OS X 10.8.2) Pour compiler CGoGN sur MAC (testé sur OS X 10.8.3)
Installer avec homebrew Installer avec homebrew
cmake, lzlib, glew, boost149, suite-sparse, qt cmake, lzlib, glew, boost149, suite-sparse, qt
Pour pouvoir installer le paquet suite-sparse, il faut avoir
prélablement ajouté le dépôt homebrew/science grâce à la commande suivante :
brew tap homebrew/science
========================================================================================= =========================================================================================
ENGLISH VERSION ENGLISH VERSION
========================================================================================= =========================================================================================
To compile CGoGN on MAC (tested on OSX 10.8.2) To compile CGoGN on MAC (tested on OSX 10.8.3)
Install with homebrew Install with homebrew
cmake, lzlib, glew, boost149, suite-sparse, qt cmake, lzlib, glew, boost149, suite-sparse, qt
To install suite-sparse package, you must first
add the homebrew/science repository with the following command :
brew tap homebrew/science
...@@ -97,7 +97,8 @@ void RenderDockTab::positionVBOChanged(int index) ...@@ -97,7 +97,8 @@ void RenderDockTab::positionVBOChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); if(map)
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true);
} }
} }
...@@ -107,7 +108,8 @@ void RenderDockTab::normalVBOChanged(int index) ...@@ -107,7 +108,8 @@ void RenderDockTab::normalVBOChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeNormalVBO(view, map, map->getVBO(combo_normalVBO->currentText()), true); if(map)
m_plugin->changeNormalVBO(view, map, map->getVBO(combo_normalVBO->currentText()), true);
} }
} }
...@@ -117,7 +119,8 @@ void RenderDockTab::renderVerticesChanged(bool b) ...@@ -117,7 +119,8 @@ void RenderDockTab::renderVerticesChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeRenderVertices(view, map, b, true); if(map)
m_plugin->changeRenderVertices(view, map, b, true);
} }
} }
...@@ -127,7 +130,8 @@ void RenderDockTab::verticesScaleFactorChanged(int i) ...@@ -127,7 +130,8 @@ void RenderDockTab::verticesScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeVerticesScaleFactor(view, map, i / 50.0, true); if(map)
m_plugin->changeVerticesScaleFactor(view, map, i / 50.0, true);
} }
} }
...@@ -137,7 +141,8 @@ void RenderDockTab::renderEdgesChanged(bool b) ...@@ -137,7 +141,8 @@ void RenderDockTab::renderEdgesChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeRenderEdges(view, map, b, true); if(map)
m_plugin->changeRenderEdges(view, map, b, true);
} }
} }
...@@ -147,7 +152,8 @@ void RenderDockTab::renderFacesChanged(bool b) ...@@ -147,7 +152,8 @@ void RenderDockTab::renderFacesChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeRenderFaces(view, map, b, true); if(map)
m_plugin->changeRenderFaces(view, map, b, true);
} }
} }
...@@ -157,10 +163,13 @@ void RenderDockTab::faceStyleChanged(QAbstractButton* b) ...@@ -157,10 +163,13 @@ void RenderDockTab::faceStyleChanged(QAbstractButton* b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
if(radio_flatShading->isChecked()) if(map)
m_plugin->changeFacesStyle(view, map, FLAT, true); {
else if(radio_phongShading->isChecked()) if(radio_flatShading->isChecked())
m_plugin->changeFacesStyle(view, map, PHONG, true); m_plugin->changeFacesStyle(view, map, FLAT, true);
else if(radio_phongShading->isChecked())
m_plugin->changeFacesStyle(view, map, PHONG, true);
}
} }
} }
......
...@@ -99,7 +99,8 @@ void RenderExplodDockTab::positionAttributeChanged(int index) ...@@ -99,7 +99,8 @@ void RenderExplodDockTab::positionAttributeChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true); if(map)
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true);
} }
} }
...@@ -109,7 +110,8 @@ void RenderExplodDockTab::colorAttributeChanged(int index) ...@@ -109,7 +110,8 @@ void RenderExplodDockTab::colorAttributeChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeColorAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_colorAttribute->currentText()), true); if(map)
m_plugin->changeColorAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_colorAttribute->currentText()), true);
} }
} }
...@@ -119,7 +121,8 @@ void RenderExplodDockTab::renderEdgesChanged(bool b) ...@@ -119,7 +121,8 @@ void RenderExplodDockTab::renderEdgesChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeRenderEdges(view, map, b, true); if(map)
m_plugin->changeRenderEdges(view, map, b, true);
} }
} }
...@@ -129,7 +132,8 @@ void RenderExplodDockTab::renderFacesChanged(bool b) ...@@ -129,7 +132,8 @@ void RenderExplodDockTab::renderFacesChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeRenderFaces(view, map, b, true); if(map)
m_plugin->changeRenderFaces(view, map, b, true);
} }
} }
...@@ -139,7 +143,8 @@ void RenderExplodDockTab::facesScaleFactorChanged(int i) ...@@ -139,7 +143,8 @@ void RenderExplodDockTab::facesScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeFacesScaleFactor(view, map, i, true); if(map)
m_plugin->changeFacesScaleFactor(view, map, i, true);
} }
} }
...@@ -149,7 +154,8 @@ void RenderExplodDockTab::volumesScaleFactorChanged(int i) ...@@ -149,7 +154,8 @@ void RenderExplodDockTab::volumesScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeVolumesScaleFactor(view, map, i, true); if(map)
m_plugin->changeVolumesScaleFactor(view, map, i, true);
} }
} }
......
...@@ -94,7 +94,8 @@ void RenderScalarDockTab::positionVBOChanged(int index) ...@@ -94,7 +94,8 @@ void RenderScalarDockTab::positionVBOChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); if(map)
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true);
} }
} }
...@@ -104,18 +105,21 @@ void RenderScalarDockTab::selectedScalarVBOChanged() ...@@ -104,18 +105,21 @@ void RenderScalarDockTab::selectedScalarVBOChanged()
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
QList<QListWidgetItem*> selectedItems = list_scalarVBO->selectedItems(); if(map)
if(!selectedItems.empty())
{ {
foreach(QListWidgetItem* item, selectedItems) QList<QListWidgetItem*> selectedItems = list_scalarVBO->selectedItems();
if(!selectedItems.empty())
{ {
if(item != list_scalarVBO->currentItem()) foreach(QListWidgetItem* item, selectedItems)
item->setSelected(false); {
if(item != list_scalarVBO->currentItem())
item->setSelected(false);
}
m_plugin->changeScalarVBO(view, map, map->getVBO(list_scalarVBO->currentItem()->text()), true);
} }
m_plugin->changeScalarVBO(view, map, map->getVBO(list_scalarVBO->currentItem()->text()), true); else
m_plugin->changeScalarVBO(view, map, NULL, true);
} }
else
m_plugin->changeScalarVBO(view, map, NULL, true);
} }
} }
...@@ -125,7 +129,8 @@ void RenderScalarDockTab::colorMapChanged(int index) ...@@ -125,7 +129,8 @@ void RenderScalarDockTab::colorMapChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeColorMap(view, map, index, true); if(map)
m_plugin->changeColorMap(view, map, index, true);
} }
} }
...@@ -135,7 +140,8 @@ void RenderScalarDockTab::expansionChanged(int i) ...@@ -135,7 +140,8 @@ void RenderScalarDockTab::expansionChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeExpansion(view, map, i, true); if(map)
m_plugin->changeExpansion(view, map, i, true);
} }
} }
......
...@@ -98,7 +98,8 @@ void RenderTopoSurfaceDockTab::positionAttributeChanged(int index) ...@@ -98,7 +98,8 @@ void RenderTopoSurfaceDockTab::positionAttributeChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true); if(map)
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true);
} }
} }
...@@ -108,7 +109,8 @@ void RenderTopoSurfaceDockTab::drawDartsChanged(bool b) ...@@ -108,7 +109,8 @@ void RenderTopoSurfaceDockTab::drawDartsChanged(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeDrawDarts(view, map, b, true); if(map)
m_plugin->changeDrawDarts(view, map, b, true);
} }
} }
...@@ -118,7 +120,8 @@ void RenderTopoSurfaceDockTab::dartsColorChanged(int i) ...@@ -118,7 +120,8 @@ void RenderTopoSurfaceDockTab::dartsColorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeDartsColor(view, map, combo_dartsColor->color(), true); if(map)
m_plugin->changeDartsColor(view, map, combo_dartsColor->color(), true);
} }
} }
...@@ -128,7 +131,8 @@ void RenderTopoSurfaceDockTab::drawPhi1Changed(bool b) ...@@ -128,7 +131,8 @@ void RenderTopoSurfaceDockTab::drawPhi1Changed(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeDrawPhi1(view, map, b, true); if(map)
m_plugin->changeDrawPhi1(view, map, b, true);
} }
} }
...@@ -138,7 +142,8 @@ void RenderTopoSurfaceDockTab::phi1ColorChanged(int i) ...@@ -138,7 +142,8 @@ void RenderTopoSurfaceDockTab::phi1ColorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePhi1Color(view, map, combo_phi1Color->color(), true); if(map)
m_plugin->changePhi1Color(view, map, combo_phi1Color->color(), true);
} }
} }
...@@ -148,7 +153,8 @@ void RenderTopoSurfaceDockTab::drawPhi2Changed(bool b) ...@@ -148,7 +153,8 @@ void RenderTopoSurfaceDockTab::drawPhi2Changed(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeDrawPhi2(view, map, b, true); if(map)
m_plugin->changeDrawPhi2(view, map, b, true);
} }
} }
...@@ -158,7 +164,8 @@ void RenderTopoSurfaceDockTab::phi2ColorChanged(int i) ...@@ -158,7 +164,8 @@ void RenderTopoSurfaceDockTab::phi2ColorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePhi2Color(view, map, combo_phi2Color->color(), true); if(map)
m_plugin->changePhi2Color(view, map, combo_phi2Color->color(), true);
} }
} }
...@@ -168,7 +175,8 @@ void RenderTopoSurfaceDockTab::facesScaleFactorChanged(int i) ...@@ -168,7 +175,8 @@ void RenderTopoSurfaceDockTab::facesScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeEdgesScaleFactor(view, map, i, true); if(map)
m_plugin->changeEdgesScaleFactor(view, map, i, true);
} }
} }
...@@ -178,7 +186,8 @@ void RenderTopoSurfaceDockTab::edgesScaleFactorChanged(int i) ...@@ -178,7 +186,8 @@ void RenderTopoSurfaceDockTab::edgesScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeFacesScaleFactor(view, map, i, true); if(map)
m_plugin->changeFacesScaleFactor(view, map, i, true);
} }
} }
......
...@@ -88,7 +88,8 @@ void RenderVectorDockTab::positionVBOChanged(int index) ...@@ -88,7 +88,8 @@ void RenderVectorDockTab::positionVBOChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true); if(map)
m_plugin->changePositionVBO(view, map, map->getVBO(combo_positionVBO->currentText()), true);
} }
} }
...@@ -98,11 +99,14 @@ void RenderVectorDockTab::selectedVectorsVBOChanged() ...@@ -98,11 +99,14 @@ void RenderVectorDockTab::selectedVectorsVBOChanged()
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
QList<QListWidgetItem*> currentItems = list_vectorVBO->selectedItems(); if(map)
std::vector<Utils::VBO*> vbos; {
foreach(QListWidgetItem* item, currentItems) QList<QListWidgetItem*> currentItems = list_vectorVBO->selectedItems();
vbos.push_back(map->getVBO(item->text())); std::vector<Utils::VBO*> vbos;
m_plugin->changeSelectedVectorsVBO(view, map, vbos, true); foreach(QListWidgetItem* item, currentItems)
vbos.push_back(map->getVBO(item->text()));
m_plugin->changeSelectedVectorsVBO(view, map, vbos, true);
}
} }
} }
...@@ -112,7 +116,8 @@ void RenderVectorDockTab::vectorsScaleFactorChanged(int i) ...@@ -112,7 +116,8 @@ void RenderVectorDockTab::vectorsScaleFactorChanged(int i)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeVectorsScaleFactor(view, map, i, true); if(map)
m_plugin->changeVectorsScaleFactor(view, map, i, true);
} }
} }
......
...@@ -85,7 +85,8 @@ void SurfaceDeformationDockTab::positionAttributeChanged(int index) ...@@ -85,7 +85,8 @@ void SurfaceDeformationDockTab::positionAttributeChanged(int index)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true); if(map)
m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true);
} }
} }
...@@ -95,7 +96,8 @@ void SurfaceDeformationDockTab::selectLockedVertices(bool b) ...@@ -95,7 +96,8 @@ void SurfaceDeformationDockTab::selectLockedVertices(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeVerticesSelectionMode(view, map, LOCKED, true); if(map)
m_plugin->changeVerticesSelectionMode(view, map, LOCKED, true);
} }
} }
...@@ -105,7 +107,8 @@ void SurfaceDeformationDockTab::selectHandleVertices(bool b) ...@@ -105,7 +107,8 @@ void SurfaceDeformationDockTab::selectHandleVertices(bool b)
{ {
View* view = m_window->getCurrentView(); View* view = m_window->getCurrentView();
MapHandlerGen* map = m_currentParams->selectedMap; MapHandlerGen* map = m_currentParams->selectedMap;
m_plugin->changeVerticesSelectionMode(view, map, HANDLE, true); if(map)
m_plugin->changeVerticesSelectionMode(view, map, HANDLE, true);
} }
} }
......
...@@ -215,7 +215,7 @@ void View::mouseMoveEvent(QMouseEvent* event) ...@@ -215,7 +215,7 @@ void View::mouseMoveEvent(QMouseEvent* event)
plugin->mouseMove(this, event); plugin->mouseMove(this, event);
QGLViewer::mouseMoveEvent(event); QGLViewer::mouseMoveEvent(event);
QList<View*> views = m_window->getViewsList(); QList<View*> views = m_currentCamera->getLinkedViews();
foreach(View* view, views) foreach(View* view, views)
{ {
if(view != this) if(view != this)
...@@ -229,7 +229,7 @@ void View::wheelEvent(QWheelEvent* event) ...@@ -229,7 +229,7 @@ void View::wheelEvent(QWheelEvent* event)
plugin->wheelEvent(this, event); plugin->wheelEvent(this, event);
QGLViewer::wheelEvent(event); QGLViewer::wheelEvent(event);
QList<View*> views = m_window->getViewsList(); QList<View*> views = m_currentCamera->getLinkedViews();
foreach(View* view, views) foreach(View* view, views)
{ {
if(view != this) if(view != this)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "Algo/Modelisation/extrusion.h" #include "Algo/Modelisation/extrusion.h"
#include "Geometry/intersection.h" #include "Geometry/intersection.h"
#include "NL/nl.h" #include "NL/nl.h"
#include "Algo/LinearSolving/basic.h" //#include "Algo/LinearSolving/basic.h"
#include "Algo/Geometry/laplacian.h" #include "Algo/Geometry/laplacian.h"
namespace CGoGN namespace CGoGN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment