From 014790e999eadd897113bccb796e5e113aab45b0 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Fri, 30 Aug 2013 14:44:39 +0200 Subject: [PATCH] update camera BB when associated to a new view + properly activate or not a plugin dock tab on plugin activation --- SCHNApps/include/view.h | 2 +- SCHNApps/src/schnapps.cpp | 10 +++++++++- SCHNApps/src/view.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/SCHNApps/include/view.h b/SCHNApps/include/view.h index 940225b6..5450c60e 100644 --- a/SCHNApps/include/view.h +++ b/SCHNApps/include/view.h @@ -83,7 +83,7 @@ private: glm::mat4 getCurrentProjectionMatrix() const; glm::mat4 getCurrentModelViewProjectionMatrix() const; - void updateViewBB(); + void updateCurrentCameraBB(); private slots: void ui_verticalSplitView(int x, int y, int globalX, int globalY); diff --git a/SCHNApps/src/schnapps.cpp b/SCHNApps/src/schnapps.cpp index dd39ad61..190578d0 100644 --- a/SCHNApps/src/schnapps.cpp +++ b/SCHNApps/src/schnapps.cpp @@ -413,7 +413,15 @@ void SCHNApps::addPluginDockTab(Plugin* plugin, QWidget* tabWidget, const QStrin int idx = m_pluginDockTabWidget->addTab(tabWidget, tabText); m_pluginDock->setVisible(true); - m_pluginDockTabWidget->setTabEnabled(idx, true); + + PluginInteraction* pi = dynamic_cast(plugin); + if(pi) + { + if(pi->isLinkedToView(m_selectedView)) + m_pluginDockTabWidget->setTabEnabled(idx, true); + else + m_pluginDockTabWidget->setTabEnabled(idx, false); + } if(currentTab != -1) m_pluginDockTabWidget->setCurrentIndex(currentTab); diff --git a/SCHNApps/src/view.cpp b/SCHNApps/src/view.cpp index dd511511..50e47d96 100644 --- a/SCHNApps/src/view.cpp +++ b/SCHNApps/src/view.cpp @@ -67,6 +67,7 @@ void View::setCurrentCamera(Camera* c) emit(currentCameraChanged(prev, c)); + updateCurrentCameraBB(); updateGL(); } } @@ -131,7 +132,7 @@ void View::linkMap(MapHandlerGen* map) l_maps.push_back(map); map->linkView(this); emit(mapLinked(map)); - updateViewBB(); + updateCurrentCameraBB(); updateGL(); } } @@ -149,7 +150,7 @@ void View::unlinkMap(MapHandlerGen* map) { map->unlinkView(this); emit(mapUnlinked(map)); - updateViewBB(); + updateCurrentCameraBB(); updateGL(); } } @@ -397,7 +398,7 @@ glm::mat4 View::getCurrentModelViewProjectionMatrix() const return mvpm; } -void View::updateViewBB() +void View::updateCurrentCameraBB() { qglviewer::Vec bbMin(0,0,0); qglviewer::Vec bbMax(1,1,1); -- GitLab