diff --git a/src/meshlab/layerDialog.cpp b/src/meshlab/layerDialog.cpp index 936fa3d81..c233dc85b 100644 --- a/src/meshlab/layerDialog.cpp +++ b/src/meshlab/layerDialog.cpp @@ -781,6 +781,34 @@ void LayerDialog::reset() _applytovis->setChecked(false); } +void LayerDialog::setCurrentTab(const MLRenderingData& dt) +{ + if ((mw == NULL) || (mw->meshDoc() == NULL) || (mw->meshDoc()->mm() == NULL)) + return; + MLRenderingAction* act = NULL; + int id = mw->meshDoc()->mm()->id(); + if (dt.isPrimitiveActive(MLRenderingData::PR_SOLID)) + { + act = new MLRenderingSolidAction(id, NULL); + } + else + { + if (dt.isPrimitiveActive(MLRenderingData::PR_WIREFRAME_EDGES)) + { + act = new MLRenderingWireAction(id, NULL); + } + else + { + if (dt.isPrimitiveActive(MLRenderingData::PR_POINTS)) + { + act = new MLRenderingPointsAction(id, NULL); + } + } + } + actionActivated(act); + delete act; +} + void LayerDialog::updateRenderingParametersTab(int meshid,const MLRenderingData& dt ) { if (_tabw != NULL) diff --git a/src/meshlab/layerDialog.h b/src/meshlab/layerDialog.h index f99d724ea..e5f101e08 100644 --- a/src/meshlab/layerDialog.h +++ b/src/meshlab/layerDialog.h @@ -117,6 +117,7 @@ public: void updateDecoratorParsView(); void updateRenderingParametersTab(int meshid,const MLRenderingData& dt); void reset(); + void setCurrentTab(const MLRenderingData& dt); MLRenderingParametersTab* createRenderingParametersTab(); protected: void keyPressEvent ( QKeyEvent * event ); diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 836eedfce..1c86fefab 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -2717,8 +2717,17 @@ bool MainWindow::importMeshWithLayerManagement(QString fileName) globrendtoolbar->setEnabled(false); bool res = importMesh(fileName,false); globrendtoolbar->setEnabled(true); - if (layerDialog != NULL) - showLayerDlg(layervisible || meshDoc()->meshList.size()); + if (layerDialog != NULL) + { + showLayerDlg(layervisible || meshDoc()->meshList.size()); + MLSceneGLSharedDataContext* cont = currentViewContainer()->sharedDataContext(); + if ((cont != NULL) && (GLA() != NULL) && (meshDoc() != NULL) && (meshDoc()->mm() != NULL)) + { + MLRenderingData dt; + cont->getRenderInfoPerMeshView(meshDoc()->mm()->id(), GLA()->context(), dt); + layerDialog->setCurrentTab(dt); + } + } return res; }