diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index b53da7a18..901131403 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -357,6 +357,11 @@ void MainWindow::updateLayerDialog() if (it != dtf.end()) layerDialog->updateRenderingParametersTab(meshDoc()->mm()->id(),*it); } + if (globrendtoolbar != NULL) + { + shared->getRenderInfoPerMeshView(GLA()->context(), dtf); + globrendtoolbar->statusConsistencyCheck(dtf); + } } } @@ -3478,6 +3483,12 @@ void MainWindow::setRenderingData(int mid,const MLRenderingData& dt) share->setRenderingDataPerMeshView(mid, GLA()->context(), dt); share->manageBuffers(mid); //addRenderingSystemLogInfo(mid); + if (globrendtoolbar != NULL) + { + MLSceneGLSharedDataContext::PerMeshRenderingDataMap mp; + share->getRenderInfoPerMeshView(GLA()->context(), mp); + globrendtoolbar->statusConsistencyCheck(mp); + } } } } @@ -3546,6 +3557,7 @@ void MainWindow::updateRenderingDataAccordingToActionsCommonCode(int meshid, con dec.updateMeshDecorationData(*mm, olddt, dt); } /*}*/ + } @@ -3752,7 +3764,11 @@ void MainWindow::updateLog() void MainWindow::switchCurrentContainer(QMdiSubWindow * subwin) { if (subwin == NULL) + { + if (globrendtoolbar != NULL) + globrendtoolbar->reset(); return; + } if (mdiarea->currentSubWindow() != 0) { MultiViewer_Container* split = qobject_cast(mdiarea->currentSubWindow()->widget()); diff --git a/src/meshlab/ml_render_gui.cpp b/src/meshlab/ml_render_gui.cpp index ca8da0299..fc1200210 100644 --- a/src/meshlab/ml_render_gui.cpp +++ b/src/meshlab/ml_render_gui.cpp @@ -1469,6 +1469,33 @@ MLRenderingGlobalToolbar::MLRenderingGlobalToolbar(QWidget* parent /*= NULL*/) initGui(); } +void MLRenderingGlobalToolbar::reset() +{ + foreach(QAction* act, actions()) + { + if (act != NULL) + act->setChecked(false); + } +} + +void MLRenderingGlobalToolbar::statusConsistencyCheck(const MLSceneGLSharedDataContext::PerMeshRenderingDataMap& mp) +{ + foreach(QAction* act, actions()) + { + MLRenderingGlobalAction* rgact = qobject_cast(act); + if (rgact != NULL) + { + bool isvalidforall = (mp.size() != 0); + for (MLSceneGLSharedDataContext::PerMeshRenderingDataMap::const_iterator it = mp.begin(); it != mp.end(); ++it) + { + foreach(MLRenderingAction* rendact, rgact->mainActions()) + isvalidforall &= rendact->isRenderingDataEnabled(it.value()); + } + rgact->setChecked(isvalidforall); + } + } +} + void MLRenderingGlobalToolbar::toggle(QAction* act) { MLRenderingGlobalAction* ract = qobject_cast(act); diff --git a/src/meshlab/ml_render_gui.h b/src/meshlab/ml_render_gui.h index ce96f846b..273e6b033 100644 --- a/src/meshlab/ml_render_gui.h +++ b/src/meshlab/ml_render_gui.h @@ -276,6 +276,10 @@ public: MLRenderingGlobalToolbar(QWidget* parent = NULL); ~MLRenderingGlobalToolbar() {} + + void reset(); +public slots: + void statusConsistencyCheck(const MLSceneGLSharedDataContext::PerMeshRenderingDataMap& mp); private slots: void toggle(QAction* act);